Lance Martin: Audit Prompts, Build Better Evals and Optimize Agent Cost

An Anthropic engineer explains prompt caching, evaluation design, hill climbing and the architecture of reliable long-running agents.

LMLance MartinVortrag · Anthropic
Kanal
AI Engineer
Veröffentlicht
6. Nov. 2026
Video
1:04:02
Lesezeit
8 Min.
Folien
6
Original
Englisch
Auf YouTube öffnen
Beim Scrollen schrumpft das Video in die rechte untere Ecke und läuft weiter. Untertitel folgen Ihrer Lesesprache.
LesespracheIn 2 Sprachen verfügbar
Diesen Artikel gibt es noch nicht auf Deutsch, daher wird das Original (Englisch) angezeigt.
ZUSAMMENFASSUNG

In 30 Sekunden

Lance Martin describes practical ways to improve Claude applications through prompt audits, caching and measured optimization. In an extended Q&A he discusses open-ended grading, overfitting, model effort, evaluation ownership and recoverable agent harnesses. Reported savings are specific examples.

  1. 1Audit legacy promptsRemove outdated or contradictory instructions after measuring the effect.
  2. 2Preserve cache prefixesStable request prefixes improve cache reuse.
  3. 3Build a climbable evalCheck headroom, model scaling and run-to-run variance.
  4. 4Watch for overfittingUse a held-out split and representative production cases.
  5. 5Make long runs recoverableKeep session state independent from the harness and sandbox.

Das Wichtigste

  1. Audit legacy and contradictory instructions against the actual task.
  2. Stable prefixes and cache diagnostics can reduce repeated input costs.
  3. A useful evaluation needs meaningful headroom, representative cases and low variance.
  4. Use held-out cases to detect overfitting during optimization.
  5. Long-running agents need recoverable state, isolation and appropriate secret handling.
VOLLTEXT

Den bearbeiteten Text nach Kapiteln lesen

Nur das Transkript
01

Prompt debt

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Anthropic’s Lance Martin argues that application teams often operate inside the available cost-quality frontier because of small configuration errors. Fixing those errors can improve quality and reduce cost at the same time.

Prompts accumulate debt like code. Martin recommends reviewing instructions written for older models, including blanket requests to think step by step, repeatedly verify work or be maximally thorough.

His claim is model- and task-specific: newer frontier models may spend unnecessary tokens on such rituals. Contradictory rules can also confuse a stronger instruction-following model. Remove an instruction only after measuring the effect on the actual task.

Martin demonstrates prompt-audit skills for Claude Code configuration and API applications. They look through project instructions, tools and prompts for patterns that may no longer help.

Auditing a legacy prompt
FOLIE 1 / 6Auditing a legacy promptThe example compares cost and accuracy before and after a model upgrade and prompt audit.

On a synthetic evaluation of roughly 50 customer-support tickets, his example compares a legacy prompt, a model upgrade and an audited prompt. The audit improves the reported score and lowers cost for that benchmark; it is not a guarantee for every workload.

02

Prompt caching

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Next comes prompt caching. Agent conversations repeat much of their context over many turns, so reading cached tokens can reduce expense and latency. Martin notes that the exact pricing depends on the model and should be checked.

Caching requires a matching prefix. A change early in the request can invalidate the reusable prefix, so put stable system instructions and tools before project, session and per-turn material where the API permits.

He recommends monitoring cache-hit rates and using diagnostics to identify prompts that can be reorganized. In internal benchmark harnesses, his team reports cost reductions of up to roughly 72% with no meaningful measured performance change after correcting cache use.

Prompt cache savings
FOLIE 2 / 6Prompt cache savingsInternal benchmarks show reported cost reductions after cache optimization.
03

Designing climbable evaluations

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

For optimization, Martin says a useful evaluation must be climbable: stronger models and more effort should generally help, the best model should have room to improve, and repeated runs should have low variance.

Properties of a useful evaluation
FOLIE 3 / 6Properties of a useful evaluationThe graph illustrates model and effort scaling, headroom and low variance.

Ambiguous or impossible cases can create illusory headroom. A team may spend tokens optimizing toward a score that no reasonable solution can achieve, so it should inspect the data and grading criteria before running a search.

He describes a Claude Code skill that helps construct an evaluation from traces or other data. The user still decides what matters, inspects examples and checks whether the grader reflects the desired behavior.

04

Hill climbing and overfitting

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Once the evaluation is sound, an agent can iteratively change a prompt or skill and measure the result. Martin calls this hill climbing, but warns that improvements can reflect overfitting to the evaluation rather than production performance.

