Two-Tier AI Code Review in CI Cuts Costs by Routing Low-Risk PRs Locally
A developer rebuilt their CI-integrated AI code reviewer after noticing high costs from sending every pull request diff to a large frontier model. The redesigned system uses a small local model as a first-tier triage filter, classifying diffs as low or high risk based on whether they touch sensitive areas like authentication, cryptography, or financial logic. Low-risk changes — such as formatting fixes, docs, and test updates — are stopped at the first tier with no expensive API call made. Only high-risk diffs are escalated to the large model, which uses prompt caching to avoid re-processing the stable system prompt and repo context on every review. The approach significantly reduces per-review costs while preserving meaningful oversight for the code changes most likely to introduce security or logic vulnerabilities.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in