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

# Run evals on your data

> Once you have an evaluator, a task runs it over your data - continuously against live traces, or as a batch against a dataset or experiment.

The evaluator defines *what* to measure; the task defines *which data, how much of it, and how often*.

## What is a task

A task connects an evaluator to a data source. Because evaluators live in the [Eval Hub](/docs/ax/evaluate/create-evaluators#evaluator-hub) independently of any task, you build one judge and point it at as many places as you need - different projects, datasets, or experiments. Results attach automatically wherever that data lives.

Every task sets four things:

|                          |                                                                                                                                                             |
| :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Evaluator(s)**         | Which judge runs. All evaluators on one task share a scope, so each task runs at a single level: span, trace, or session.                                   |
| **Data source**          | A project (live traces) or a dataset/experiment, plus a filter for which records qualify.                                                                   |
| **Variable mapping**     | Which column feeds each template variable. This is what makes one evaluator portable across differently-shaped data. See [Column mapping](#column-mapping). |
| **Cadence and sampling** | Continuously as data arrives, or a one-time backfill over history - and what percentage to score.                                                           |

<Frame caption="Evaluator and task workflow">
  <img src="https://storage.googleapis.com/arize-phoenix-assets/assets/images/arize-docs-images/evaluate/tasks.png" alt="Workflow diagram from create evaluator in Eval Hub through create task with target and sampling, runs over tracing or experiment data with scope, view results with scores and task logs, and investigate with view evals or jump to trace, with a loop back to edit or improve the evaluator" />
</Frame>

You'll need data flowing into Arize AX and an LLM provider configured first. See [AI Provider Integrations](/docs/ax/security-and-settings/integrations-playground/overview).

<Tip>
  **Let Alyx set up the task.** Press **Cmd+L** (macOS) or **Ctrl+L** (Windows/Linux) to open [Alyx](/docs/ax/alyx) and try: *"Create an online task that runs this eval on 10% of traces"*
</Tip>

## Column mapping

An evaluator's variables stay unresolved until a task supplies them, which is what lets the same evaluator score data with different schemas. Adding an evaluator to a task opens a mapping row per variable:

* The variable name as the row label
* A dropdown to pick the span attribute (e.g., `attributes.output.value`, `attributes.input.value`) or dataset column that feeds it, populated from the columns present in your project or dataset
* A free-text entry for attribute names the dropdown does not list
* A **live preview** under each row showing the value from a sample record, so you can confirm the mapping before saving

<Tip>**Auto-mapping**: When a variable name exactly matches a column name in your data source, Arize AX fills the mapping in for you. You can override it at any time.</Tip>

For a [code evaluator](/docs/ax/evaluate/evaluators/code-evaluations), the variables are the named arguments of its `evaluate()` method: at run time Arize AX reads the mapped attributes and passes them in as keyword arguments.

For **trace** and **session** evaluators, a variable can also specify which span in the pattern supplies it. See [Subquery-aware variable mapping](/docs/ax/evaluate/run-evals-on-traces#multi-span-queries-trace-and-session-evals).

## Test evaluator code locally

While you can write and test evaluator code in the UI, it is often easier to iterate in a local Python environment. The **Test in Code** button generates starter code that you can run locally.

<Steps>
  <Step title="Click &#x22;Test in Code&#x22;">
    In the evaluator form, click the **Test in Code** button. The system validates your code first - if there are errors, they are shown before proceeding.
  </Step>

  <Step title="Copy the generated code">
    A slide-over opens with a generated Python notebook containing:

    * Environment setup (`pip install arize`)
    * Imports and data loading code using your actual API keys
    * Your evaluator class and a helper `run_evaluators()` function
  </Step>

  <Step title="Run locally">
    Paste the code into a Python script or Jupyter notebook and run it against your data. Once you are seeing the desired results, copy the updated evaluator class back into the UI.
  </Step>
</Steps>

## Online or offline

The same evaluator runs in either mode. Only the target changes.

|                  | **Online**                                 | **Offline**                                          |
| :--------------- | :----------------------------------------- | :--------------------------------------------------- |
| **Runs against** | Live production traces                     | A dataset or experiment                              |
| **Cadence**      | Continuously, as traces arrive             | On demand, per experiment run                        |
| **Answers**      | Is quality holding up right now?           | Is this change better than what we shipped?          |
| **Used for**     | Monitoring, alerting, regression detection | Pre-ship testing, CI/CD, model and prompt comparison |

Run both: offline evals gate what ships, online evals watch what shipped. Most teams start with a one-time backfill to set a baseline, then switch on a continuous task.

<CardGroup cols={2}>
  <Card title="Online evals" icon="gauge" href="/docs/ax/evaluate/run-evals-on-traces">
    Attach an evaluator to live traces.
  </Card>

  <Card title="Offline evals" icon="flask" href="/docs/ax/evaluate/run-evals-on-experiments">
    Attach an evaluator to a dataset or experiment.
  </Card>
</CardGroup>

<Note>
  For the architectural split between platform-managed and self-managed evaluation, see [Online vs offline evaluators](/docs/ax/concepts/evaluators/online-vs-offline).
</Note>

## After it runs

Results attach to whatever the task scored - spans for a project task, experiment rows for a dataset task. See [Results and costs](/docs/ax/evaluate/results-and-costs) for where to read them and how to keep judge spend down.