For example, an optimizer may add an OCR tool because one benchmark case needs it even though real users do not. Distinctive wording in benchmark examples can similarly encourage prompt changes that do not generalize.

His approach separates training and test examples. The optimizer examines failures in the training split, while scores on the held-out split give an early warning if training improves and test performance stays flat.

Train and test during hill climbing
FOLIE 4 / 6Train and test during hill climbingThe optimizer analyzes training failures while tracking the held-out split.

Martin describes improving a Claude API documentation skill that initially scored 66% on his evaluation. He let the system inspect failures and revise the skill against the documentation; the result is an example of a narrow, measurable surface.

05

Searching for lower cost

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

The same process can search for lower cost while keeping performance at least at baseline. It can try combinations of model, effort and prompt, rejecting configurations that degrade the evaluation.

Searching cost and quality
FOLIE 5 / 6Searching cost and qualityThe example changes models, effort and prompt while tracking a benchmark.

In a customer-support example, Martin reports a roughly 90% cost reduction with higher performance after changing model and effort and refining the prompt. This is a reported result for that particular synthetic benchmark.

His rule of thumb is to test a stronger model at lower effort: it can use fewer total tokens than a weaker model working at high effort. The best choice remains empirical and depends on the task and pricing.

06

Long-running agent harnesses

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Long-running agents require a different harness from short chats. Martin focuses on recoverability and security when an agent may run for hours or days.

Separating agent components
FOLIE 6 / 6Separating agent componentsThe diagram separates the harness, session, sandbox, tools and orchestration.

He describes separating the agent harness, sandbox and append-only session log. If a sandbox or harness fails, the orchestration layer can recreate it and recover the session from independently stored state.

For secrets, Martin says managed agents use a vault so the model can refer to credentials through tools without seeing their contents directly. He presents this as one control for long autonomous runs.

His recap connects the pieces: audit prompts, use the cache, design good evaluations, guard against overfitting and choose a recoverable, secure harness for long-running work.

07

Human-assisted evaluation design

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Asked how much evaluation design can be automated, Martin says Claude can scan traces for candidate failures. He wants the workflow to show raw examples to a human before turning them into evaluation cases.

Human feedback can become an evaluation signal for hill climbing, provided it distinguishes better from worse outcomes. Martin emphasizes a collaboration in which people set goals and inspect the data while the model assists with repetitive work.

Prompts and skills are convenient optimization surfaces because they are easy to edit and directly influence behavior. Modifying a whole harness can work too, but larger code changes are harder to interpret.

That convenience comes with a warning: prompts can overfit easily. Even a train-test split is not a substitute for representative examples and careful checks against real production behavior.

For a repeated workflow, Martin suggests asking the model to turn the procedure into a reusable skill. For optimization, begin with a simple baseline skill and improve it against a defined evaluation.

08

Grading open-ended work

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Open-ended tasks are harder to grade than tests with deterministic answers. Martin recommends beginning with a rubric a person can understand and, where possible, using clear binary checks instead of vague numerical ratings.

He suggests checking a rubric across multiple models and repeated runs. Pairwise comparisons can also help: deciding which of two artifacts is better may be more reliable than assigning one an arbitrary score.

An evaluation distribution should reflect cases that matter in production. Sampling only failures of one model can bias the benchmark toward that model’s particular weaknesses, which another model may solve for incidental reasons.

Martin clarifies that multiple rating categories are possible when their meanings are well specified and graders agree. Binary grading is a simplifying heuristic, not a requirement for every evaluation.

Whether a personal automation needs an evaluation depends on the stakes. A workflow producing important external deliverables or handling sensitive work warrants more rigorous checks than a low-impact convenience tool.

09

Stalled searches and effort settings

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Hill climbing is not guaranteed to converge. If it stalls, Martin says the optimizer can cluster remaining failures and look for ambiguous instructions or faulty graders, rather than spending indefinitely on impossible cases.

He says the hill-climbing skill is open source and might be adapted to other frameworks, while noting he has not personally checked all integration details. The underlying loop is general: propose a change, measure it and retain useful changes.

On effort settings, Martin recommends trying a capable model at low effort first and increasing it when measurements justify the extra work. A small model at high effort can cost more in tokens without producing the best result.

An optimization run also needs a budget. A poorly specified evaluation can consume many tokens pursuing ambiguous cases, so spending limits and evaluation quality work together.

Humans determine the goal and decide what matters; Claude can then inspect traces and flag likely failures. People review those candidates before promoting them into an evaluation set.

10

Ownership and autoresearch

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Martin says evaluation ownership follows product ownership rather than belonging exclusively to one specialist team. Tools can reduce setup work and make it easier for people in different roles to participate.

