Datasets:
Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed because of a cast error
Error code: DatasetGenerationCastError
Exception: DatasetGenerationCastError
Message: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 10 new columns ({'score_3', 'retrieved_2', 'score_1', 'query_id', 'retrieved_3', 'retrieved_1', 'query', 'score_2', 'expected_policy_id', 'rank'}) and 2 missing columns ({'queries', 'hit_rate'}).
This happened while the csv dataset builder was generating data using
hf://datasets/ranzouu/retrieval-benchmark-ptbr/runs/benchmark_errors.csv (at revision 1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5), ['hf://datasets/ranzouu/retrieval-benchmark-ptbr@1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5/runs/benchmark_by_niche.csv', 'hf://datasets/ranzouu/retrieval-benchmark-ptbr@1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5/runs/benchmark_errors.csv', 'hf://datasets/ranzouu/retrieval-benchmark-ptbr@1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5/runs/benchmark_runs.csv', 'hf://datasets/ranzouu/retrieval-benchmark-ptbr@1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5/runs/benchmark_summary.csv']
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1856, in _prepare_split_single
writer.write_table(table)
~~~~~~~~~~~~~~~~~~^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 811, in write_table
self._write_table(pa_table, writer_batch_size=writer_batch_size)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 822, in _write_table
pa_table = table_cast(pa_table, self._schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2381, in table_cast
return cast_table_to_schema(table, schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2309, in cast_table_to_schema
raise CastError(
...<3 lines>...
)
datasets.table.CastError: Couldn't cast
query_id: string
niche: string
query: string
expected_policy_id: string
retrieved_1: string
retrieved_2: string
retrieved_3: string
score_1: double
score_2: double
score_3: double
hit_at_3: int64
rank: int64
mrr_at_3: double
-- schema metadata --
pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 1795
to
{'niche': Value('string'), 'queries': Value('int64'), 'hit_at_3': Value('int64'), 'hit_rate': Value('float64'), 'mrr_at_3': Value('float64')}
because column names don't match
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1379, in compute_config_parquet_and_info_response
parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
~~~~~~~~~~~~~~~~~~~~~~~~~^
builder, max_dataset_size_bytes=max_dataset_size_bytes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 956, in stream_convert_to_parquet
builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1702, in _prepare_split
for job_id, done, content in self._prepare_split_single(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1858, in _prepare_split_single
raise DatasetGenerationCastError.from_cast_error(
...<4 lines>...
)
datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 10 new columns ({'score_3', 'retrieved_2', 'score_1', 'query_id', 'retrieved_3', 'retrieved_1', 'query', 'score_2', 'expected_policy_id', 'rank'}) and 2 missing columns ({'queries', 'hit_rate'}).
This happened while the csv dataset builder was generating data using
hf://datasets/ranzouu/retrieval-benchmark-ptbr/runs/benchmark_errors.csv (at revision 1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5), ['hf://datasets/ranzouu/retrieval-benchmark-ptbr@1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5/runs/benchmark_by_niche.csv', 'hf://datasets/ranzouu/retrieval-benchmark-ptbr@1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5/runs/benchmark_errors.csv', 'hf://datasets/ranzouu/retrieval-benchmark-ptbr@1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5/runs/benchmark_runs.csv', 'hf://datasets/ranzouu/retrieval-benchmark-ptbr@1c3a4079f2c10b7605f2e08eb03c7d1d3d2fa2f5/runs/benchmark_summary.csv']
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
niche string | queries int64 | hit_at_3 int64 | hit_rate float64 | mrr_at_3 float64 |
|---|---|---|---|---|
academia | 2 | 2 | 1 | 1 |
autoescola | 1 | 0 | 0 | 0 |
barbearia | 2 | 2 | 1 | 1 |
clinica | 2 | 2 | 1 | 1 |
costureira | 1 | 0 | 0 | 0 |
crossfit | 1 | 1 | 1 | 1 |
dentista | 1 | 0 | 0 | 0 |
foodtruck | 1 | 0 | 0 | 0 |
moda | 2 | 2 | 1 | 1 |
oficina | 2 | 2 | 1 | 1 |
padaria | 2 | 2 | 1 | 1 |
papelaria | 2 | 2 | 1 | 1 |
pet | 2 | 2 | 1 | 1 |
restaurante | 2 | 2 | 1 | 0.4166 |
salao | 2 | 2 | 1 | 1 |
foodtruck | null | 0 | null | 0 |
dentista | null | 0 | null | 0 |
costureira | null | 0 | null | 0 |
autoescola | null | 0 | null | 0 |
academia | null | 1 | null | 1 |
academia | null | 1 | null | 1 |
pet | null | 1 | null | 1 |
pet | null | 1 | null | 1 |
restaurante | null | 1 | null | 0.5 |
restaurante | null | 1 | null | 0.3333 |
barbearia | null | 1 | null | 1 |
barbearia | null | 1 | null | 1 |
clinica | null | 1 | null | 1 |
clinica | null | 1 | null | 1 |
padaria | null | 1 | null | 1 |
padaria | null | 1 | null | 1 |
salao | null | 1 | null | 1 |
salao | null | 1 | null | 1 |
moda | null | 1 | null | 1 |
moda | null | 1 | null | 1 |
oficina | null | 1 | null | 1 |
oficina | null | 1 | null | 1 |
papelaria | null | 1 | null | 1 |
papelaria | null | 1 | null | 1 |
crossfit | null | 1 | null | 1 |
foodtruck | null | 0 | null | 0 |
dentista | null | 0 | null | 0 |
costureira | null | 0 | null | 0 |
autoescola | null | 0 | null | 0 |
null | 25 | 21 | null | 0.9444 |
Retrieval Benchmark PT-BR — políticas de prospecção (RAG)
Benchmark de retrieval em português com julgamentos explícitos: 25 queries, cada uma com uma política relevante identificada (expected_policy_id), contra um corpus de 10 documentos. Inclui as predições e métricas de um retriever lexical (TF-IDF de overlap de termos, top-3) já avaliado contra os julgamentos.
Faz parte do LeadForge RAG Lite — pipeline completo (ingestão → retrieval → geração → avaliação) no repositório.
Protocolo
- Corpus: 10 políticas de prospecção por nicho (academia, petshop, restaurante, barbearia, clínica veterinária, padaria, salão, moda, oficina, papelaria), 3–5 frases cada, PT-BR.
- Queries: 25 prints parafraseadas — 20 dentro do cardápio do corpus e 5 fora (crossfit, food truck, dentista, ateliê, autoescola), que não deveriam ter acerto. As queries compartilham vocabulário parcial com os documentos; não são cópia — o retriever precisa generalizar, não fazer match de string.
- Julgamento: uma política relevante por query (single-relevance), explícita no campo
expected_policy_id. - Retriever avaliado:
retrieve()do pacote original — score de overlap lexical (termos com >3 caracteres presentes no documento), top-3.
Resultados
| Métrica | Valor |
|---|---|
| hit@3 | 21/25 = 0.84 |
| MRR@3 (todas as queries) | 0.793 |
| MRR@3 (condicional aos hits) | 0.944 |
- Dentro do corpus: 20/20 em hit@3.
- Fora do corpus: 1/5 (a query de crossfit acerta a política de academia por sobreposição lexical de "treino/aula" — acidente de vocabulário, não acerto semântico).
- Por nicho, ver
runs/benchmark_by_niche.csv. Destaque honesto: uma query de restaurante coloca o documento correto só no rank 3 (MRR do nicho 0.42) — o ranking lexical acerta o nicho e é instável em ordenar dentro dele.
Uso
import json, pandas as pd
corpus = pd.DataFrame(json.load(open("benchmark_policies.json")))
queries = pd.DataFrame(json.load(open("benchmark_queries.json")))
runs = pd.read_csv("runs/benchmark_runs.csv")
errors = pd.read_csv("runs/benchmark_errors.csv")
print(runs[["query_id", "expected_policy_id", "retrieved_1", "hit_at_3"]].head())
print(f"hit@3 = {runs['hit_at_3'].mean():.2%}")
Reproduzir com o pacote original:
git clone https://github.com/ranzouu/leadforge-rag-lite
cd leadforge-rag-lite && pip install -e .
python3 scripts/build_retrieval_benchmark.py
Arquivos
| Arquivo | Conteúdo |
|---|---|
benchmark_policies.json |
corpus: 10 políticas {id, niche, title, content} |
benchmark_queries.json |
25 queries com julgamento expected_policy_id |
runs/benchmark_runs.csv |
por query: top-3 recuperado, scores, hit@3, rank, MRR@3 |
runs/benchmark_errors.csv |
as queries que falharam e o que veio no lugar |
runs/benchmark_summary.csv |
hit@3 e MRR@3 agregados |
runs/benchmark_by_niche.csv |
métricas por nicho |
scripts/build_retrieval_benchmark.py |
construtor (corpus + queries + avaliação) |
LICENSE |
MIT |
Limitações (leia antes de usar)
- Retrieval lexical por design (overlap de termos). As falhas nas queries fora do corpus são a limitação conhecida desse método — semântica exige embeddings/LLM, que é o próximo passo natural, não um defeito do benchmark.
- Julgamento único por query (uma política relevante). Benchmarks de IR completos usam relevância graduada (0–3) e múltiplos relevantes por query — aqui o escopo é demonstrar o protocolo de medição.
- Corpus pequeno (10 documentos) e de domínio específico (prospecção SMB PT-BR). Os números valem para este protocolo, não como ranking geral de retrievers.
- As queries fora do corpus estão rotuladas com a política "mais próxima" apenas para inspeção dos erros; o acerto nelas não conta como sucesso semântico.
- Downloads last month
- -