# GEPA holdout

Split your labeled traces 80/20 *before* optimization. Run optimization against the 80; manually validate the resulting judge against the held-out 20. If validation agreement is meaningfully lower than the optimization's reported `optimized_accuracy`, you're over-fit — expand the training set or check for label inconsistency.

```python
from layerlens import Stratix
client = Stratix()

# Estimate cost first
estimate = client.judge_optimizations.estimate(judge_id=judge.id, budget="medium")

# Run optimization (uses platform-side training data; budget controls exploration depth)
optimization = client.judge_optimizations.create(judge_id=judge.id, budget="medium")
while True:
 optimization = client.judge_optimizations.get(optimization.id)
 if optimization.status.value in ("success", "failure"):
 break

if optimization.status.value == "success":
 print(f"Baseline: {optimization.baseline_accuracy:.3f}")
 print(f"Optimized: {optimization.optimized_accuracy:.3f}")

 # Apply to create the new judge version
 client.judge_optimizations.apply(optimization.id)

 # Manually validate the new judge version against your held-out trace set
 # (run trace_evaluations on each holdout trace, compare against your labels)
 correct = 0
 for holdout_trace_id, expected_label in holdout_set.items():
 eval_run = client.trace_evaluations.create(trace_id=holdout_trace_id, judge_id=judge.id)
 result = client.trace_evaluations.wait_for_completion(eval_run.id)
 if result.passed == expected_label:
 correct += 1
 holdout_agreement = correct / len(holdout_set)
 print(f"Holdout agreement: {holdout_agreement:.3f}")

 if holdout_agreement < optimization.optimized_accuracy - 0.10:
 print("Possible over-fit; expand training set or revert.")
```

## See also

* [Tutorial 5: GEPA](/9.-improve-tune-the-system/05-gepa-optimize.md)
* [SDK reference: judge\_optimizations](https://github.com/LayerLens/gitbook-full/blob/main/13-reference/sdk-python/judge-optimizations.md)
* [Bootstrap a judge before GEPA](https://github.com/LayerLens/gitbook-full/blob/main/08-evaluate/guides/bootstrap-judges.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.layerlens.ai/9.-improve-tune-the-system/gepa-holdout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
