Decision Graphs
What must be recorded so a graph of decisions can be inspected, replayed and audited?
Design chapter. this chapter builds the graph machinery and runs a fake-provider replay study on CPU. No model runs; every provider is a deterministic or seeded fake. The numbers measure the machinery, not any model.
The question
Chapter 25 showed a pipeline whose every error is attributable to one stage. But a list of stages is a weak container for that attribution: it cannot say why a verdict depended on some evidence and not other evidence, and it cannot be replayed after the fact to check whether the world has moved.
This chapter asks: what must be recorded so a graph of decisions can be inspected, replayed and audited?
The answer shapes what counts as evidence everywhere else in the book: Chapter 35’s verdicts cite ledger rows; a ledger row you cannot replay is a claim you cannot check.
The hypothesis and prior work
Our starting hypothesis is that replays disagree for sampled providers and agree for deterministic ones, and drift is detectable by state hash.
Three papers frame it. Buneman et al. is a classic, cited at summary level.
| Source | What the graph is | What it records or optimises | What it gives this chapter |
|---|---|---|---|
| Graph of Thoughts, Besta et al. (2023), §3-§4 | LLM thoughts as vertices, dependencies as edges, with transformations that generate, aggregate and refine | A Graph Reasoning State holds the history of thoughts and their states (§4.5); a static Graph of Operations is the plan | The closest structural prior art: a dynamic state beside a static plan. Its vertices are free-text thoughts, ours are typed decisions with an answer set |
| MIPRO, Opsahl-Ong et al. (2024), §2, §4.3, §6 | A multi-stage LM program whose modules are the unit of optimisation | Prompts and demonstrations are optimised against a task-level metric alone, with credit assignment across stages; it beat baselines on 5 of 7 programs, by up to 13% (§6) | A graph of decisions is something you can optimise, not only record. This chapter records; it does not optimise |
| Buneman, Khanna and Tan (2001) | A query over data, with provenance of the output | Why-provenance: which source data contributed. Where-provenance: which source locations an output was copied from | The vocabulary for audit. Our where is a loose analogue (consumed state fields) rather than Buneman’s copy origin, as the section on provenance explains |
None of the three contradicts the chapter. They differ from it in one respect worth keeping in view: GoT and MIPRO treat the graph as a means of producing better answers, whereas this chapter treats it only as an artifact to inspect afterwards.
The build
src/arbiter/graph.py defines a GraphRecord — question, answer set, decision, provider and seed, calibration record id, upstream dependencies, consumed state fields, a state hash, a timestamp, and whether the provider is deterministic — and a DecisionGraph that records, persists, replays and explains them.

