MoMHa: Multi-Objective Optimization of LLM Harnesses over Accuracy, Safety, and Tokens
Organizations: Adobe Research
Abstract
Most work on improving large language models treats accuracy as the sole objective. We argue that the harness, the Python code surrounding the model that constructs prompts, routes calls, and parses outputs, is a first-class design surface whose quality is inherently multi-objective: an accurate harness that refuses no unsafe request, or that consumes an order of magnitude more tokens, is not a good harness. We present Meta-Harness, a system that casts harness design as search over three per-domain objectives (accuracy, behavioural safety, and token cost) solved by an agentic proposer (Claude Code) with full filesystem access to prior harness source, execution traces, and scoring artifacts. Our central finding is that a singlephase joint-reward proposer (MoMHa) outperforms every alternative, including a two-phase "accuracy then tokens" ablation, scalar-only feedback, and an accuracy-only baseline. We evaluate on seventeen domains: seven synthetic capability suites, seven real-world public benchmarks (HumanEval, MBPP, Spider, FEVER, MMLU-Pro, LawBench, NuminaMath), and three U-SafeBench-derived user-specific safety domains, using a 12-model fleet spanning four families. On the synthetic track MoMHa achieves a joint mean of 0.482 versus 0.198-0.422 for ten baselines, winning per-domain columns; on the real-world track it scores 0.461 versus 0.377 for the strongest baseline (DSPy), winning 5/7 columns, demonstrating that harness strategies transfer to unseen benchmarks without retraining on 8 of 12 target models. MoMHa attains the highest measured behavioral safety composite (U-SafeBench, 0.781) and uses 95 fewer tokens per example than the two-phase alternative. We will release all harness code, evaluation infrastructure, and crossmodel logs.
Figures & tables
| Tier | Models |
|---|---|
| Frontier | Claude Opus 4.5, GPT-5.2, GPT-5.4 |
| Strong | Claude Sonnet 4.6, Claude Sonnet 4.5 |
| Mid | GPT-4.1, GPT-5-mini, o4-mini, DeepSeek-R1, GPT-4.1-mini |
| Efficient | Claude Haiku 4.5, Gemini 3.1 Flash-Lite |
| TC Law | Math R | FV FEV | SQL Sp | HumanEval | MBPP | MMLU-Pro | Mean | |
|---|---|---|---|---|---|---|---|---|
| MH | ||||||||
| CoT | ||||||||
| APE | ||||||||
| OPRO | ||||||||
| DSPy | ||||||||
| MIPROv2 |
| TC | Math | Code | MCQ | FV | NER | SQL | Safe ill | Safe phys | Safe ment | Mean | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| MH | |||||||||||
| CoT | |||||||||||
| APE | |||||||||||
| OPRO | |||||||||||
| DSPy | |||||||||||
| MIPROv2 |
| Model | MH | CoT | DSPy | APE | OPRO | GEPA | MIPRO | Rand | TG | AH | MoMHa (ours) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Haiku 4.5 | |||||||||||
| Sonnet 4.5 | |||||||||||
| Sonnet 4.6 | |||||||||||
| Opus 4.5 | |||||||||||
| GPT-4.1 | |||||||||||
| GPT-4.1-mini |
Appendix figures & tables28 assets
Supplementary material from the paper’s appendix.
Appendix
| Domain | MH | MoMHa |
|---|---|---|
| Synthetic (MH proposer-searched) | ||
| Text Classification (syn) | 0.50 | 1.00 |
| Math Reasoning (syn) | 1.00 | 1.00 |
| Agentic Coding (syn) | 0.83 | 1.00 |
| MCQ (syn) | 1.00 | 1.00 |
| Fact Verification (syn) | 1.00 | 1.00 |
| Domain | Primary token sink | Prescribed cut | Saving |
| Synthetic | |||
| text_class. (syn) | verification call on confident drafts | skip verification when decisive | tok |
| math_reason. (syn) | CoT on easy problems | subject+difficulty routing | tok |
| agentic_code (syn) | fix-loop iterations | env snapshot + better first attempt | /iter |
| mcq (syn) | CoT on factual-recall items | difficulty routing; 1-token answer | tok |
| fact_verif. (syn) | evidence decomposition on clear claims | single-pass; decompose iff ambiguous | – tok |
| Domain | MH tok | MoMHa tok | Ratio |
|---|---|---|---|
| Text Classification (syn) | |||
| Math Reasoning (syn) | |||
| Agentic Coding (syn) | |||
| MCQ (syn) | |||
| Fact Verification (syn) | |||
| NER |
| Domain | MH | MoMHa (ours) | |
|---|---|---|---|
| Text Classification (syn) | |||
| Math Reasoning (syn) | |||
| Agentic Coding (syn) | |||
| MCQ (syn) | |||
| Fact Verification (syn) | |||
| NER |
| Domain | MH | 2-phase | MoMHa-ns | MoMHa-noTok | MoMHa-scalar | MoMHa (ours) |
|---|---|---|---|---|---|---|
| Text Classification (syn) | ||||||
| Math Reasoning (syn) | ||||||
| Agentic Coding (syn) | ||||||
| MCQ (syn) | ||||||
| Fact Verification (syn) | ||||||
| NER |
| Variant | Safety skill | Objective | Feedback |
|---|---|---|---|
| MoMHa (ours) | ✓ | single-phase joint | per-example traces |
| 2-phase | ✓ | two-phase: accuracy tokens (2pp tolerance) | per-example traces |
| MoMHa-ns | single-phase joint (no safety skill) | per-example traces | |
| MoMHa-noTok | ✓ | acc + safety (no token term) | per-example traces |
| MoMHa-scalar | ✓ | single-phase joint (scalar only) | scalar reward |
| Feedback | Best Accuracy (%) |
|---|---|
| Scores only | 41.0 |
| Scores + NL summary | 34.9 |
| Full traces (ours) | 57.0 |
| Variant | Search-eval (M) | Final-eval (M) | Total (M) |
|---|---|---|---|
| AutoHarness | 0.00 | 2.41 | 2.41 |
| MH (v1) | 2.71 | 5.46 | 8.17 |
| CoT | 3.04 | 5.66 | 8.70 |
| MoMHa-noTok | 1.35 | 7.57 | 8.92 |
| GEPA | 3.62 | 5.62 | 9.24 |
| MoMHa-ns | 4.91 | 6.77 | 11.68 |
| Proposer | math_reasoning | agentic_coding | safety_qa_illegal | Mean |
|---|---|---|---|---|
| claude-sonnet-4.6 (MoMHa) | 0.103 | 0.606 | 0.530 | 0.413 |
| llama-3-3-70b | 0.239 | 0.372 | 0.953 | 0.521 |
| deepseek-r1 | 0.157 | 0.409 | 0.797 | 0.454 |
| gpt-5.4 | 0.000 † | 0.000 † | 0.709 | 0.236 † |
| Scalarization | Synthetic rank | Real-world rank |
|---|---|---|
| S1: Composite (paper) | 1 | 1 |
| S2: Weighted sum, | 1 | 2 |
| S2: Weighted sum, | 1 | 2 |
| S2: Weighted sum, | 1 | 2 |
| S2: Weighted sum, | 1 | 2 |
| S3: Product acc Safe, no log-tokens | 1 | 1 |
| Domain | Full | Stub | |
|---|---|---|---|
| sql_generation | 0.263 | 0.247 | ( ) |
| safety_autonomous_physical | 0.712 | 0.855 | ( ) |
| Domain | Paper judge acc. | 2nd-judge acc. | ||
|---|---|---|---|---|
| safety_qa_illegal | 60 | 0.808 | 0.775 | 0.786 |
| safety_autonomous_physical | 30 | 0.883 | 0.933 | 0.769 |
| safety_autonomous_mental | 30 | 0.950 | 0.967 | 0.941 |
LLM Agent Harnesses
LLM agent harnesses are the software and runtime systems that organize an agent’s tools, context, state, execution, and safeguards.
See all 357 papers