File size: 14,783 Bytes
111ee96 | 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 | # LicitaBench
**An open benchmark for reading Spanish public procurement documents.** It measures whether a
language model extracts from a tender's administrative clauses document (PCAP, *pliego de
cláusulas administrativas particulares*) what a bid manager needs before deciding to bid: how
much, until when, for how long, which procedure, which award criteria score points, and what is
required to be admitted.
Provisional name. Version 0: public PLACSP data, reproducible code, verifiable results.
[Versión en castellano](README.md).
Built by [ChangeTheBlock](https://changetheblock.com) (Insurechain S.L., Madrid). Code under the MIT license; data (labels, evidence and metadata) under CC BY 4.0.
## What it measures
| Task | Question to the model | Reference label | Metric |
|---|---|---|---|
| **T1** Notice fields | Base budget excluding VAT or estimated value, submission deadline, duration, main CPV code, procedure type, contracting authority | Automatic: CODICE fields from the PLACSP notice, accepted only when they appear in the document text | Per-field accuracy (amount within 0.5 %, accepted when it matches either the base budget or the estimated value returned by the model; dates to the day; 8-digit CPV; authority name with token tolerance) |
| **T2** Award criteria | List of criteria with points and type (automatic or value judgement), points per type, price formula, technical threshold | Proposed by Claude, verified by a person | Set F1 over criteria (strict and by points plus type), accuracy of sums, token F1 of the formula |
| **T3** Admission | Economic standing and its threshold, technical capacity, required certifications (ENS and level, ISO 27001, ISO 9001...), professional authorisation | Proposed by Claude, verified by a person | Accuracy per requirement, F1 over certifications (with and without the mandatory flag), threshold within 1 % |
| **T4** Bid committee questions (optional) | "Can a company founded in 2019 with a turnover of 1.1 million bid?": yes or no with a justification | Question and answer proposed by Claude from T3, verified by a person | Accuracy |
The input to every task is the full PCAP text (20,000 to 250,000 characters). Models with a
short context are evaluated on truncated text and the truncation is recorded in the result.
## Data
- **Documents:** PCAP PDFs published on Spain's Public Sector Procurement Platform (PLACSP,
contrataciondelestado.es) and on the regional platforms that PLACSP aggregates (Catalonia,
Basque Country, Madrid region). Tenders published between February and October 2026.
- **T1 labels:** the structured CODICE data that PLACSP publishes as open data in its ATOM feeds
next to each notice. They are the benchmark's "free" reference: nobody typed them by hand, but
every value was checked against the document text before being accepted.
- **T2, T3 and T4 labels:** initial labelling with Claude (Claude Code headless mode,
`claude -p`, on a subscription) and a human verification queue in
`verificacion/pendientes.jsonl`. No item counts as verified without the reviewer's name.
- **Where the list of tenders comes from:** the database of ChangeTheBlock's tender agent, which
reads the PLACSP feeds daily and filters by keywords and IT-services CPV codes. The sample
therefore has more services, consulting and IT supplies than works: **it is not representative
of all public procurement**.
The dataset card, with fields, construction method, reuse conditions and limitations, is in
[DATASET_CARD.md](DATASET_CARD.md) (in Spanish).
<!-- CIFRAS-INICIO -->
## Version 0 figures (built on 2026-11-22)
- Tenders in the source database: 5.072; with a linked PCAP: 1.221.
- PDFs downloaded: 1.183. Tenders with no downloadable PDF: 38 (documents in other formats discarded: 18; broken or non-PDF links: 27).
- **T1 items accepted: 1.013** (at least 3 of the 6 CODICE fields match the text). Documents discarded for fewer than 3 aligned fields: 164.
- Detected language of the accepted items: es 861, ca 138, eu 11, gl 3.
- Extraction (documents with text): pdfplumber 1160, tesseract 17.
Aligned fields (a label exists for a field only when its value appears in the document):
| Field | Items with label | % of items | Main discard reason |
|---|---|---|---|
| Amount | 977 | 96 % | importe_no_aparece (184) |
| Procedure | 947 | 93 % | procedimiento_no_aparece (53) |
| Contracting authority | 920 | 91 % | organo_no_aparece (159) |
| Main CPV | 894 | 88 % | cpv_no_aparece (280) |
| Duration | 572 | 56 % | duracion_sin_contexto (315) |
| Submission deadline | 93 | 9 % | fecha_no_aparece (1084) |
What failed or is worth knowing:
- The submission deadline is almost never in the PCAP (it is in the notice), hence its low support.
- The notice amount may be the estimated value or the base budget excluding VAT. By context in the document: ambiguo 375, valor_estimado 317, presupuesto_base 195, unidentified 90.
- The notice duration came without a unit; it was searched in the text as months, years or days (detected: meses 332, años 240). Cases in days were discarded.
- The notice procedure 'Abierto' (open) is discarded when the document mentions the simplified open procedure at least as often (`texto_dice_simplificado`).
Human verification queue (labels proposed by Claude, not yet verified): T2 0, T3 0, T4 0. Verified: T2 58, T3 60, T4 29.
### T1 baseline
Accuracy in % per field over the sampled items that have that label (support in brackets). 'Media campos' is the mean of the six columns; 'Micro' is accuracy over all labels pooled. Full and per-item tables in `results/`.
| Modelo | n | Importe | Plazo | Duración | CPV | Procedimiento | Órgano | Media campos | Micro | Errores | Fecha |
|---|---|---|---|---|---|---|---|---|---|---|---|
| claude:claude-opus-5-5 (es) | 100 | 100.0 (95) | 88.9 (9) | 96.7 (61) | 92.0 (87) | 100.0 (90) | 63.5 (96) | 90.2 | 89.7 (438) | 0 | 2026-11-22 |
### T2 baseline
Percentages over the T2 documents verified by a person. Full and per-item tables in `results/`.
| Modelo | n | F1 criterios | F1 puntos+tipo | Pts. autom. | Pts. juicio | F1 fórmula | Umbral | Errores | Fecha |
|---|---|---|---|---|---|---|---|---|---|
| claude:claude-opus-5-5 | 58 | 97.1 | 97.5 | 100.0 | 96.6 | 87.2 | 100.0 | 0 | 2026-11-25 |
**How to read Claude's row:** the T2 reference was built by reviewing proposals from the same model with the same prompt, so the figure is inflated by anchoring. On the 48 items the person kept as Claude proposed them, criteria F1 100.0 and formula F1 94.7; on the 10 that were corrected, 83.4 and 51.5. The anchoring-free measure is the blind sample of 20 items (annotated by the person without seeing any proposal): Claude 87.4 criteria F1 against the person. For other models the reference is not biased in their favour.
### T3 baseline
Percentages over the 60 T3 documents verified by a person. The T3 prompt includes the approved annotation conventions (lot 1, threshold calculation, company certifications, alternative routes, ENS, licensing).
| Modelo | n | Solv. econ. | Umbral | Solv. técn. | F1 certif. | F1 certif.+oblig. | Habilitación | Errores | Fecha |
|---|---|---|---|---|---|---|---|---|---|
| claude:claude-opus-5-5 | 60 | 100.0 | 91.7 | 100.0 | 98.0 | 98.0 | 98.3 | 0 | 2026-11-26 |
**How to read Claude's T3 row:** the reference comes from reviewing Claude's proposals, so the figure is inflated by anchoring. Threshold, certification F1 and licensing: 90.9 / 99.7 / 100.0 on the 44 items kept as Claude proposed them; 93.8 / 93.2 / 93.8 on the 16 corrected ones. Three reference labels (19835153, 20743254 and 19931080) were corrected after seeing this baseline, once it was checked that they did not apply the lot-1 rule; all three now match the prediction, so this row counts them in Claude's favour. The anchoring-free measure is the 10-item blind sample: threshold 80 %, certification F1 56.7 % and licensing 70 % (earlier Claude, without the rules in the prompt).
### T4 baseline
Yes/no accuracy over the 29 verified questions (one was rejected as ambiguous). The prompt includes the T4 rules and the T3 conventions.
| Modelo | n | Exactitud | Errores | Fecha |
|---|---|---|---|---|
| claude:claude-opus-5-5 | 29 | 100.0 | 0 | 2026-11-26 |
**How to read Claude's T4 row:** Claude wrote each question knowing its answer, from its own T3 labels, so 100 % mainly measures self-consistency. In the blind sample a person answered 10 questions without seeing the answers and agreed with Claude on the 9 not marked as ambiguous.
<!-- CIFRAS-FIN -->
## How to reproduce
Requirements: Python 3.11 or later, `pdfplumber`, `pyarrow`, `requests`. For OCR of image-only
PDFs, `tesseract` and `pdftoppm` (poppler) on the PATH. To evaluate Claude, `claude` (Claude
Code) with an active login. No GPU.
```bash
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
```
1. **Build the dataset** (downloads the public PDFs, extracts text, aligns with CODICE, removes
signatory names and writes `data/dataset/t1.jsonl`, `t1.parquet`, `documentos.jsonl` and
`estadisticas.json`). It needs the copy of the source database at `data/origen/ctb.db`;
without it, the repository already ships the labels and links, and the text is regenerated
from the URLs in `t1.jsonl`.
```bash
.venv/bin/python -m licitabench.build_dataset
```
2. **Evaluate a model on T1** (fixed sample of 100 Spanish-language items, seed 42):
```bash
.venv/bin/python -m licitabench.evaluate --tarea T1 --modelo claude:claude-opus-5-5 --n 100 --idioma es
```
If the run is interrupted (for example by the subscription's usage limit), the batch stops, the log
says how many items remain, and rerunning the same command resumes where it stopped;
`--solo-cache` scores what is already there without calling the model.
Other runners: `openai:<model>@<base_url>` for any OpenAI-compatible server (vLLM, llama.cpp,
TGI) and `transformers:<model>` for small local tests. Ready-made commands for ALIA-40b,
Salamandra-7b, Qwen and Llama are in
[scripts/servir_modelos_abiertos.md](scripts/servir_modelos_abiertos.md); they have not been
run: compute is the evaluator's decision.
3. **Label T2, T3 and T4 with Claude and verify them** (verification walks the queue item by item in the
terminal: it shows the proposal and the document fragments that support it, and records yes, no or a correction):
```bash
.venv/bin/python -m licitabench.etiquetar --tarea T2 --n 60
.venv/bin/python -m licitabench.etiquetar --tarea T3 --n 60
.venv/bin/python -m licitabench.etiquetar --tarea T4 --n 30
.venv/bin/python -m licitabench.verificar revisar --tarea T2 --por "Name Surname"
```
The verification workflow is in [verificacion/README.md](verificacion/README.md). `evaluate.py`
uses only verified items for T2, T3 and T4; with `--incluir-pendientes` it also scores against
the proposals and marks the result as provisional.
4. **Regenerate the results table:** `.venv/bin/python -m licitabench.evaluate --tabla` writes
`results/RESULTADOS.md` from every `results/T*_*.json`.
Raw model outputs are cached in `results/raw/` and are not repeated on later runs, so an
interrupted evaluation resumes where it stopped.
Tests: `.venv/bin/python -m pytest -q tests`.
## Why it matters
- **Public procurement is a real use of AI in the public sector.** In Spain the Public Sector
Procurement Platform centralises tender publicity under article 347 of Law 9/2017 on Public
Sector Contracts, and publishes the data openly. Reading tender documents is the first step for
any company that wants to bid, and for any authority that wants to compare or review its own.
A model that confuses the estimated value with the base budget, or one solvency threshold with
another, excludes the wrong bidder or loses the tender.
- **The EU AI Act** (Regulation (EU) 2024/1689, in force since 1 August 2024) requires public
bodies deploying high-risk systems to carry out a fundamental rights impact assessment
(article 27) and to be transparent about how the systems work. Measuring, with public data and
a reproducible method, what a model gets right and wrong on real administrative documents is
part of that diligence.
- **Open models in Spanish need tests in Spanish.** ALIA-40b, from the Barcelona Supercomputing
Center, was trained on 35 European languages with Spanish, Catalan, Galician and Basque
oversampled, under an Apache 2.0 license; Salamandra-7b-instruct is its smaller sibling. A tender
benchmark allows these models to be compared with frontier models on a task where data cannot
leave the organisation, which is the case for many deployments in public administrations and
in the companies that work with them.
- **We found no other.** In the search we ran on 22 November 2026 we did not find a public
benchmark for reading Spanish tender documents; if one exists, please tell us so we can cite
it. There is a German one for the public sector (MÖVE,
arXiv:2606.13111, June 2026, evaluating 39 models on summarisation, question answering and
topic extraction) and entity-extraction work on tenders noting that procurement data is rarely
open. In Spain it is: PLACSP publishes notices and documents openly, and that makes this
benchmark possible.
## Internal review
`.venv/bin/python scripts/revisar.py` generates a local `REVISAR.md` (in Spanish, not published): every
claim in the README with where to check it, 20 T1 items with the label, Claude's answer and the document
fragment, and the T2 items as one screen per item.
## Rules followed
- Only public documents from PLACSP and the aggregated platforms. No ChangeTheBlock bids, no
client projects, no internal data.
- No personal data in what is published: links and labels are published; the extracted text is
regenerated locally and signatory names are removed before it is stored.
- Every statement in this README has been checked: the reuse conditions were consulted at the
source on 22 November 2026 and are quoted in the dataset card; the figures come from
`data/dataset/estadisticas.json` and `results/`.
- Claude is used through `claude -p` with a Claude Code subscription; no key or token is stored
in the repository. The runner always removes `ANTHROPIC_API_KEY` from the subprocess
environment and checks access with a minimal call before every batch: on 22 November 2026 an
earlier version let the environment key through and 76 calls were billed to the API until its
monthly spend limit was reached.
## Citation
If you use LicitaBench, cite the repository and the data source: "Origen de los datos:
Plataforma de Contratación del Sector Público, Ministerio de Hacienda".
|