06 · Choose an evidence source
Choose between a manual, an inventory row and an equipment relationship, then measure where the request still fails.
- Part 2
- Build the evidence layer
- Model
Qwen2.5-1.5B-Instruct- Data
- Synthetic facilities helpdesk
- Hardware
- Tesla T4 and CPU, in Google Colab
Which record can answer the operator?
You are at the Facilities Helpdesk. A signed-in operator previously viewed fan F-250 and asks, “What is its maximum temperature?” The desk can see a manual, an inventory view and an equipment graph. Pick the source that can support a temperature before you open the reveal.

F-250 source desk · operator · north-yard
“What is its maximum temperature?”
Saved asset F-250 · current source revision r3
manual-F-250-r3Reveal what changes when the saved revision changes
- Saved r3 · manual
- The current manual supports 101 °C. A reply must return the value and the manual ID.
- Exact ID first found 101 °C but put it in
decisionand leftvaluenull. The parser returned{}. - Saved r2 · clarify
- The saved pointer no longer matches the current equipment record. Resolve the reference before reading the manual.
Change one fact. Keep the asset, the wording and the signed-in session fixed. Change only the saved revision from r3 to r2. Should the desk still read the manual? In the recorded development ticket the saved revision matches and the manual supports the limit. In the controlled replay the older pointer sends the ticket to Clarify before lookup. Using a current record requires a current reference.
Every policy cleared the same structured tickets and missed the manuals
Strict outcomes on the same development requests
1Whole-desk score
Strict passes out of all 24 tickets
a| Manual policy | Strict passes |
|---|---|
| Corpus prefix | 16/24 · 66.7% |
| Exact ID first | 16/24 · 66.7% |
| All tenant manuals | 16/24 · 66.7% |
Paired difference
Compared with the routed corpus prefix
b| Manual policy | pp [95% interval] | Wins / losses |
|---|---|---|
| Exact ID first | 0 [0, 0] | 0 / 0 |
| All tenant manuals | 0 [0, 0] | 0 / 0 |
Every paired difference was zero in the 12 families. The shared routes and the manual failure floor explain the tie.
Resolve the target before choosing a source
A question about 'the fan' is not a complete record identifier. Resolve the user's intended asset and authorized scope first, then choose evidence. Reading a real but different asset is still a wrong answer.
The router takes the trusted role and tenant from the signed-in session, then resolves an explicit asset or a saved reference. A guest request is denied before lookup. More than one requested asset, an unresolved asset or a stale saved reference needs clarification. Once a current asset is resolved, wording in a supported request determines the source. The router uses deterministic rules here. Its route accuracy applies to the recorded fixture questions.
# Lab 06: check the trusted session and resolve one current asset.
if role != "operator" or tenant not in manuals_by_tenant:
return "deny", None
matches = {match.upper() for match in ASSET_ID.findall(question)}
if len(matches) > 1:
return "clarify", None
asset_id = next(iter(matches), previous_asset)
equipment = asset_index.get((tenant, asset_id))
if equipment is None or (not matches and previous_version != equipment["version"]):
return "clarify", NoneA stored reference has a lifetime. Netflix's Studio Search follows configured graph relationships to build search views, then uses reverse lookups to recompute affected documents after source changes. The helpdesk checks its revision directly when the operator refers to a previous asset. Netflix Content Engineering, Studio Search
The route was right even where the answer failed
Routed exact ID first · routing errors, replies and exact matches per slice
2| Slice / route | Errors | Answer | Value | Cites | Strict |
|---|---|---|---|---|---|
| Manual · Manual | 0/4 | 0/4 | 0/4 | 0/4 | 0/4 |
| Inspection · SQL | 0/4 | 4/4 | 4/4 | 4/4 | 4/4 |
| Two sources · Graph + SQL | 0/4 | 4/4 | 4/4 | 4/4 | 4/4 |
| Ambiguity · Clarify | 0/4 | 0/4 | — | — | 4/4 |
| Access · Deny | 0/4 | 0/4 | — | — | 4/4 |
| Follow-up · Manual | 0/4 | 0/4 | 0/4 | 0/4 | 0/4 |
Exact value and citation counts apply to answerable requests. A correct clarification or denial passes with empty value and evidence.
The date request for P-210 returned 2025-07-22 and inventory-P-210-r3. “What is the maximum temperature for that unit?” returned clarify with no value or evidence. On the guest ticket for P-240, the route was deny and nothing was returned. The manual and follow-up routes were selected correctly too. Their failures came after selection.
Put the verified manual inside the budget
Corpus prefix keeps the beginning of the tenant's manuals in corpus order. Exact ID first puts the current manual at the top and keeps the same 112-token evidence budget. All tenant manuals retains the entire scoped list. Keep the question, model and decoding settings fixed across these arms. The matched cap lets you see whether ordering alone changes which evidence survives. Removing the cap also changes how much evidence the model reads.
# Lab 06: select the document order, then apply the measured token cap.
primary = equipment["manual_id"]
entries = manuals_by_tenant[equipment["tenant"]]
if method == "Exact ID first":
entries = sorted(entries, key=lambda doc: doc["id"] != primary)
context = "\n".join(f'[{doc["id"]}] {doc["text"]}' for doc in entries)
all_ids = tokenizer.encode(context, add_special_tokens=False)
visible_ids = all_ids if method == "All tenant manuals" else all_ids[:EVIDENCE_TOKEN_BUDGET]
visible = tokenizer.decode(visible_ids)The presence check looks for the current manual ID and the exact temperature line together. Both may be required to ground an answer. In a separate position study, Liu et al. reported 77.0%, 58.2% and 68.5% accuracy with the relevant document first, tenth and twentieth in a 20-document prompt, respectively, using GPT-3.5-Turbo-0613. Their prompts always contained the answer. Here a cap can remove it entirely. Liu et al., Lost in the Middle, Appendix B
Putting the right manual first doubled the number of visible supporting lines
Same eight manual tickets · median evidence tokens retained and discarded
3| Manual policy | Support visible | Strict passes | Kept | Dropped |
|---|---|---|---|---|
| Corpus prefix | 4/8 | 0/8 | 112 | 208.5 |
| Exact ID first | 8/8 | 0/8 | 112 | 208.5 |
| All tenant manuals | 8/8 | 0/8 | 320.5 | 0 |
manual-F-250-r3 and the line Maximum operating temperature: 101 C. Both survive in Exact ID first and All tenant manuals.F250-00 · “What is its maximum temperature?” · operator · F-250 r3
- Expected
- {"decision":"answer","value":"101","evidence":["manual-F-250-r3"]}
- Corpus prefix
- ID and limit line absent. ```json { "decision": "The maximum temperature of F-250 cannot be determined directly from the provided information.", "value": "", "evidence": [] } ```
- Exact ID first
- ID and limit line visible. ```json { "decision": "The maximum temperature of F-250 is 101°C.", "value": null, "evidence": [ "manual-F-250-r3", "DATE | SYSTEM" ] } ```
- All tenant manuals
- ID and limit line visible. ```json { "decision": "The maximum temperature of F-250 is 101 C.", "value": null, "evidence": [ "manual-F-250-r3" ] } ```
The raw replies include Markdown fences. Both replies with visible support mention the right limit inside the decision field and leave the value null. The parser returned {} for all three.
The first policy lost the evidence for F-250. The other two supplied it, so ordering and budget alone could take the request only as far as the response contract.
Join the two receipts when the question needs both
The last inspection date is a field in a fixed inventory view. The supporting system is the target of a typed supported_by edge. The notebook checks tenant scope on both. It binds the asset and tenant to a read-only inventory lookup and selects the edge from the corresponding tenant's index. A combined read asks for clarification if either source is missing.
Snowflake reports more than 20% average improvement in text-to-SQL accuracy across four production datasets when adding schema understanding to its comparison. Looker’s conversational analytics maps work to defined fields and filters and uses LookML for joins and access grants. Here the field and query are already known, so a fixed view with bound parameters is sufficient. Snowflake Engineering, Figure 2, Google Cloud, Conversational Analytics in Looker
LinkedIn’s job search uses a relationship lookup to resolve employers connected to the searcher and applies the resulting IDs as hard filters. Its embedding addresses preferences separately. The lab likewise reads the link for a known asset from a typed edge. LinkedIn Engineering, Query engine
# Lab 06: select each authorised source only for the routes that need it.
asset_id = equipment["asset"]
inventory = (
read_inventory(asset_id, tenant, role)
if route in {"SQL", "graph + SQL"} else None
)
relation = (
edges_by_tenant[tenant].get(asset_id)
if route in {"graph", "graph + SQL"} else None
)F220-00 · “Give the last inspection date and supporting system for F-220.”
- Expected
- {"decision":"answer","value":"2025-05-05 | S-620","evidence":["inventory-F-220-r3","graph-F-220-r3"]}
- SQL
- {"decision":"answer","value":"2025-05-05","evidence":["inventory-F-220-r3"]}
- graph
- {"decision":"answer","value":"S-620","evidence":["graph-F-220-r3"]}
- graph + SQL
- {"decision":"answer","value":"2025-05-05 | S-620","evidence":["inventory-F-220-r3","graph-F-220-r3"]}
SQL returns the exact date and its inventory receipt. The graph returns the exact system and its edge receipt. The ticket asks for both.
The two-source request passed only when both facts came back
Same four requests from two equipment families
4| Read | Exact value | Exact citations | Strict passes |
|---|---|---|---|
| SQL | 0/4 | 0/4 | 0/4 |
| graph | 0/4 | 0/4 | 0/4 |
| graph + SQL | 4/4 | 4/4 | 4/4 |
The joined response repaired all four cases under either single-source comparison. The paired interval has zero width because the improvement had the same sign and size in both tested families. Generalisation to other schemas and relationships needs more evidence.
Account for tokens and time separately
Both capped policies had the same median prompt size. Increasing the retained evidence from the capped input to the full tenant list increased the median prompt from 276.5 to 485 tokens. Timings cover tokenisation, synchronised generation and decoding, and omit evidence selection. Each arm has two measured warm batches. The 5.09 versus 4.62 seconds comparison is descriptive. The notebook reports no paired timing interval.
The full manual list increased prompt size, batch time and peak memory
Eight requests per policy · two timed batches of four · each panel starts from zero
5Median prompt tokens per request
Median warm seconds per batch
Peak allocated GPU memory, GiB
Model and tokeniser load took 29.64 s. Batch time excludes evidence selection. Peak allocated memory includes the loaded model.
Grade the reply after the route
Strict success requires the decision, trimmed value and exact multiset of evidence IDs to match. For clarification or denial, the expected value and evidence are empty. The grader sorts the evidence lists so order is immaterial and duplicate IDs still count against a match.
Here each starred list is sorted. A candidate's paired difference is the mean difference on the same requests. The interval resamples families with their requests together.
Every manual arm stopped at the same parse failure
Earliest recorded failure on the eight manual tickets per policy
6| Manual policy | Strict pass | No usable JSON | Δ pp [95% interval] |
|---|---|---|---|
| Corpus prefix | 0 | 8 | Reference |
| Exact ID first | 0 | 8 | 0 [0, 0] |
| All tenant manuals | 0 | 8 | 0 [0, 0] |
The parser rejected every raw reply before any decision, value or citation could count. The paired interval describes this floor in four families.
The manual replies failed at parsing. F-250 shows why accepting the Markdown wrapper by itself would leave work for the validator. With Exact ID first, the decoded content still puts a sentence in decision, uses null for value and adds an extra citation. Equal strict scores at this floor do not resolve which ordering would produce more correct outputs with a working answer contract.
What to keep
| Request | Source decision | What must come back |
|---|---|---|
| Maximum temperature for the current F-250 | Exact manual first under the evidence budget | The exact limit and current manual ID |
| Last recorded inspection | Governed SQL view | The scoped date and inventory receipt |
| Supporting system | Typed graph read | The linked system and edge receipt |
| Date and supporting system | Graph + SQL | Both exact values and both receipts |
| Stale saved pointer | Clarify | Empty value and evidence |
Keep permission and revision checks before lookup. For document answers, inspect whether the evidence made it into the prompt and whether the returned object passes the contract. Here Exact ID first improved evidence visibility at the same token cap. Revise the response contract before treating the manual branch as usable.
The equipment graph follows one typed edge. For a question about themes across many documents, Microsoft’s GraphRAG builds community summaries to support corpus-wide synthesis. That is a separate workload and carries index construction cost. Edge et al., From Local to Global, §5.1
How it was built
| Setting | Recorded configuration |
|---|---|
| Development | 24 tickets from 12 equipment families, variants 0 and 3, across manual, inspection, multi-source, ambiguity, access and follow-up slices. |
| Cohorts | 8 manual and follow-up tickets per prompt policy. 16 shared deterministic requests. Four two-source requests from two families in the source ablation. |
| Model | Qwen2.5-1.5B-Instruct, revision 989aa7980e4cf806f80c7fef2b1adb7bc71aa306. |
| Context and decode | 112 evidence tokens for the capped arms. Greedy generation with up to 100 new tokens, batches of 4. Output-text tokens are a re-tokenisation of decoded text. |
| Paired uncertainty | 1,500 bootstrap draws over equipment families. |
| Hardware and libraries | Tesla T4, Python 3.13.16, CUDA 13.0, PyTorch 2.14.1+cu130 and Transformers 4.51.3. Structured reads ran on CPU. |
| Development split digest | 51dbc208b6b20a620237dd76ce0a2db4f10aa75f4f8fc404121e301b8d79a0cf |
The queue recorded 91.2 s for the complete notebook. That includes environment work, model loading, generation and notebook execution overhead. The individual batch and model-load times above use their own narrower boundaries.
Download the executed notebook, summary, request and timing records, two-source ablation and runtime receipt.
Run it yourself
Use Does the desk have a current reference? for the opening case, Which manual survives the token budget? for the context comparison and Did each source answer the question it was asked? for the outcome tables. Predict the effect of each change before running it.
- Give F250-00 the current
r3revision and remove the saved asset field. Keep the wording unchanged. Predict the route, then inspectselect_route's returned route and asset. - Use the same eight manual tickets and halve only the evidence cap. Predict where the current ID survives but its limit line is clipped. Inspect
context,support_visibleandstrict_pass. - On the recorded F-220 ticket, change the wording to ask only for the last inspection date. Predict which source is sufficient, then inspect the chosen route, value and evidence list.
Lesson 07 takes a selected route one step further and verifies the typed arguments and result of a read-only action. Back to Advanced AI Systems Engineering
How is this page?
Last updated on