AI Coding Benchmarks for Android Engineering: Metrics, Agent Frameworks, and Cost Control

    General code generation benchmarks mostly test single files, single functions, and short contexts, but real Android delivery involves layered project structures, constrained build scripts, lifecycle-coupled UI, device fragmentation, and continuous compilation, static checks, and instrumentation tests. This article explains how Android-oriented benchmarks are designed as long-horizon tasks, breaks down four core metrics (task pass rate, average completion, average wall-clock time, and cost per run), and shows why agent scaffolding often matters more than the model itself. It also covers how to map benchmark scores to your own repository, balance cost, latency, and reliability, avoid common pitfalls, and build an internal evaluation loop that turns leaderboard numbers into engineering value.

    1. Why Android Engineering Needs a Dedicated Coding Benchmark

    Most general code generation evaluations focus on single-file, single-function, short-context problems. They measure the ability to write a correct snippet. Real Android engineering delivery is a different shape: layered project structure, build scripts and dependency versions that constrain each other, UI tightly coupled to lifecycle, device and OS version fragmentation, and the need to keep passing compilation, static checks, and instrumentation tests. A correct snippet does not mean a deliverable project.

    For this reason, Android-oriented benchmarks usually design tasks as long-horizon work: the model or agent must operate continuously in a real repository for hours or longer, autonomously completing the full loop of locating, modifying, building, running tests, rolling back, and retrying. What this kind of evaluation measures is not inspiration, but stability.

    2. What the Four Core Metrics Actually Measure

    • Task pass rate: The proportion of tasks in a given set that are finally judged to fully meet the acceptance criteria. It is the hard gate for “can it be delivered”.
    • Average completion: For tasks that do not fully pass, a continuous score based on the proportion of acceptance items completed. It reflects “how far off it is” and is a key supplement for judging usability.
    • Average time: Wall-clock time from task start to final judgment. It directly determines how many attempts a single iteration cycle can accommodate.
    • Cost per benchmark run: The model invocation and execution overhead of running a full benchmark suite. It is the denominator for budget evaluation.

    A common misreading is to look only at pass rate. For example, one approach has a pass rate of about one quarter on a long-horizon task set, average completion above 80%, average time of about 27 hours, and a per-run cost on the order of about 300 USD; another approach has a pass rate of about one sixth, average completion of about 70%, average time of about 12 hours, and a per-run cost on the order of about 10 USD. The former is closer to “deliverable”, while the latter is closer to “high-frequency trial and error”. The two are not substitutes, but different stations on a pipeline.

    3. Why the Agent Framework Becomes the Deciding Factor

    Under the same model capability, differences in the agent scaffolding often affect results more than the model itself. It determines how context is retrieved, how tools are invoked, and how failures are recovered. Four points are worth attention from an engineering perspective:

    1. Context engineering: Trim repository information by module to avoid filling the window with irrelevant files.
    2. Tool loop closure: Reading files, modifying files, running builds, running tests, and reading logs must be composable atomic capabilities.
    3. Failure recovery: A compilation failure should automatically parse the error, roll back to the last buildable state, and retry.
    4. Termination judgment: Use the exit code of the acceptance script as the sole termination basis, rather than the model’s self-report that it is “done”.

    Illustrative acceptance and termination logic can be written as:

    1. // Pseudocode: use verifiable signals as the task termination condition
    2. fun runTask(task: Task, workspace: Workspace): Result {
    3. val limit = Budget(maxWallClockHours = 30, maxCostUsd = 350.0)
    4. while (!limit.exhausted()) {
    5. val patch = agent.propose(workspace.snapshot())
    6. workspace.apply(patch)
    7. val build = gradle.assembleDebug() // build is the first gate
    8. if (build.failed) { workspace.rollback(); continue }
    9. val report = instrumentation.runAll() // second gate
    10. return when {
    11. report.allPassed -> Result.Pass(task.id, report.coverage)
    12. report.progress > 0.8 -> Result.Partial(task.id, report.progress)
    13. else -> { workspace.rollback(); continue }
    14. }
    15. }
    16. return Result.Timeout(task.id)
    17. }

    4. Mapping Benchmark Scores to Your Own Project

    Do not directly copy leaderboard conclusions. First build a “task profile”. It is recommended to establish an internal evaluation set by four task categories: app creation, feature development, code migration, and app conversion. Take several real requirements for each category and define acceptance scripts clearly. Then run different approaches with the same set of scripts, record the four metrics, and form your own baseline.

    For scoring, a simple weighted view can be used: treat pass rate as delivery capability, completion as rework cost, and time and cost as throughput capability. If the team is in an exploration phase, give throughput a higher weight; if it is in a version freeze phase, max out the weight on delivery capability.

    5. The Triangle of Cost, Latency, and Reliability

    The high cost of long-horizon tasks comes from “repeated trial and error” itself. There are three layers of control: on the task side, split large requirements into small tasks that can be accepted independently to reduce the cost of a single failure; on the execution side, set dual limits on wall-clock time and amount, and roll back on timeout; on the architecture side, make build cache, dependency cache, and test sharding into reusable infrastructure so that each attempt is cheaper.

    When deploying in the cloud, container platforms can host parallel tasks, object storage can store artifacts and logs, message queues can handle task distribution, and log services and monitoring alerts can handle observability. This enables horizontal scaling and also pinpoints “which step burns the most money” to a specific stage.

    6. Common Pitfalls

    • Judging by a single run: long-horizon tasks have high variance, so run multiple times and take the distribution rather than the mean.
    • Ignoring build and test stability: environment jitter can be misjudged as insufficient model capability.
    • Looking only at pass rate and not completion: this underestimates the engineering value of “nearly usable” approaches.
    • Lacking a rollback mechanism: once the workspace is polluted, all subsequent rounds are void.

    7. Implementation Checklist

    1. Build an internal long-horizon task set of 20–40 items, covering the four scenarios with scripted acceptance.
    2. Set wall-clock and cost limits for each task, and enforce rollback.
    3. Evaluate horizontally on the same task set, recording the four metrics: pass rate, completion, time, and cost.
    4. Dynamically adjust weights by iteration phase to form a selection conclusion.
    5. Make caching, parallelism, and observability into platform capabilities to continuously reduce per-run cost.

    The conclusion is clear: AI coding evaluation for Android engineering has shifted from “can it write” to “can it deliver stably within budget”. Understanding the relationships among the metrics and building your own evaluation loop is the right path to turn leaderboard numbers into engineering value.