For generative interfaces, he has seen pairwise judges compare variants across many trials and aggregate results. Similar model-based grading can be used for retrieval and writing when rubrics are carefully designed.

He connects the method to autoresearch: both use a measurable objective, run experiments and adapt based on results. The specific surface and objective differ, so a workflow may need to be adapted.

Multiple objectives such as cost, quality and speed can be considered together, but each added objective makes the search harder. Martin suggests that changing one dimension at a time may sometimes help.

Asked how far back prompt-audit advice applies, he says the boundary between older and newer models is imprecise. The skill includes some model-specific guidance, and teams should test changes when migrating.

He explains effort as guidance about how hard the model should think, not a simple hard cap. Difficult tasks can make high-effort settings much more expensive, so teams should compare outcomes and token use.

The method resembles training in its use of objectives and train-test splits, but Martin distinguishes it as a runtime change to prompts or skills after deployment.

Evaluation awareness is a broader concern, but in this setting he sees overfitting as the more immediate practical problem. A model can improve a benchmark number by exploiting peculiarities that do not carry into production.

11

Small datasets and long tasks

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Small evaluation sets can be noisy, unrepresentative and easy to overfit. Martin does not give a universal minimum size; he recommends considering the signal and task when choosing the data.

For very long tasks, each optimization round takes longer and failures become more costly. Reliable, recoverable infrastructure becomes necessary when a search runs for many hours or days.

Agent evaluations may need multiple turns and can grade the entire trajectory, the final outcome or both. Traces are useful inputs for building such cases, but the right grading design depends on the task.

For context reliability, Martin returns to keeping the session log independent of the harness. That allows an agent to retrieve older material after compaction rather than losing information that might later matter.

12

Keeping evaluations useful

Martin explains the practice and its trade-offs. He illustrates it with examples and questions from the audience.

Open-ended and nondeterministic tasks put more pressure on evaluation design. Clear objectives, understandable rubrics, agreement across graders and low variance give an optimizer a more useful signal.

As models improve, Martin expects a healthy evaluation to show corresponding progress; saturated or ambiguous benchmarks may need replacement. Designing challenging evaluations remains an ongoing task.

He describes a production feedback loop: monitor traces, select meaningful failures for an offline evaluation, optimize against them and keep solved cases as regression tests. The hard part is deciding which production outcomes truly matter.

Mehr aus diesem Kanal

3 Folien31:22EN
AI Engineer· 7. Nov. 2026Nouha Dziri on Making Coding-Agent Teams More Cost-EfficientNouha Dziri · CohereExperiments on ProgramBench and Commit0 show why the task bottleneck, lead model and coordination design matter more than simply adding agents.Multi-agent systemsCoding-AgentenAgent orchestration+2
3 Folien19:34EN
AI Engineer· 7. Nov. 2026How Cloud Agents Help Review Changes to a Security MasterAmol Kapoor, Clifford Ressel · Nori AgenticAmol Kapoor and Clifford Ressel explain why private-asset data is difficult to reconcile and how an agent assists human reviewers.KI im FinanzwesenData quality & curationAgent Engineering+2
4 Folien18:28EN
AI Engineer· 7. Nov. 2026Vinoo Ganesh on Building AI Answers from Verifiable FactsVinoo Ganesh · KeplerKepler’s co-founder describes pointer-based retrieval, deterministic calculations and access controls for financial AI.KI im FinanzwesenRetrieval-Augmented GenerationData quality & curation+2
2 Folien23:05ZH
AI Engineer· 6. Nov. 2026Ryo Lu:当我们什么都能做,还知道自己想做什么吗?Ryo Lu从 AI 生成的日记工具到爵士乐团,Ryo Lu 讨论如何在更强大的工具旁保有判断、生活和与他人合作的空间。AI interface designHuman-AI CollaborationCreativity+2
4 Folien19:19EN
AI Engineer· 6. Nov. 2026Ben Holmes: Use Agent Traces to Improve Agent SkillsBen Holmes · WarpThe Warp engineer explains how scoring conversations can uncover hidden friction and produce reviewable configuration improvements.Coding-AgentenEvalsSoftware engineering
5 Folien19:43EN
AI Engineer· 6. Nov. 2026How a Knowledge Graph Helped Map a 35-Million-Line MainframeStephen Chin, Neeraj Deshmukh · Neo4jStephen Chin and Neeraj Deshmukh explain context, agent orchestration and behavior-parity tests for legacy-system modernization.Knowledge graphsCoding-AgentenEnterprise-KI