--- pretty_name: rag-eval-ptbr — Brazilian tax-law RAG evaluation golden set license: cc-by-4.0 language: - pt task_categories: - question-answering - text-retrieval tags: - rag - rag-evaluation - llm-as-judge - legal - tax - brazil - portuguese size_categories: - n<1K configs: - config_name: tributario-golden data_files: - split: test path: tributario-golden/test.parquet - config_name: tributario-corpus data_files: - split: test path: tributario-corpus/test.parquet --- # rag-eval-ptbr — golden set tributário (pt-BR) End-to-end **RAG evaluation** golden set in **Brazilian Portuguese**, tax-law domain (CTN — National Tax Code — and LC 123/2006, Simples Nacional). Designed to measure faithfulness/groundedness, context precision/recall, retrieval quality and citation accuracy of RAG pipelines — not a reading-comprehension QA set. Built for (and consumed by) the open-source harness [`rag-eval-ptbr`](https://github.com/rafaelsouza-tech/rag-eval-ptbr), which adds a statistically grounded regression runner (`rageval run` / `rageval compare`). *Versão em português abaixo.* ## Configs | Config | Rows | What it is | |---|---|---| | `tributario-golden` | 35 | evaluation items (split `test`) | | `tributario-corpus` | 536 | canonical article-level corpus with stable semantic IDs | **Golden item fields:** `id`, `question` (natural question, as a taxpayer/lawyer would ask), `reference_answer` (curated, fully supported by the labeled passages), `golden_passage_ids` (complete and minimal set of supporting corpus chunks), `reference_citations` (canonical format `(CTN, art. 173, I)`), `answerable` (4 items are deliberately unanswerable from the corpus — abstention probes) and `metadata` (question type: factual / multi_hop / condicional / temporal / nao_respondivel; difficulty; source law; smoke-set flag; curation provenance). **Corpus chunk fields:** `doc_id` (semantic, hierarchical, stable — `ctn:art-173`, `lc123:art-18-p4`), `text` (verbatim official text), `source_law`, `article`, `url`. Scope: full CTN (arts. 1–218) + LC 123/2006 (arts. 1–41). Retrieval metrics (recall@k, MRR, nDCG) are deterministic `doc_id` matching — no LLM needed. ## Construction & curation 1. Corpus parsed verbatim from official Planalto sources by a reproducible script (`scripts/build_corpus.py` in the repo); articles over ~350 tokens subdivided by paragraph. 2. Items **LLM-generated** grounded on real corpus passages, by a model from a different family than the judge (against self-preference bias). 3. **Adversarial verification, one independent pass per item**: support of every answer claim checked against the actual chunk text, completeness/minimality of `golden_passage_ids`, citation format, question naturalness. Items were fixed or dropped. 4. Deduplication and consolidation (36 → 35 items). **Honest provenance:** `curated_by` reads `geração sintética por LLM (verificação adversarial; revisão humana pendente)`. Item-by-item human review is the acceptance bar for v1.0; this v0.x release is published for reproducibility and early use. ## Limitations - Single domain (federal tax law); 35 items — designed for paired regression testing, not leaderboard-scale comparison. - Reference answers reflect the **statute text as compiled in July 2026**; they ignore case law by design (answers must be fully supported by the corpus). - Generated by an LLM: despite adversarial verification, residual errors are possible — open an issue in the repo if you find one. - Not legal advice. ## License & sources Source texts are official Brazilian normative acts, **in the public domain** (Law 9.610/1998, art. 8, IV). The curation/annotation layer (questions, reference answers, labels) is released under **CC-BY-4.0**. Attribution: *Rafael Souza, rag-eval-ptbr golden set tributário*. ## Citation ```bibtex @misc{souza2026rageval, author = {Souza, Rafael}, title = {rag-eval-ptbr: RAG evaluation harness and golden set for Brazilian Portuguese}, year = {2026}, url = {https://huggingface.co/datasets/rafaelsouza-tech/rag-eval-ptbr} } ``` --- # Versão em português Golden set de **avaliação de RAG ponta a ponta** em **português brasileiro**, domínio tributário (CTN e LC 123/2006). Feito para medir faithfulness/groundedness, context precision/recall, qualidade de retrieval e acurácia de citação de pipelines RAG — não é um QA set de compreensão de leitura. Construção: corpus verbatim das fontes oficiais do Planalto (script reprodutível); itens gerados por um LLM ancorados em passagens reais; **verificação adversarial item a item**; deduplicação (36 → 35). Proveniência honesta: revisão humana item a item ainda pendente (barra de aceitação da v1.0). 4 itens são deliberadamente **não-respondíveis** pelo corpus (sondas de abstenção). As citações seguem o formato canônico `(CTN, art. 173, I)`. Os `doc_id` do corpus são semânticos e estáveis (`ctn:art-173`) — métricas de retrieval são casamento determinístico de IDs, sem LLM. Textos-fonte em domínio público (Lei 9.610/98, art. 8º, IV); camada de curadoria em **CC-BY-4.0**. Limitações: domínio único; 35 itens (desenhado para teste de regressão pareado); reflete a legislação compilada em julho/2026; ignora jurisprudência por construção; não é aconselhamento jurídico.