← Back to Portfolio 2026.09 · 5 min read
LLM Evals AST Search Infra

Two-Tiered Evaluation for Agentic Coding Tools

Pairing deterministic AST structural validation with temperature-0 LLM judges to cut variance and tighten feedback loops on coding agents.

By Abhinav Kumar

Fig. 01 — Two-stage evaluation gate: structural AST checks reject invalid diffs before temperature-0 semantic grading.

Evaluating agentic coding tools is fundamentally different from evaluating single-turn chat completions. A coding agent edits multiple symbols, invokes tools, and introduces subtle syntactic or semantic regressions that naive string matching misses—while pure LLM-as-a-judge pipelines suffer from high run-to-run variance and unnecessary inference cost.

During my summer working on search and agentic tooling infrastructure, separating deterministic structural verification from low-variance semantic grading proved to be the single highest-leverage change for iteration speed.

Why Single-Stage LLM Judges Drift

When you feed raw model diffs directly into an LLM judge, two failure modes immediately poison your topline metrics:

  1. Structural noise masks real signal. A diff with a missing import, broken scoping, or unparseable syntax still consumes judge tokens and occasionally receives partial credit because the surrounding comments look plausible.
  2. Sampling jitter hides small recall gains. When iterating on retrieval or tool-calling prompts that move topline metrics by 1–2%, non-zero judge temperature introduces variance larger than the delta you are trying to measure.

Good evaluation harnesses behave like compilers first and code reviewers second. Fail fast on structure; spend inference budget only on semantically valid candidates.

Tier 1: Deterministic AST Verification

Before any candidate patch reaches a grading model, Tier 1 parses the before-and-after source files into Abstract Syntax Trees (ASTs) and validates invariants in milliseconds:

def run_tier1_ast_gate(before_src: str, after_src: str, expected_symbols: set[str]) -> GateResult:
    try:
        tree = ast.parse(after_src)
    except SyntaxError as err:
        return GateResult(passed=False, reason=f"syntax_error:{err.lineno}")

    defined = {
        node.name
        for node in ast.walk(tree)
        if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef))
    }
    missing = expected_symbols - defined
    if missing:
        return GateResult(passed=False, reason=f"missing_symbols:{sorted(missing)}")

    return GateResult(passed=True, reason="ok")

Because Tier 1 runs locally with zero network round-trips, broken patches short-circuit immediately and emit structured failure codes (syntax_error, missing_symbols, forbidden_import, signature_drift). Engineers get actionable diagnostics instead of vague prose feedback.

Tier 2: Temperature-0 Semantic Grading

Patches that clear Tier 1 move into Tier 2: a constrained rubric evaluated at temperature = 0.0 with explicit JSON schema outputs. Instead of asking “Is this code good?”, the prompt isolates orthogonal criteria:

  • Task Fidelity: Does the diff satisfy the exact user requirement without altering unrelated behavior?
  • Edge-Case Handling: Are null, empty, and boundary conditions preserved relative to the baseline?
  • Minimality: Did the agent avoid gratuitous refactors that inflate diff size?

Locking temperature = 0 alongside a compact canonical diff representation cuts grader jitter dramatically, making A/B comparisons across retrieval tweaks and prompt variants trustworthy at smaller benchmark sizes.

Takeaways for Fast Iteration

Splitting evaluation into a cheap structural gate and a deterministic semantic judge turns eval runs from an overnight chore into a tight inner loop. You spend less compute, catch syntax and contract regressions instantly, and can measure genuine recall improvements with confidence.