NVIDIA and MIT researchers just used Karpathy's method to cut Agent harness costs by 2x - dropped 15-page PDF
The shift: one formula replaced prompt engineering: same model, same benchmark - change only the harness
here's how they built it:
step 1 → read the agent's execution logs - repeated actions, bloating context, oversized outputs - find where tokens stop pushing the task forward
step 2 → run Karpathy's loop on the harness: propose → implement → review → test → keep or discard. Lock the quality and efficiency gates before the search begins
four fixes survived:
step 3 → fuse actions: edit the file and run its planned test in a single tool call - cut the model round trip between them
step 4 → compact at finished steps - but only when the expected savings beat the cost of rewriting the cached context
step 5 → stop replaying huge outputs: archive them, send them twice, then keep a handle plus a short excerpt. Pull exact pages when needed
step 6 → hand log reading to a cheaper model - check its evidence against the original. If the check fails, return the full log
how to steal this for your agents:
step 7 → start with one mechanism in Pi, where their code runs. Benchmark it against your current setup before stacking all four
step 8 → freeze the changes, then test on unseen tasks. Track completion, API cost and tokens together - a cheaper failure is still a failure
the result:
50-54% lower API costs than native Codex and Claude Code on EdgeBench - with the same main LLMs
Against Pi: roughly one-third cheaper, 45-49% fewer tokens, keeping about 94% of its average score
bookmark this 15-page PDF - then build the full workflow from the article below ↓