How Pinterest Improved Analytics Agent Compliance with Loop Engineering
B · Useful, limited Pinterest engineering describes an automated prompt-tuning loop for its analytics agent with honest footnotes on variance and labelling; useful method, but internal data, one model, and before/after results shown mainly in figures.
Summary based on the full text·Original: about 10 minutes to read
In short
Pinterest's Analytics Agent answers data questions by searching tables, dashboards and metrics. The team needed it to follow procedural rules, such as reading table metadata before writing SQL, only when they apply. Manual prompt edits were trial and error, so they built a tuning loop that proposes small edits, tests them on paired required/skip suites plus a regression suite, and rejects changes that fix one thing and break another. The post is candid that the first big run looked better than it was.
Key numbers
- 64%compliance with the read-the-data-discovery-skill rule across a broader set of chats, even after manual instruction edits
- 89.3%pooled pass rate over tuning and validation cases in the first large loop run
- 10.3%cases (23 of 223) that changed verdict between two identical runs
- about fivefoldestimated drop in model cost when each iteration starts from a fresh context
As reported by the source.
English·Web page·opens medium.com
What it reports
- Compliance with one rule (reading the data-discovery skill) reached only 64% across a broader set of chats after manual revisions. Table searches ran more than ten times as often as chart and dashboard searches.
- A scope guardrail made the agent decline an in-scope question about storage costs without searching.
- Each rule gets a required suite and a skip suite. A change that made dashboard search more aggressive fixed one required case and caused two new regressions in skip cases; only the skip suite showed it.
- A persistent session grew too expensive; a memoryless loop with fresh context cut estimated cost about fivefold but repeated earlier mistakes. The final design starts each iteration fresh with a structured handoff of scores, failing cases, best change, approaches not to repeat, and frozen suites.
- Each edit must pass a repair/break gate, an acceptance critic that rejects hard-coded answers, and a regression guard. Edits are limited to prompt, skills, context layer and tools, with a shrinking line cap.
- The first large run reached 89.3%, but most of the gain came from the first accepted change and iterations 21-30 added nothing.
- Two identical runs over 223 cases flipped 23 verdicts (10.3%), so a one- or two-case improvement can be noise.
How they got it
Internal evaluation data from July to September 2026, with chats labelled by a focused LLM labeler and reviewed by people. Tuning, validation and holdout splits per rule. All runs used one model at one reasoning setting.
Limits
- One trial per case, and the LLM labeler is not calibrated against human labels (stated in the footnotes).
- The 64% figure is not a before/after comparison; one suite was built only from known failures, so its 0% baseline is by design.
- Answer quality was not measured directly; compliance is a proxy.
- The cost comparison is an internal estimate.
Why it matters for companies
Any team tuning an internal agent's prompts will meet the same two traps: a fix that only looks good because nothing checks the cases where the step should be skipped, and score changes that are run-to-run noise. The paired suites, the regression guard and the measured 10% flip rate are cheap disciplines to adopt before trusting a prompt change. The plateau after the first edit suggests budgeting for a short loop rather than long automated runs.
Summary based on the full text. Read the original for the full argument and data.Read the original on medium.com
- Tags
- Evaluation