The diamond is the smallest graph in which provenance has something to say. The next sections use a chain for the replay study; the diamond appears again when the hash is discussed.
from arbiter.graph import (
DecisionGraph,
categorise,
deterministic_fake,
replay,
run_and_record,
)
from arbiter.retrieve import mrr, rank
# 1. Record a three-node chain with fake providers.
print("1. record a decision graph")
g = DecisionGraph()
state: dict = {}
prev = "root"
for i in range(3):
rec = run_and_record(
node_id=f"n{i}", kind="decision", question=f"q{i}",
answer_set=("a", "b", "c"), provider=deterministic_fake,
provider_name="deterministic", seed=None, state=state,
evidence=(prev,), consumed_fields=tuple(sorted(state.keys())),
deterministic=True,
)
g.add_record(rec)
prev = f"n{i}"
for nid in g.topo_order():
r = g.records[nid]
print(f" {nid}: {r.question} -> {r.decision} hash={r.state_hash}")
# 2. Why and where provenance.
print("2. provenance")
why = g.explain("n2", mode="why")
where = g.explain("n2", mode="where")
print(f" why of n2 -> {why['why']}")
print(f" where of n2 -> {where['where']}")
# 3. Replay with the stored seeds: full agreement.
print("3. replay")
out = replay(g, lambda rec: deterministic_fake)
print(f" decision agreement: {sum(o.decision_agreed for o in out)}/{len(out)}")
print(f" categories: {categorise(out)}")
The walkthrough prints:
1. record a decision graph
n0: q0 -> c hash=fd2079a3096d5abb
n1: q1 -> b hash=f2e766f5a819b5ee
n2: q2 -> a hash=a19ec48d047e48c1
2. provenance
why of n2 -> ['n0', 'n1']
where of n2 -> ['n0', 'n1']
3. replay
decision agreement: 3/3
categories: {'no_change': 3}
The replay study
python examples/ch26-decision-graphs/run_ch26.py records 50 graphs of five nodes each (deterministic and seeded-sampled fake providers) and replays them two ways: with the stored seeds, and with the sampled nodes’ seeds changed by one. results/ch26.jsonl:
| Quantity | Value |
|---|---|
| replay agreement, stored seeds (250 nodes) | 1.000 |
| replay agreement, changed seeds (250 nodes) | 0.684 |
| agreement loss, changed seeds (paired bootstrap) | −0.316 [−0.376, −0.264] |
| nodes whose state hash drifted | 0.696 |
| graphs with at least one drifted node | 48 / 50 |
mean explain time |
0.002 ms |
What the results show
-
Deterministic nodes survive replay; sampled nodes do not, by the design of the fakes. With the stored seed, every node reproduces (1.000). Change the seed on a sampled node and its decision flips 79% of the time, dragging the agreement down to 0.684. The riddle “is this decision replayable?” is answered by one field:
deterministic. -
Drift detection is broader than decision disagreement. 0.696 of nodes show a changed state hash, more than the 0.316 whose own decision changed. A changed decision upstream changes the hash of every downstream node, even one whose own decision is unchanged. In these graphs, which are all chains, that is what an auditor wants: a trace of the nodes touched by a drift, not just the node where it started. Two caveats limit it. The fake providers ignore their inputs, so a changed upstream decision never changes a downstream decision here; with real providers it would, and the study cannot show how often. And the next section shows that outside chains the hash flags more than the dependents.
-
The hash is over the decision sequence, not over provider internals. The first version of the hash included the provider name and seed in the node entry, which made replay structurally unequal for no semantic reason; the current hash is over the ordered decisions recorded so far, so it detects decision drift and not internal score drift. This is the “what must be recorded” question answered precisely: enough to reproduce the decisions, and a checksum over those decisions.
-
Explain is the cheap direction. Recovering the ancestors (why) and consumed fields (where) of any output is microseconds on a stored graph. The expensive direction is replay, which re-runs providers; explain reads the record.
-
Buneman’s split applies, loosely.
whyof a node is its transitive dependencies;whereis the state fields that node and its ancestors consumed. In a chain both are the same list. In the diamond above, whereddepends onbandcbut only consumedb’s output, the code returnswhy = [a, b, c]andwhere = [a, b](pinned intests/graph/test_graph.py). The two answer different audit questions: which decisions could have influenced this one, and which pieces of state did it read. Buneman’s where-provenance is stricter, about where a value was copied from, so the name is borrowed for a weaker idea.
Wrong / Correct. Wrong: “A decision log is a record of what was returned.” Correct: “A decision record is a replayable unit: the question, the provider and its seed, the dependencies, the consumed state, a checksum and a timestamp. A log you cannot replay is a log you cannot audit.”
Where the hash breaks
A review pass tried the machinery on graphs that are not chains, and found a defect worth reporting in a chapter about auditing.
The recorded state_hash covers every decision recorded so far, in the order they were recorded, not only the node’s ancestors. Replay hashes the decisions in topological order. For a chain the two orders coincide. For other graphs they may not: record a, then b (depending on a), then c (independent of both). Recording order is a, b, c; topological order, as topo_order() returns it, is a, c, b. A deterministic replay with the stored seeds then reports c and b as state_changed_decision_same, which is false drift, although every decision agrees. The test test_recording_order_differing_from_topological_order_is_not_drift in tests/graph/test_graph.py reproduces this and is marked xfail(strict=True), so the suite records the defect and will fail loudly the day it is fixed.
Two consequences follow. The headline numbers above are unaffected, because the replay study uses chains, where the orders agree. But the claim that the hash identifies “the nodes touched by a drift” holds only for chains; in general it flags every later-recorded node, whether or not it depends on the changed one. A faithful design hashes only a node’s ancestors, in a canonical order. That would change stored hashes in Chapters 26, 34 and 35, so it is not applied here; it is proposed in planning/pivot-proposals.md for the author’s decision.
The auditable-artifact contract
schemas/decision-record.schema.json is the JSON Schema a record must satisfy: question, answer_set, decision, provider, provider_seed, calibration, evidence, consumed_fields, state_hash (a 16-hex sha256), timestamp, deterministic. tools/replay.py replays a stored graph and prints the disagreement categories. Together they make a decision an artifact you can check.
What to carry forward
On this build, a decision must record the question and answer set (so the decision is meaningful), the provider and seed (so it can be reproduced), the dependencies and consumed fields (so why/where can be recovered), and a checksum over the decision sequence (so drift is detectable). Chapter 34 composes these graphs into a program whose side effects are gated by decisions, and replays the whole graph from Chapter 26’s records.
Limitations
- The replay study uses fake providers only; the agreement rates are properties of those fakes, not of real providers. A real, sampled provider’s replay behaviour is
PENDING_RUN. - Buneman et al. 2001 is cited at the summary level (a classic, not on arXiv).
- The state hash is over the decision sequence; it detects decision drift, not internal score drift within a provider.
- The graph is an in-memory/JSONL structure, not a database; storage cost is not measured.
- The replay study uses chains and providers that ignore their inputs. Behaviour on non-chain graphs (hash defect above) and with providers whose decisions depend on upstream decisions is not in
results/ch26.jsonl.
What this chapter establishes
What is the minimum a decision must record to count as evidence? Its question and answer set, its provider and seed, its dependencies and consumed fields, and a checksum over the decision sequence. The next chapter asks a cost question about the same decisions: when several questions share one state, how much work is shared, and what happens to that sharing when the state changes.