AI Coding Benchmarks for Android Projects: Metrics, Evaluation Design, and Agent Engineering

    This article breaks down what an Android-specific coding benchmark measures and why single-file code generation tests fall short for real application work. It explains the four core task categories (app creation, feature development, code migration, and app conversion), how to read the four public metrics (long-horizon pass rate, average completion, average elapsed time, and cost per benchmark run), and the trade-offs between pass rate, latency, and cost. It also outlines a reusable evaluation pipeline with environment isolation and result review, plus the key agent execution engineering points such as context management, tool feedback loops, rollback, and test-first verification. The goal is to help teams judge output per unit of cost and time rather than a single leaderboard rank.

    1. Why Android Projects Need a Dedicated Coding Benchmark

    Most general-purpose code generation evaluations revolve around short tasks at the single-file or single-function level. The problem boundaries are clear and the context is limited, so a model only needs to complete one block of logic to score. Real application development does not work that way: a single requirement often spans the UI layer, business logic layer, data persistence, and network communication, and it involves a large amount of implicit knowledge such as project structure conventions, dependency version compatibility, resource naming rules, and build script configuration.

    Coding benchmarks designed for the Android scenario exist to fill this gap. They focus on four categories of real engineering tasks:

    • App creation: Starting from an empty project, set up the directory structure, add dependencies, and produce a runnable skeleton.
    • Feature development: Add a complete feature on top of existing code while staying consistent with the original architecture style.
    • Code migration: Convert an older implementation approach into a newer one while preserving equivalent behavior.
    • App conversion: Migrate across platforms or form factors, which requires handling differences in lifecycle, permission models, and rendering.

    What these tasks share is that they are “long-horizon”: the model must read and write files, run builds, read errors, and fix the implementation across multiple consecutive rounds until verification passes. As a result, benchmark results cannot be judged by the similarity of a single generation; they have to reflect end-to-end completion quality.

    2. How to Read the Four Core Metrics

    Public leaderboards typically report four numbers: pass rate, average completion, average elapsed time, and cost per run. Each has a different meaning and a different trap.

    1. Long-horizon task pass rate
    The share of all long-horizon tasks that ultimately pass the predefined verification (for example, the build succeeds and key test assertions hold). It is the metric closest to “can it be delivered,” but it is extremely sensitive to how strict the verification is: loose checks inflate the number, strict checks push it down.

    2. Average completion
    This shows how far the tasks that did not fully pass actually got, distinguishing “cannot run at all” from “only minor finishing work remains.” A high completion value indicates strong engineering progress capability and a low cost for a human to take over.

    3. Average elapsed time
    Long-horizon tasks are usually measured in hours and include multiple tool-call rounds and build waiting. Elapsed time directly affects parallelism: if a single task occupies too much time, it slows down the overall iteration pace.

    4. Cost per benchmark run
    The resource overhead required to run the full benchmark suite. It correlates with elapsed time, the number of tool-call rounds, and context length, and it is an item that budget-sensitive teams must evaluate up front.

    It is worth stressing that pass rate usually involves a trade-off against cost and elapsed time. Some approaches spend more resources to achieve a higher pass rate, while others streamline the inference and execution path to reach a medium pass rate at lower cost, which suits teams sensitive to response time and budget. When evaluating, do not look at a single column; combine “output per unit of cost” and “output per unit of time.”

    3. A Reusable Evaluation Design

    If a team wants to build an evaluation system close to its own business, the following process can be used as a reference.

    Step 1: Build the task set. Select samples from historical requirements that can be judged automatically, cover all four categories (new build, incremental development, migration, conversion), and make sure each category has a clear acceptance script.

    Step 2: Isolate environments. Run each task in a separate container so that dependency caches and state do not contaminate one another.

    Step 3: Collect metrics. Record start and end times, the number of tool calls, the number of failed retries, and resource consumption in a unified way.

    Step 4: Review results. After automatic judgment passes, sample results for manual review to prevent “surface-level passes.”

    The judgment logic can be simplified schematically as:

    1. def evaluate(task, run_result):
    2. build_ok = run_result.build_exit_code == 0
    3. tests_ok = run_result.test_pass_rate >= task.threshold
    4. return {
    5. "passed": build_ok and tests_ok,
    6. "completion": 0.5 * build_ok + 0.5 * run_result.test_pass_rate,
    7. "hours": run_result.elapsed_seconds / 3600,
    8. "cost": run_result.token_cost + run_result.compute_cost,
    9. }

    4. Key Engineering Points in the Agent Execution Path

    Whether a long-horizon task can be completed reliably depends largely on the execution framework rather than model capability alone. Four points are worth attention in practice:

    • Context management: In long tasks, historical information expands quickly, so summary compression and on-demand retrieval are needed to keep key constraints from being pushed out of the window.
    • Tool feedback loop: Build errors and test failure information must be returned in a structured form so the model can locate the problem.
    • Rollback capability: Keep a snapshot after each round of changes so that a usable version can be restored quickly when a regression appears.
    • Verification first: Adding tests before changing the implementation can significantly reduce the share of cases that “look complete but are actually unusable.”

    For cloud deployment, a container platform can host the isolated execution environments, object storage can hold task artifacts and snapshots, a message queue can schedule task distribution, and log and monitoring services with alerting can track failure rates and cost fluctuations. Baidu AI Cloud offers corresponding product categories for these general capabilities, and teams can combine them flexibly according to their existing technology stack.

    5. Selection Advice and Conclusion

    For teams sensitive to both budget and delivery timelines, it is advisable to start with a small-scale task set for a canary validation, watch the three curves of pass rate, average completion, and cost per unit, and then decide whether to expand usage. For core modules with higher quality requirements, keep manual review as the final gate.

    Overall, a coding benchmark for Android projects moves the question from “can the model write code” to “can the model deliver an engineering result.” Its value lies in providing a quantifiable and reproducible basis for horizontal comparison. Understanding the trade-offs behind the metrics is more practically useful than remembering a single leaderboard position.