> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runpulse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Evals

> Score a parse or extract config against ground truths you trust, and compare configs on your own documents.

An eval measures how well a config reads your documents. Each run parses or extracts every document of a dataset with the config you give it, scores the output against the document's ground truth on a rubric of items such as `words`, `tables` and `layout`, and averages the scores with the weights you chose. Run one eval with two configs to see which reads your documents better.

```mermaid theme={null}
%%{init: {"themeVariables": {"fontSize": "14px"}, "flowchart": {"nodeSpacing": 24, "rankSpacing": 32, "padding": 8}}}%%
flowchart TD
    dataset["POST /eval/dataset/parse"] -->|dataset_id| ev["POST /eval/parse + weights"]
    ev -->|eval_id| run["POST /eval/run/parse + config"]
    run -->|run_id| result["GET /eval/run/parse/{run_id}/result"]
```

The dataset, eval and run routes each have a parse form and an extract form. The extract routes, `/eval/dataset/extract`, `/eval/extract` and `/eval/run/extract`, score an extraction the same way, on one rubric item. `GET /eval/dataset` and `GET /eval` list your organization's datasets and evals of both kinds. The examples on this page are for parse.

> [!NOTE]
>
> Evals are turned on for an organization by Pulse. Until they are, every `/eval` route answers `404` `ROUTE_NOT_FOUND`. Ask your Pulse contact to turn them on.

***

## Create a dataset

A dataset is a named list of documents, each a `file_url` and, if you have one, a `ground_truth_url`. This request creates a parse dataset of three invoices, the second without a ground truth:

```bash cURL theme={null}
curl -X POST https://api.runpulse.com/eval/dataset/parse \
  -H "x-api-key: $PULSE_API_KEY" \
  -H "Pulse-Version: 2" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Invoices",
    "documents": [
      {"file_url": "https://example.com/invoice-1.pdf", "ground_truth_url": "https://example.com/invoice-1.json"},
      {"file_url": "https://example.com/invoice-2.pdf"},
      {"file_url": "https://example.com/invoice-3.pdf", "ground_truth_url": "https://example.com/invoice-3.json"}
    ]
  }'
```

The response is `201` with the dataset, an id for it and one for each document:

```json theme={null}
{
  "dataset_id": "eval-dataset-2f6b9c1e-4d7a-4e3b-9a85-1c0d7e3f5b62",
  "name": "Invoices",
  "documents": [
    {
      "document_id": "doc-4a1e7c2b-9d3f-4b68-8e15-2c7a0f9d3b41",
      "file_url": "https://example.com/invoice-1.pdf",
      "ground_truth_url": "https://example.com/invoice-1.json"
    },
    {
      "document_id": "doc-7c2d9e4f-1a6b-4d3c-b8e2-5f0a1c9e7d26",
      "file_url": "https://example.com/invoice-2.pdf"
    },
    {
      "document_id": "doc-9e5b3a1d-7c2f-4e8a-a6d4-3b1f0c8e2a57",
      "file_url": "https://example.com/invoice-3.pdf",
      "ground_truth_url": "https://example.com/invoice-3.json"
    }
  ],
  "created_at": "2026-11-17T09:30:00.482913Z"
}
```

* Nothing is fetched when you create a dataset. A run reads each URL when it needs it, so the URLs must still work then.
* A file in Pulse's storage can be named by its `s3://` reference, as a `file_url` or a `ground_truth_url`. A run reads it with Pulse's own access, so it keeps working, while a presigned link expires. It must be one of your organization's files, or its document fails with `PERMISSION_DENIED`.
* A dataset can't be changed. To change its documents, create a new one.
* An extract dataset, created with `POST /eval/dataset/extract`, also takes the `parse_config` that parses its documents and the `input_schema` their extractions fill, and each of its documents needs a `ground_truth_url`. The dataset is returned with the `parse_config`'s defaults filled in.

