Skip to main content

How should I benchmark AI coding models on my own codebase?

Summary

  • Build tasks from your merged pull requests. Each one already has a human-written change, a review and tests, and no model has trained on it.
  • Rewrite each PR description as a task prompt that states the goal and constraints but not the solution, and hold the PR's tests out to grade the result.
  • Grade with tests, not an LLM judge. Databricks found that judges reward sounding right over being right, so its benchmark scores pass or fail from held-out tests.
  • Benchmark the model and the harness together, and record cost per task. Token price is a poor guide to what a task actually costs.
  • Close the leaks: Databricks found agents could recover the merged solution from Git history and sealed the history off for each run.

How should I benchmark AI coding models on my own codebase?

Turn your own merged pull requests into tasks, hold out their tests, run each model-and-agent combination on the same tasks, and record both the pass rate and the cost per task. That gives you a benchmark no model has seen, graded by tests your team already trusts, and it answers the question public leaderboards can't: which setup works best, and at what cost, on the code you ship.
Databricks did exactly this and published the method in Benchmarking Coding Agents on Databricks' Multi-Million Line Codebase. Its conclusion: "Any team with a backlog of merged PRs is sitting on a benchmark already that no model has trained on, graded by the tests your team wrote."

Why not rely on public benchmarks?

Public benchmarks such as SWE-Bench and TerminalBench are useful, but the Databricks team gave two reasons they couldn't answer its questions. The tasks are public, so their solutions leak into training data over time. And the results weren't representative of a codebase that spans many languages, services and build tools. A benchmark built on your own PRs lets you roll out changes with more confidence that you won't slow your developers down.

How to build the benchmark

Design choice Why it matters
Recent PRs only Tasks reflect the frameworks, patterns and conventions you use today
Human-written changes Filter out bot commits, service accounts and fully AI-generated changes
Strong associated tests Tests are what grade the result, so weak tests make a weak benchmark
Self-contained scope Changes confined to a few modules keep tasks well specified
Representative mix Sample across your stack: backend services, systems code, frontend, API contracts, build configs
Goal-only prompts State the problem and constraints; remove any description of the solution
Held-out tests Set test files aside, then apply them after the agent says it's done
Manual review Read every task; rewrite tests that check exact strings so they grade behavior
Sealed Git history Cut the working copy off from the repository so the merged answer can't be recovered

A few details make the difference. Databricks used scripts and AI to generate candidate tasks but evaluated each one by hand, and rewrote some tests without AI so they accepted a valid alternative implementation. It ran each harness and model with its standard, out-of-the-box setup and the tools engineers normally have. When the agent said it was finished, the team checkpointed the code, applied the held-out tests and recorded a pass or fail. Its build system already knew which test targets depended on the touched files, so it ran all of them in full.

What to measure

Score more than accuracy. The Databricks benchmark plotted quality against cost and found:

  • Models clustered into capability tiers. The most capable models handled every kind of problem but cost the most, while medium and lower tiers were still highly effective on common tasks.
  • Token price was a poor indicator of end-to-end task cost, because models differ in reasoning efficiency. Larger models can use far fewer tokens and cost less per task.
  • The harness changed cost and quality. The same model through different harnesses produced very different costs per task, largely from how much context each harness sent per turn.
  • The best quality for a given cost included models from several providers and open source, so only a mix of tools delivered frontier performance.

How Databricks approaches it with Unity Gateway

Databricks used Unity Gateway to capture logs of its engineers' coding interactions, which showed how varied the complexity of real tasks was and that the expensive models were the defaults engineers used. You can use the same pieces:

FAQs

How many tasks do I need?

Start with a set you can review by hand, spread across your stack, and keep adding. Databricks says it keeps adding tasks, especially harder ones, and plans to run every new agent and harness through it.

Should the benchmark test models or coding agents?

Both. The harness a model runs in affects cost and quality, so test each model with the harnesses your developers actually use.

Why not grade results with an LLM?

Because a judge can be fooled by output that looks plausible. Held-out tests check behavior, which is what matters when code ships.

How do I stop the benchmark from going stale?

Pull tasks from recent history so they reflect current code and conventions, and rerun the suite whenever a new model or agent version arrives.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.