What was run, and what each result compares
The system answers the 715 prose questions of the Receita Federal's P&R IRPF 2024 in four steps: segment the cited legislation, retrieve passages, put up to a token budget of them in front of a generator, and score the answer against the official one with nuggets. Click a stage to see what was varied, what was held fixed, and where it was decided. The summary report is .
Experiment grid: every scored answer run
Rows are context sets (embedding × strategy × budget, plus controls); columns are generators. The number is the
count of questions scored. 715 full runs are comparable with each other;
596 oracle runs cover only questions that cite a provision of the corpus;
30 pilot runs use the stratified_30 sample only and must not be compared with full runs.
Click a cell to open the run in the Answers tab.
Headline comparisons
Segmentation strategies: what each index contains
All strategies are filters over one chunk table (segmented/chunks_all.csv.gz), embedded once per
model. A strategy is the set of chunk types (Tipo) it indexes and, for S2c/S4, which text variant of paragraph-family
chunks it uses (scripts/rag/strategies.yaml). Design: ;
caput variants: ; length cap:
.
Interactive example: one article under each strategy
Chunks indexed per strategy (RIR/1999 excluded)
Strategy table
How retrieval is scored across strategies that cut the text differently
S1 indexes whole articles; S2 also indexes caput, paragraphs, incisos, alíneas and items. A raw chunk rank is
therefore not comparable between them. The evaluation (scripts/rag/ragpipe/evaluation.py,
relevance.py) scores one ranked list of chunks per question three ways, and always matches the gold
at the level of the gold, not at the level of the chunk. Reference note:
; plan:
.
Answer to the key question: "if the gold is an article, how are S2 retrievals evaluated?"
Matching (rule G2)
An article-level gold item (document, art N) is hit by any chunk of
article N: the whole article, one of its split parts, its caput, any §, inciso, alínea or item. In S3/S4 a grouping chunk
(chapter, section…) hits every article whose interval it contains. So an S2 inciso of art. 8 counts as "art. 8 retrieved".
MRR and nDCG@10 (unit view)
The chunk ranking is first projected to distinct articles: walk the ranking, and each article gets the position at which any of its chunks first appears; later chunks of an already-seen article are ignored. MRR = 1 / position of the first gold article in that list; nDCG@10 uses binary gain over the first 10 distinct articles. The position is therefore "the n-th distinct article", whatever the chunk size, and it is the position of any part of the article, not of the whole-article chunk.
Recall within the 4k budget (headline)
The context the generator sees is built from the ranking (score order, containment de-duplication with merge, overflow skip) until 4,000 Qwen3 tokens. A gold article counts as recalled when any of its chunks is in that context. Position inside the context does not matter. This is the only view that accounts for chunk length: short S2 chunks let more distinct articles fit.
Worked example (interactive)
A made-up question citing Lei 9.250 art. 8, § 2º and Lei 9.250 art. 35, inciso VI.
Gold items: document lei_9250; articles art8, art35; provisions
art8_par2, art35_cpt_inc6. The two rankings are illustrative, not from a run; the selection and
metric code below re-implements the pipeline's rules in the browser. Change the level, the budget or the dedup mode.
All rules in one table
Retrieval results (legal-provision test)
Evaluation of each embedding's rankings
(runs/retrieval/<embedding>/irpf/eval/…). The same code builds the generator contexts, so budget-view numbers
describe exactly what the generator saw. Gemini comparison: .
Budget view
Unit view: recall@k over distinct units
Unit view: MRR and nDCG@10
Raw view: recall@k over chunks (diagnostic only)
Paired comparisons
Per-question differences b − a over the same questions; 95 % paired-bootstrap CI (10,000 resamples) and a sign-flip
permutation p. Within an embedding the rows come from comparisons.csv (written by rag.py evaluate);
Gemini − jua rows are computed by scripts/report/build_dashboard_data.py from the two per_question.csv.gz
with the same functions (ragpipe.metrics). The note's ad hoc table used 5,000 resamples, so its CIs differ in the third decimal.
Reachability (oracle): which gold items any chunk of the strategy can hit
How answers are scored with nuggets
Each official answer was broken into nuggets, short facts a correct answer must state, labelled
vital or okay (frozen set nuggets/gold/v0-auto/). A judge (Gemini 3.8 Flash, prompt assign_v2)
reads a system answer and labels every nugget support, partial_support, not_support or contradicts.
Plan: ; execution:
; scoring:
; code: scripts/nuggets/nuggetizer/scoring.py.
Vital or okay: what it means, who assigned it, where it comes from
- Test (check C4 of the nuggetization plan): would an answer to this question without this fact be wrong or misleading? Yes = vital, no = okay. Project rules: every question has at least one vital nugget (except pointer answers such as Q316); "Atenção" notes are usually okay. 2,262 of the 3,175 gold nuggets are vital.
- Who assigned it: the nugget creator, GPT-6.1 Sol (prompt
create_v4), in the same call that wrote the nugget. No person labelled them. Checks: where Gemini 3.1 Pro and Qwen 3.8 Max produced the same nugget independently, all three families gave it the same importance 81 % of the time; random vital ↔ okay flips (10 / 20 / 30 %) keep S2 − S1 significant in 95 / 79 / 65 % of replicates (Luna; tab 6, robustness). - Where it comes from: the labels and the scores V_strict, V, A_strict, A and W (okay weighted 0.5) follow the TREC 2024 RAG Track: Pradeep et al., Initial Nugget Evaluation Results for the TREC 2024 RAG Track with the AutoNuggetizer Framework (arXiv:2411.09607). The split itself is from the TREC 2003 QA track: Voorhees, Evaluating Answers to Definition Questions (HLT-NAACL 2003) and Overview of the TREC 2003 QA Track. A critique of the binary split, with weighted "nugget pyramids": Lin and Demner-Fushman, Will Pyramids Built of Nuggets Topple Over? (HLT-NAACL 2006). The C4 wording, the categories and the project rules are this project's own.
- Tab 8 (question trace) shows the label on every nugget, with the other families' labels where the alignment links them.
Calculator: click a label to cycle it, click vital/okay to toggle
Metrics for this one question
From one question to a run score
- Per question first, then the mean. Every metric is computed per question and the run value is the plain mean over questions (macro average). A question with 115 nuggets weighs as much as one with 2.
- Questions without vital nuggets have no V_strict / V (NaN) and drop out of those means. That is why paired comparisons say n = 714 for V_strict and 715 for A_strict.
- Abstentions and errors are not sent to the judge: every nugget is not_support
(
source = abstained / error). An abstaining generator is therefore penalised on recall but not on contradictions. - Oracle runs cover only the 596 questions with a gold provision in the corpus; compare them with S1/S2 only through the paired comparisons (which use the common questions, n = 595).
- Context support uses the same nuggets and the same labels, but the judge reads the context instead of the
answer (prompt
assign_ctx_v1). It measures what the context makes available, including passages the P&R did not cite. - Paired tests: per-question differences, 95 % paired bootstrap CI, sign-flip permutation p, and a chapter-cluster bootstrap (the 48 P&R chapters resampled as clusters).
Gold nugget set at a glance
Answer and context scores
Tables in nuggets/scoring/tables/gold-v0-auto/gemini-3.8-flash/all/. Run ids with
@gemini-emb-2 use the Gemini retrieval; the others use jua-4b-mixed. Trimmed grid:
.
Paired comparisons of answer runs
Context support vs answer score (full runs)
How much of the context the generator uses
utilisation_runs.csv: utilisation = share of nuggets the context fully supports that the
answer also supports; leakage = answer supports a nugget the context does not hold at all.Robustness of S1 → S2
Three nugget sets (primary GPT-6.1 Sol, Gemini 3.1 Pro, Qwen3.8-Max)
crossset_comparisons.csv, jua only).Randomly damaged nugget sets
perturbation_s1_s2.csv); pre-registered bar: still significant in most replicates at 15–20 % damage. Table: targeted edits (drop condition nuggets, drop audit-flagged nuggets, keep only nuggets all three makers agree on), where "rate" is the share of the targeted nuggets removed.Nugget subsets
Per P&R chapter (S2 − S1 V_strict)
Second judge (Gemini 3.1 Pro on 70 questions)
One question, end to end
Validate the pipeline on single cases: the gold references, where each gold item ranked under every strategy and embedding, what the 4k contexts actually contained, and how the judge labelled every nugget in every run. Click a label cell to read that answer.
Gold items and where they ranked
Contexts side by side
Nuggets × runs
Question trace: one question through every stage
Follow one question from its official answer to the generated answer: gold nuggets and where they may come from
(A), the gold documents under every segmentation strategy (B), the ranking of one strategy × embedding run with gold marks (C), the
texts that fit in the token budget and the prompt sent to the generator (D), and the answer with the judge's label for every gold
nugget (E). Links between panels: click a nugget, a chunk, a ranked row or a context item. Plan:
; data:
scripts/report/build_trace_data.py.
Design and execution notes
Every note in docs/, newest last. Opens in the side reader; the ¶ links across the dashboard jump to the
relevant section.