[Ground truths](#ground-truths) says what each file holds.

## Create an eval

An eval is a dataset and a weight for each rubric item: how much that item counts in a document's score. An eval and each run of it take a `name`, a label that need not be unique. This request weights `words`, `layout` and `tables`, and leaves every other item at 0:

```bash cURL theme={null}
curl -X POST https://api.runpulse.com/eval/parse \
  -H "x-api-key: $PULSE_API_KEY" \
  -H "Pulse-Version: 2" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Invoices, words first",
    "dataset_id": "eval-dataset-2f6b9c1e-4d7a-4e3b-9a85-1c0d7e3f5b62",
    "weights": {"words": 40, "layout": 30, "tables": 30}
  }'
```

The response is `201` with every item's weight:

```json theme={null}
{
  "eval_id": "eval-8d3e1a7c-5b2f-4c96-a0e4-7f1b9d2c6e38",
  "name": "Invoices, words first",
  "dataset_id": "eval-dataset-2f6b9c1e-4d7a-4e3b-9a85-1c0d7e3f5b62",
  "weights": {
    "words": 40,
    "layout": 30,
    "tables": 30,
    "structure": 0,
    "text_styles": 0,
    "formulas": 0,
    "numbers": 0,
    "checkboxes": 0,
    "paragraphs": 0
  },
  "created_at": "2026-11-17T09:31:00.105377Z"
}
```

Creating an eval runs nothing, and an eval can't be changed. To try other weights, create another eval on the same dataset.

### Weights

* Weights are whole numbers from 0 to 100 that add up to exactly 100. Any other set is refused with a `400`.
* An item left out weighs 0. An item that weighs 0 is still scored and shown in each document's `scores`, but it counts in no `overall`.
* Without `weights`, 100 is split evenly: 12 for `words` and 11 for each other item. An extract eval's one item, `field_similarity`, always weighs 100.

## Run an eval

A run tests one parse config. Send it as `config`, exactly as on `POST /parse`, or send a [saved config's](https://docs.runpulse.com/v2/saved-configs.md) `config_id`:

```bash cURL theme={null}
curl -X POST https://api.runpulse.com/eval/run/parse \
  -H "x-api-key: $PULSE_API_KEY" \
  -H "Pulse-Version: 2" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ultra-2",
    "eval_id": "eval-8d3e1a7c-5b2f-4c96-a0e4-7f1b9d2c6e38",
    "config": {"model": "ultra-2"}
  }'
```

The response is `202` with the run's id. `GET /eval/parse/{eval_id}/runs` lists an eval's runs, so you can find it again.

```json theme={null}
{
  "run_id": "eval-run-5c8f2a1d-3e7b-4a69-9d40-8b2e6f1c7a93",
  "created_at": "2026-11-17T09:32:00.731204Z"
}
```

The run parses the dataset's documents in [batches](https://docs.runpulse.com/v2/batch.md) of up to 1,000, with that config. It reads each document's ground truth meanwhile, and scores each document once both are ready. You can start several runs at once, on one eval or on several.

An extract run, `POST /eval/run/extract`, tests an extract config, and the config's `input_schema` must be the dataset's. The first run on a dataset parses its documents with the dataset's `parse_config` and keeps the parses. Every later run extracts from those same parses, so two extract configs are compared on the same parses.

Each parse and extraction a run starts is billed as `POST /parse` and `POST /extract` bill it ([Pricing](https://docs.runpulse.com/v2/pricing.md)), and the run's result names each one by its `parse_id` and `extract_id`. Creating a dataset or an eval costs nothing.

***

## Follow a run

`GET /eval/run/parse/{run_id}` returns the run's status and a `summary` that counts its documents by the step each has reached, so the counts overlap. An extract run's `summary` counts `extracted` in place of `ground_truth_ready`.

```json theme={null}
{
  "run_id": "eval-run-5c8f2a1d-3e7b-4a69-9d40-8b2e6f1c7a93",
  "name": "ultra-2",
  "summary": {
    "total": 3,
    "parsed": 3,
    "ground_truth_ready": 2,
    "graded": 1,
    "failed": 1
  },
  "created_at": "2026-11-17T09:32:00.731204Z",
  "status": "processing"
}
```

| Status | Meaning |
| - | - |
| `processing` | Some of its documents are still being parsed, extracted or scored. |
| `completed` | Every document has been scored or has failed, and at least one was scored. |
| `failed` | No document could be scored, or the run couldn't be finished. `error` says why, and counts the documents' errors by code when none was scored. |
| `canceled` | It was canceled. |

**A document that fails doesn't fail the run.** The run goes on with its other documents. The failed document has an `error` in the run's result and no scores, and it counts in `summary.failed`. Its `error` says why: for example, its file or its ground truth couldn't be fetched, or its parse failed.

**How long a run takes** depends on its documents. A run still `processing` 48 hours after it started ends then: each document not yet scored fails, and the run completes with the documents already scored, or fails if none was.

**To cancel a run** that hasn't ended, send `DELETE /eval/run/parse/{run_id}`. Its parses still running are canceled, and it returns the run's status, now `canceled`. A canceled run has no result. Canceling an extract run cancels its extractions still running, and keeps the dataset's parses for later runs. Anyone in your organization can cancel a run. A run that has already ended returns `409`.

## Read the result

`GET /eval/run/parse/{run_id}/result` returns a completed run's scores: its `overall`, each item's score in `scores`, and each document's scores or `error`, with the config it tested. Scores aren't rounded. A run still `processing` returns `409`, a `canceled` run `410`, and a `failed` run its error: `422` (`NO_DOCUMENT_GRADED`) when every document failed on what you sent, each document's `error` saying why.

This result is from the eval above, with `config` cut to the one option the run was sent:

```json theme={null}
{
  "run_id": "eval-run-5c8f2a1d-3e7b-4a69-9d40-8b2e6f1c7a93",
  "name": "ultra-2",
  "eval_id": "eval-8d3e1a7c-5b2f-4c96-a0e4-7f1b9d2c6e38",
  "created_at": "2026-11-17T09:32:00.731204Z",
  "completed_at": "2026-11-17T09:41:27.268590Z",
  "config": {
    "model": "ultra-2"
  },
  "overall": 0.8035714285714286,
  "scores": {
    "words": 0.9,
    "layout": 0.8,
    "tables": 0.5,
    "structure": 1.0
  },
  "documents": [
    {
      "document_id": "doc-4a1e7c2b-9d3f-4b68-8e15-2c7a0f9d3b41",
      "parse_id": "parse-1f7c3a9e-2d5b-4e81-b6a0-9c4e2f7d1a35",
      "overall": 0.75,
      "scores": {
        "words": 0.9,
        "layout": 0.8,
        "tables": 0.5,
        "structure": 1.0
      }
    },
    {
      "document_id": "doc-7c2d9e4f-1a6b-4d3c-b8e2-5f0a1c9e7d26",
      "parse_id": "parse-6b2e8d4a-9f1c-4a73-8d25-3e7a0c5f9b14",
      "overall": 0.8571428571428572,
      "scores": {
        "words": 0.9,
        "layout": 0.8,
        "structure": 1.0
      }
    },
    {
      "document_id": "doc-9e5b3a1d-7c2f-4e8a-a6d4-3b1f0c8e2a57",
      "parse_id": "parse-8d4f1b6c-3a9e-4f25-a7c1-2e6b9d0f4c83",
      "error": {
        "type": "https://docs.runpulse.com/errors/file-download-failed",
        "title": "File couldn't be downloaded",
        "status": 422,
        "detail": "ground_truth_url: File couldn't be downloaded",
        "instance": "urn:pulse:request:req-3b7e1f9c-6a2d-4c58-8e41-0d9a2f5c7b16",
        "code": "FILE_DOWNLOAD_FAILED",
        "request_id": "req-3b7e1f9c-6a2d-4c58-8e41-0d9a2f5c7b16",
        "retryable": false
      }
    }
  ]
}
```

[How scores add up](#how-scores-add-up) works these numbers out.

## List an eval's runs

`GET /eval/parse/{eval_id}/runs` returns the eval's runs, newest first: each run's `run_id`, `name` and `status`, its `overall` once it has completed, and when it was created and ended. A run's other scores are in its result. An eval with no runs returns an empty list.

```json theme={null}
{
  "runs": [
    {
      "run_id": "eval-run-7e1b4c9a-2f6d-4a83-b5c0-9d3e8f1a6b27",
      "name": "ultra-2, figures described",
      "status": "processing",
      "created_at": "2026-11-17T10:05:12.204118Z"
    },
    {
      "run_id": "eval-run-5c8f2a1d-3e7b-4a69-9d40-8b2e6f1c7a93",
      "name": "ultra-2",
      "status": "completed",
      "overall": 0.8035714285714286,
      "created_at": "2026-11-17T09:32:00.731204Z",
      "completed_at": "2026-11-17T09:41:27.268590Z"
    }
  ]
}
```

***

## The rubric

Nine items score a parse, and one scores an extraction. Each score is from 0 to 1, where 1 means the output agrees with the ground truth on everything the item looks at. The ground truth is taken as right, and every item counts what the output got wrong, left out or made up.

An item is **not graded** on a document when neither the ground truth nor the output has anything of its kind, such as a table for `tables`. It's then left out of that document's `scores` and of its `overall`. `layout` is not graded when the ground truth has no boxes. When only the output has something of an item's kind, such as a table the ground truth doesn't have, the item scores 0.

### `words`

How many of the words in the document's text came out right. A wrong word, a word left out and a word the ground truth doesn't have each lower it; text in tables, words that hold a digit and tick boxes are scored by `tables`, `numbers` and `checkboxes` instead.

| Ground truth | Output | `words` |
| - | - | - |
| Terminal handling charge for each container | Terminal handing charge for each container | 0.833: 5 of 6 words right |

### `numbers`

How many of the numbers came out right as printed, in text and in tables. A number is any word that holds a digit, such as `12%`, `$4,518.20` or `INV-2025-04817`. A wrong number, a number left out and a number the ground truth doesn't have each lower it, and `(1,234)` is not the same number as `-1,234`.

| Ground truth | Output | `numbers` |
| - | - | - |
| Total due: 1,230.00 by 13 April 2025 | Total due: 1,280.00 by 13 April 2025 | 0.667: 1 of 3 numbers wrong. `words` stays 1.000. |

### `checkboxes`

How many tick boxes are in the right state, ticked or empty, in text and in tables. A box read the wrong way, a box left out and a box the ground truth doesn't have each lower it.

| Ground truth | Output | `checkboxes` |
| - | - | - |
| Smoker: ☐ Yes ☑ No Insured: ☑ Yes ☐ No | Smoker: ☐ Yes ☑ No Insured: ☐ Yes ☐ No | 0.750: 1 of 4 boxes wrong |

### `tables`

Whether each table's cells hold the right text, in the right rows and columns. A wrong cell, a row or column left out or added, and a table left out or made up each lower it, and a cell earns little unless its text is nearly exact.

| Ground truth | Output | `tables` |
| - | - | - |
| A table of three rows: Item, Qty Bolts, 40 Nuts, 60 | The same table without its last row | 0.727 |

### `formulas`

How much of each displayed formula is right, symbol by symbol, with spacing and the different spellings of one symbol, such as `\le` and `\leq`, set aside. A wrong, missing or extra symbol lowers it, and a formula left out or made up counts as 0. Math written inside a line of text is scored with that text.

| Ground truth | Output | `formulas` |
| - | - | - |
| `a^2 + b^2 = c^2` | `a^2 + b^2 = c^3` | 0.941: one wrong symbol |

### `structure`

Whether each block is labelled as the right kind: a heading, text, a list item, a caption, a footnote, or a page header, footer or number. A wrong label, a heading under the wrong heading, and a block left out or made up each count as one block wrong; how the output splits or joins blocks doesn't count here.

| Ground truth | Output | `structure` |
| - | - | - |
| `Invoice`, a title `Payment terms`, a section heading `Payment is due within 30 days of the invoice date.`, text | The same, with `Payment terms` labelled as text | 0.667: 2 of 3 blocks right |

### `paragraphs`

Whether the output's blocks start where the ground truth's paragraphs and other blocks start. Paragraphs run together or split apart, and blocks left out or made up, lower it; page headers and footers don't count here.

| Ground truth | Output | `paragraphs` |
| - | - | - |
| Two paragraphs: `Payment is due within 30 days of the invoice date.` `Interest of 1.5% per month is charged on overdue balances.` | Both sentences in one block | 0.667: one of the two paragraph starts is missing |

### `text_styles`

Whether bold, italic, underline, strikethrough and highlight fall on the right characters, in text, headings and tables. A style lost, a style added, and styled text left out or made up each lower it.

| Ground truth | Output | `text_styles` |
| - | - | - |
| Payment is **due within 30 days** of the invoice date. | Payment is **due within** 30 days of the invoice date. | 0.750: 9 of the 15 bold characters kept, none added |

### `layout`

How closely each block's box on the page agrees with the ground truth's box, for text, tables, formulas and figures. Each block earns the overlap of its box with the ground truth's box: the area the two boxes share, divided by the area they cover together. The credit is that overlap itself, so only the ground truth's exact box earns 1, and a block in the right place with a looser box scores below 1. A block left out, made up or returned without a box scores 0, and an output with no boxes at all scores 0.

| Ground truth | Output | `layout` |
| - | - | - |
| The heading `Payment terms`, its box 0.30 of the page wide | The same heading in the same place, its box 0.40 wide and as tall | 0.750: the boxes share three quarters of the area they cover |

### `field_similarity`

The extract rubric's one item: the share of the extraction's values that are right. A value is a string, a number, or `true` or `false`, and it's compared only with the value at the same place in the ground truth. A wrong value, a value left out and a value the ground truth doesn't have each lower it, and a value empty on both sides isn't counted. Numbers are equal by value, so `5` is `5.0`. Text is equal whatever its case, extra spaces, curly quotes or kind of dash. The order of a list doesn't count.

| Ground truth | Output | `field_similarity` |
| - | - | - |
| `{"invoice_number": "INV-0042", "vendor": "Acme Ltd", "total": 120.5, "paid": true, "currency": null}` | `{"invoice_number": "INV-0042", "vendor": "ACME LTD", "total": 125, "paid": null, "currency": "EUR"}` | 0.400: 2 right, 1 wrong, 1 missing, 1 made up |

***

## How scores add up

**A document's `overall`** is the average of its item scores, weighted by the eval's weights, over the items graded on it. An item that wasn't graded is left out of the sum and of the total weight, so the other items keep their proportions. A document whose graded items all weigh 0 has `scores` and no `overall`, and it's left out of the run's `overall`.

In the result above, the weights are `words` 40, `layout` 30 and `tables` 30:

* The first document is graded on all three: (40 × 0.9 + 30 × 0.8 + 30 × 0.5) ÷ 100 = 0.750.
* The second has no table on either side, so `tables` isn't graded: (40 × 0.9 + 30 × 0.8) ÷ 70 = 0.857.
* `structure` weighs 0. It's scored on both documents, and counts in neither `overall`.

**A run's `overall`** is the average of its documents' `overall`, each document counting once. **Each item's score in the run's `scores`** is its average over the documents graded on it. A document that failed has no scores, and it's left out of every average.

In the result above, the run's `overall` is (0.750 + 0.857) ÷ 2 = 0.804, and its `tables` is 0.500, from the first document alone. The third document failed, so it counts in neither.

***

## Ground truths

A parse document's `ground_truth_url` is optional. Left out: a PDF or an image is still scored, and a document of any other type fails with `GROUND_TRUTH_INVALID`.

A parse ground truth is a JSON file holding the document's parse output in Pulse's format: `markdown`, and its `elements`. One way to make one is to parse the document with Pulse, correct the result, and host that file. In it:

* Give each element its `page`, numbered from 1 as a parse result numbers them. A ground truth whose pages are numbered differently scores as if most of its text were missing.
* Give each element its `bbox`, eight numbers as a parse result gives them, to have `layout` graded. A ground truth with no boxes isn't graded on `layout`.

An extract document's `ground_truth_url` is required. Its file holds the values the extraction should return: one JSON object that fits the dataset's `input_schema`.

Either kind of file:

* Can be at most 100 MB.
* Is read the first time a run needs it, and kept for every later run. Changing the file afterwards changes nothing; to score against another, create a new dataset. If your organization's retention deletes results, see [Retention and limits](#retention-and-limits).
* Fails only its own document when it can't be fetched or is too large, or with `GROUND_TRUTH_INVALID` when it isn't JSON in its format: a web page, say, or an extract file that doesn't fit the `input_schema`. The document's `error` names `ground_truth_url`, and the next run fetches the file again.

## Retention and limits

Datasets, their ground truths, evals and run results are kept until you delete the dataset.

If your organization has turned saving off, or its [retention](https://docs.runpulse.com/v2/jobs.md#retention) deletes results after a time or on first fetch, evals follow it:

* A run's result expires, or is deleted once fetched, as a job's result is. The run's status gives its `expires_at`.
* Ground truths aren't kept between runs. Each run reads each `ground_truth_url` again, so the URLs must still work.
* An extract run parses the dataset's documents itself, and is billed for it, on every run.

The parses and extractions a run starts are jobs, and follow your retention as any job does. If it deletes each result the first time it's read, the run's own read is that first read: each is deleted once its document is scored, or by the time the run ends if the document fails. Reading it afterwards returns `410` (`RESULT_ALREADY_FETCHED`).

Deleting a dataset, with `DELETE /eval/dataset/parse/{dataset_id}`, deletes its ground truths, its evals and their runs, and cancels its runs still running. No route deletes an eval or a run on its own.

A dataset holds up to your organization's limit: 1,000 documents, unless Pulse has set a different one for you. An extract dataset holds at most 1,000, even where your limit is higher. A run parses its documents 1,000 at a time.

| Limit | Value |
| - | - |
| A ground truth file | 100 MB |
| A run's time | 48 hours |

## Next steps

> [card] [Saved configs](https://docs.runpulse.com/v2/saved-configs.md)
>
> Save each config you test, then run an eval with its `config_id`.

> [card] [Eval API reference](https://docs.runpulse.com/api-reference/v2/eval/create-parse-eval.md)
>
> Every eval route, field and error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.