Spaces:
Runtime error
Runtime error
File size: 6,208 Bytes
4a8fc49 8f1601b 4a8fc49 8f1601b 4a8fc49 8f1601b 4a8fc49 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | # RAG Evaluation Module
This folder contains a lightweight retrieval-evaluation harness for the project.
## Supported Steps
1. `beir/scifact`
2. `beir/fiqa`
3. `open-ragbench`
4. `t2-ragbench`
5. `local-options`
Each run builds a temporary Chroma index under `eval/indexes/` and writes reports under `eval/reports/`.
## Smoke Tests
```bash
uv --cache-dir .uv-cache run python -m eval.rag_eval --dataset beir/scifact --max-corpus-docs 200 --max-queries 10 --rebuild
uv --cache-dir .uv-cache run python -m eval.rag_eval --dataset beir/fiqa --max-corpus-docs 500 --max-queries 10 --rebuild
uv --cache-dir .uv-cache run python -m eval.rag_eval --dataset open-ragbench --max-corpus-docs 50 --max-queries 10 --rebuild
uv --cache-dir .uv-cache run python -m eval.rag_eval --dataset t2-ragbench --max-corpus-docs 50 --max-queries 10 --rebuild
uv --cache-dir .uv-cache run python -m eval.rag_eval --dataset local-options --max-queries 3 --rebuild
```
## Run The Whole Suite
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite --rebuild
```
By default, the suite runs:
- `beir/scifact`
- `beir/fiqa`
- `open-ragbench`
- `local-options`
Useful options:
```bash
# Accurate run after changing PDF parsing, chunking, embedding, retrieval code, or sampling parameters.
uv --cache-dir .uv-cache run python -m eval.run_eval_suite --rebuild
# Faster run that reuses existing indexes.
uv --cache-dir .uv-cache run python -m eval.run_eval_suite
# Run only selected datasets.
uv --cache-dir .uv-cache run python -m eval.run_eval_suite --datasets local-options,beir/fiqa
# Override shared parameters for all selected datasets.
uv --cache-dir .uv-cache run python -m eval.run_eval_suite --top-k 10 --max-queries 20 --max-corpus-docs 1000
# Save a stable suite-level report name.
uv --cache-dir .uv-cache run python -m eval.run_eval_suite --output-name latest_rag_eval
```
The suite writes per-dataset reports and one aggregate report under `eval/reports/`.
## Common Commands
Run with the default multilingual embedding model:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite --rebuild
```
Use a custom embedding model for experiments:
```bash
RAG_EMBED_MODEL=intfloat/multilingual-e5-base \
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets local-options \
--top-k 5 \
--output-name local_options_e5_base \
--rebuild
```
Run the fastest local check while developing PDF parsing or chunking:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets local-options \
--max-queries 3 \
--top-k 5 \
--rebuild
```
Run only the standard public retrieval smoke tests:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets beir/scifact,beir/fiqa \
--rebuild
```
Run the financial benchmark only:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets beir/fiqa \
--max-corpus-docs 1000 \
--max-queries 50 \
--top-k 5 \
--rebuild
```
Run the PDF-like benchmark only:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets open-ragbench \
--max-corpus-docs 100 \
--max-queries 20 \
--top-k 5 \
--rebuild
```
Compare different `top-k` values:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets local-options \
--top-k 3 \
--output-name local_options_top3 \
--rebuild
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets local-options \
--top-k 10 \
--output-name local_options_top10 \
--rebuild
```
Compare retrieval with and without reranker:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets local-options \
--top-k 5 \
--output-name local_options_no_reranker \
--rebuild
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets local-options \
--top-k 5 \
--use-reranker \
--reranker-candidates 25 \
--output-name local_options_with_reranker \
--rebuild
```
Use a custom reranker model:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets beir/fiqa \
--use-reranker \
--reranker-model cross-encoder/ms-marco-MiniLM-L-6-v2 \
--reranker-candidates 50 \
--top-k 5 \
--rebuild
```
Compare different chunk settings:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets local-options \
--chunk-size 384 \
--chunk-overlap 64 \
--output-name local_options_chunk384 \
--rebuild
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets local-options \
--chunk-size 768 \
--chunk-overlap 128 \
--output-name local_options_chunk768 \
--rebuild
```
Run a larger, slower evaluation before reporting results:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets beir/scifact,beir/fiqa,open-ragbench,local-options \
--max-corpus-docs 2000 \
--max-queries 100 \
--top-k 5 \
--output-name full_rag_eval \
--rebuild
```
Stop immediately when one dataset fails:
```bash
uv --cache-dir .uv-cache run python -m eval.run_eval_suite \
--datasets beir/scifact,beir/fiqa,open-ragbench,local-options \
--fail-fast \
--rebuild
```
Run a single dataset directly without the suite wrapper:
```bash
uv --cache-dir .uv-cache run python -m eval.rag_eval \
--dataset local-options \
--max-queries 3 \
--top-k 5 \
--rebuild
```
## Suggested Workflow
1. During development, run `local-options` with a small query count.
2. After changing PDF extraction, chunking, embeddings, or retrieval code, add `--rebuild`.
3. Before comparing two versions, use the same `--datasets`, `--max-queries`, `--max-corpus-docs`, `--top-k`, `--chunk-size`, and `--chunk-overlap`.
4. Use `--output-name` to save stable report names for before/after comparison.
5. When testing reranker, compare the same dataset once without `--use-reranker` and once with `--use-reranker`.
## Metrics
- `hit_at_1`
- `hit_at_3`
- `hit_at_5`
- `hit_at_k`
- `mrr`
- `ndcg_at_k`
The public benchmarks test whether the eval pipeline works on standard datasets. The `local-options` benchmark is the project-specific check for PDF parsing, formula extraction, and section-aware chunking.
|