Semantic Pipelines
Can a real task be built from retrieval, relevance, relation, generation and support decisions?
This chapter reports a CPU run of the pipeline’s retrieval and relevance stages over SciFact, and the full pipeline with a declared weak relation provider. The relation (entailment) and generation providers need a language model and are deferred. All claims used are SciFact’s public claims.
The question
Chapters 21-24 built the pieces: candidate generation, filtering, relation, composition. This chapter asks whether they fit together into a real task. The task is claim research: given a claim, retrieve evidence, decide whether the evidence supports or contradicts the claim, produce an answer, and decide whether that answer is supported.

The chapter question: can a real task be built from these decisions, and is the composition auditable?
The hypothesis and prior work
Our starting hypothesis is that composition is cheaper and auditable, a single large call is competitive on accuracy, and errors concentrate in the relation decision.
Three papers frame it.
| Source | Pipeline shape | What it reports | Relation to this chapter |
|---|---|---|---|
| FEVER, Thorne et al. (2018), §1, §4, §5.7 | Document retrieval, then sentence selection, then textual entailment, over 185,445 claims labelled Supported, Refuted or NotEnoughInfo with the evidence recorded | Its baseline pipeline scored 31.87% when the right evidence also had to be found, and 50.91% on the label alone (§5.7) | The task and the stage split. The numbers are for a different dataset, a different retrieval corpus and a trained entailment model, so they are context for the scale of end-to-end difficulty and are not a bar for ours |
| RARR, Gao et al. (2022), §2-§3, §5.3 | Research (generate queries, retrieve evidence), then revise (detect disagreement, edit) | Preserves the original text’s intent over 90% of the time, against 6-40% for the editing baselines it compares with (§5.3) | The shape of an attribution pipeline. It works after generation, ours before |
| Self-RAG, Asai et al. (2023), §3 | One language model trained to emit reflection tokens (retrieve, relevant, supported, useful) interleaved with its output | Retrieval on demand and critique inside the model | The counterposition. If critique can live inside one model, the composed stages are a choice for auditability, not a necessity |
The first gives the task, the second the shape, the third the counterposition.
The build
src/arbiter/pipeline.py is typed plumbing: five stages, each a transformation over a ClaimState plus a trace entry. The providers are callables, so the same pipeline runs with a real retriever or with stubs. The point is auditability: attribute_error names the one stage that caused an end-to-end error.
from arbiter.pipeline import attribute_error, run_pipeline
DOCS = ["the cat sat", "the dog sat", "a cat and a dog"]
# 1. Build the pipeline from supplied providers (no model).
print("1. run the pipeline over tiny docs (hand-supplied providers)")
def retriever(claim):
return [0, 1, 2]
def filter_fn(claim, candidates):
return [0, 2] # kept the cat docs
def relation_fn(claim, kept_idx):
return "SUPPORT" # a supplied relation decision
def generator(state):
return "the claim is " + state.relation.lower() + "ed"
def checker(state):
return True
run = run_pipeline("the cat", retriever, filter_fn, relation_fn, generator, checker)
for t in run.trace:
print(f" {t.stage:<9} -> {t.detail}")
print(f" verdict = {run.verdict}")
# 2. Error attribution: which stage caused an error?
print("2. error attribution")
state = run.state
for gold_ev, gold_rel, label in (
({9}, "SUPPORT", "evidence 9 never retrieved"), # -> retrieve
({1}, "SUPPORT", "evidence 1 in candidates, not kept"), # -> relevance
({0}, "CONTRADICT", "evidence 0 kept, relation disagrees"), # -> relation
):
stage = attribute_error(gold_ev, state, gold_rel)
print(f" {label:<42} -> {stage}")
The walkthrough prints:
1. run the pipeline over tiny docs (hand-supplied providers)
retrieve -> 3 candidates
relevance -> 2 kept
relation -> SUPPORT
generate -> the claim is supported
support -> True
verdict = SUPPORT
2. error attribution
evidence 9 never retrieved -> retrieve
evidence 1 in candidates, not kept -> relevance
evidence 0 kept, relation disagrees -> relation
The experiment
python examples/ch25-semantic-pipelines/run_ch25.py runs the pipeline on the 188 retrievable SciFact dev claims. Retrieval is BM25 top-10; relevance is the cached ms-marco cross-encoder at the Chapter 22 threshold; the relation stage is a declared weak lexical baseline (Jaccard overlap of content words at 0.3), not an NLI model; generate is a stub template; support is a typed check. The NLI and generation providers are PENDING_RUN.
Test split (results/ch25.jsonl):
| Quantity | Value |
|---|---|
| end-to-end verdict accuracy | 0.165 |
| per-stage error rate: retrieve | 0.080 |
| per-stage error rate: relevance | 0.314 |
| per-stage error rate: relation | 0.441 |
| relation stage accuracy (weak baseline) | 0.197 |
An error is attributed to the first stage that failed: retrieval if the gold evidence was not in the top 10, else relevance if the filter dropped it, else relation if the label is wrong. So the three rates are shares of all 188 claims, they sum with the 31 correct claims to 1 (0.080 + 0.314 + 0.441 + 0.165), and a stage downstream of a failure is never charged for it. The rates are not “how often each stage is wrong” in isolation. In particular the relation rate is the share of claims where everything upstream worked and the label was still wrong.
The per-claim rows also give the relation stage’s confusion matrix over all 188 claims. The gold labels here are only SUPPORT (124 claims) and CONTRADICT (64); NotEnoughInfo cannot occur because these are the claims for which evidence exists.
| gold \ predicted by the lexical relation baseline | SUPPORT | CONTRADICT | NOT_ENOUGH_INFO |
|---|---|---|---|
| SUPPORT (124) | 0 | 90 | 34 |
| CONTRADICT (64) | 0 | 37 | 27 |
What the results show
-
Every error is attributable to exactly one stage. No claim had an ambiguous failure. The composition is auditable, which is the strongest thing this chapter shows: the partition
{retrieve, relevance, relation}covers all 157 errors, 31 claims correct, 188 total. -
Errors concentrate in relation, because the supplied baseline never says SUPPORT. The confusion matrix above shows the lexical baseline predicts CONTRADICT or NOT_ENOUGH_INFO and never SUPPORT, though two thirds of the gold labels (124 of 188) are SUPPORT. Its accuracy of 0.197 (37 of 188) compares with 0.660 (124 of 188) for predicting SUPPORT every time, the boring baseline Chapter 4’s rule asks for. So the concentration of errors in relation is nearly guaranteed by construction. It is a property of the weak provider we were allowed to run, and a stronger statement about relation decisions in general would need a provider that can say SUPPORT.
-
Relevance is the second-largest error source, and it is a real CPU measurement. 0.314 of claims had their evidence retrieved but dropped by the cross-encoder filter — the Chapter 22 decision-error story, now as a pipeline number.
-
Retrieval is the smallest error source. 0.080 of claims lacked the evidence in the top-10. This is consistent with Chapters 21-22: the retriever is not the bottleneck.
-
The single-call baseline is not runnable here. The natural comparisons are a single LLM call and a Self-RAG-style one-model critique; both need a language model and are
NOT_OBSERVED. Saying that is the honest result, not a gap to paper over.
Wrong / Correct. Wrong: “The pipeline beats a single call because composition is better.” Correct: “The pipeline is auditable: every error has a stage. Whether composition costs or gains accuracy against a single call is not measured here, because the single call was not run. What this chapter shows composition buys is attribution.”
What the result means
A pipeline is software; a pipeline run is evidence. The typed plumbing is tested and real. The per-stage attribution is a real CPU measurement. The 0.165 end-to-end number, however, is the pipeline with a weak supplied relation provider; it is not a claim about what a real relation decision achieves.
Retrieval error, relevance error and relation error are separate budgets. They have different sizes (0.080, 0.314, 0.441) and different fixes: a bigger candidate list, a better filter, an entailment model.
What to carry forward
The retrieval and relevance stages are real and measurable, and their errors are separable. The relation stage is where a decision model would earn its place, and it is the one we could not run. The generation stage is a stub. Chapter 26 generalises the pipeline from a list to a graph, where the trace this chapter built becomes the graph’s provenance.
Limitations
- Retrieval and relevance are real CPU measurements; relation is a declared weak lexical baseline; generate is a stub. The NLI and generation providers are
PENDING_RUN. - The single-call and Self-RAG-style baselines are
NOT_OBSERVED(need an LLM). - The relation error concentration (0.441) is largely an artifact of the weak baseline, which never predicts SUPPORT; a real entailment provider would change it.
- The 188 SciFact dev claims were used as the test split for Chapters 21-23 and 25. Chapter 35’s audit section states what that does to the Part VI claims.
What this chapter establishes
Which parts of the pipeline justified being decisions? Retrieval and relevance justified being stages, with real, separable error budgets. The relation stage is where a decision provider would have to earn its place, and it is the one stage this chapter could not run with a real provider.