﻿---
title: Concepts
description: judy has four parts. Every command combines them. New terms? See the glossary. The metrics page shows how each number comes from the results and the grades...
url: https://docs-v3-preview.elastic.dev/concepts
---

# Concepts
judy has four parts. Every command combines them.

| Part                                                                     | What it is                                                                                        | File                          |
|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|-------------------------------|
| [Judgement set](https://docs-v3-preview.elastic.dev/concepts/judgements) | Queries, and the grades that say which results answer each                                        | `*.judgements.yaml`           |
| [Target](https://docs-v3-preview.elastic.dev/concepts/targets)           | Whatever answers a query: a Query DSL template, ES|QL, a query builder, an HTTP API or a run file | `judy.yaml`                   |
| Results                                                                  | What a target returned for every query, with each query's scores                                  | `{set}.{target}.results.yaml` |
| Comparison                                                               | Two results, paired per query                                                                     | printed, or `--format json`   |

New terms? See the [glossary](https://docs-v3-preview.elastic.dev/concepts/glossary).

## How a query becomes a score

```mermaid
flowchart LR
    Q["Query<br/>yellow fruit"] --> T["Target<br/>your search"]
    T --> R["Results<br/>apple, lemon, banana"]
    R --> S["Metrics<br/>ndcg, mrr, success"]
    G["Judgement set<br/>grades per result"] --> S
    S --> C["Comparison<br/>better, worse or no real difference"]
```

The [metrics page](https://docs-v3-preview.elastic.dev/concepts/metrics) shows how each number comes from the results and the grades.

## The loop

1. `judy run` runs the set against a target and writes a results file.
2. `judy compare` pairs two results files and says whether the difference is real.
3. When a score surprises you, `judy diagnose` and `judy suggest` ask an LLM why. `judy judge` rates the results nobody rated.


## Why results are files

A results file holds each query's scores and the ranked ids the target returned. Comparing two files needs no cluster. You can run
a baseline once on the main branch, keep it, and compare every pull request against it. The file
`{set}.{target}.requests.jsonl` holds the request that judy sent for each query, so you can trace a surprising score to its request.

## How judy decides what is relevant

Only the judgement set decides. A result that the set does not mention counts as not relevant. The [`judged@k` metric](/concepts/metrics#judged)
says how many results that is. The [LLM judge](https://docs-v3-preview.elastic.dev/llm/judging) rates them. Its grades live in `{set}.llm.yaml`, so you can
always score with or without them (`--labels human`).

## Where to go next

- [Judgement sets](https://docs-v3-preview.elastic.dev/concepts/judgements): the file format, grades, tags and gates.
- [Metrics](https://docs-v3-preview.elastic.dev/concepts/metrics): what each number means, with pictures.
- [Targets](https://docs-v3-preview.elastic.dev/concepts/targets): the five ways judy can ask a search system.
- [Modes](https://docs-v3-preview.elastic.dev/concepts/modes): lexical, semantic and hybrid, and routers.