Harness Engineering: Taming LLM Output with Parallel Sampling and Automated Judging
LLM outputs are non-deterministic and often wrong in ways that break downstream systems. Harness engineering gives teams a practical, model-agnostic way to raise reliability without touching weights — but only if they understand that the judge itself is the weakest link and must be constrained with rule-based verification.
A Harness pipeline runs the same prompt N times in parallel, scores every candidate with an automated LLM judge, and picks the highest-scoring result. The approach trades compute for quality: if a single generation has a 30% chance of correctness, five independent attempts push the success rate above 80%, all within the wall-clock time of one request. The three stages — generate, evaluate, select — are decoupled so each can be hardened independently.
Productionizing the pattern requires several additions. A rule-based verifier (unit tests, schema checks) should filter candidates before the LLM judge ranks them, because LLM judges carry systematic biases — position bias, verbosity bias, and self-preference — that inflate pass rates by as much as 17 percentage points over script-based verification. Multi-judge ensembles using different model families reduce that bias, and every run must log the full evaluation trail for bad-case analysis and prompt iteration.
The technique works best for code generation and mathematical reasoning, where correctness is verifiable. It breaks down for open-ended creative tasks and high-stakes decisions where judge bias dominates. When a particular N value consistently delivers, the selected outputs become training data for rejection-sampling fine-tuning, which bakes the selection pressure into the model weights and eliminates the N× inference cost.
The 17-percentage-point gap between script-based verification and LLM-judge pass rates is not a footnote — it quantifies how much a naive Harness pipeline overestimates its own quality, and it explains why rule-based pre-filtering is non-negotiable in production.
Position bias in LLM judges means that simply reordering candidates in a prompt can flip the winner, which makes single-judge Harness pipelines dangerously unstable for any task where the ranking order matters.
The conservative principle from the RHO system — rejecting the top candidate unless it strictly beats a baseline — is a cheap hedge against judge noise that most Harness implementations overlook.
Harness engineering inverts the usual ML intuition: instead of spending budget on a single high-quality inference, it spends on many cheap inferences and a cheap judge, betting that selection pressure is cheaper than model improvement.