Evaluating AI Coding Ability for Mobile Apps: Balancing Effectiveness, Time, and Cost

    This article explains how to evaluate AI coding models and agents on realistic mobile app engineering tasks instead of isolated code snippets. It covers the four main task types, the four core metrics (pass rate, average completion, average duration, and cost per run), how these metrics relate to each other, the trade-offs between high-completion and low-cost approaches, and steps for building an internal evaluation process.

    Why Evaluations Need to Focus on Engineering Tasks

    Early code generation benchmarks mostly used single functions or algorithm problems. A solution was judged by whether it passed a small set of unit tests. These benchmarks measure syntax and local logic, but they rarely reflect real development work. A deliverable application usually involves project structure, dependency management, UI layout, state management, permission configuration, and coordination among multiple modules. The task chain is long, and intermediate steps are prone to errors.

    Evaluation should therefore shift from asking “Can the model write a piece of code?” to asking “Can the model complete a deliverable engineering task?” Mobile app development is a typical scenario for this kind of evaluation. Its tasks include creating a project from scratch, adding features to an existing codebase, migrating frameworks or language versions, and converting between different interface structures or device form factors. Each task type has clear acceptance criteria, so the results are closer to a team’s actual experience.

    Composition of Evaluation Tasks

    An effective engineering task set usually covers the following four scenarios.

    1. Project creation: Build a project skeleton from a requirement description, including directory structure, build configuration, and basic pages. The key acceptance criterion is whether the project builds completely and launches.
    2. Feature development: Add functionality to existing code, such as a list page, a local storage module, or an interaction flow. The key criteria are whether the new feature meets the requirement and whether it leaves existing behavior intact.
    3. Code migration: Replace old interface calls, state management approaches, or dependency libraries with new solutions. The key criteria are whether behavior stays consistent after migration and whether deprecated interfaces are no longer used.
    4. App transformation: Adjust interface organization or adapt to different device form factors. The key criterion is whether the layout and interaction meet the design requirements.

    Each task should include automated checks, such as whether compilation succeeds, whether unit tests and UI tests pass, and whether static analysis reports no serious warnings. The more granular the checks, the more reliable the completion score.

    Definitions and Relationships of Core Metrics

    Evaluation reports usually present four metrics. Understanding how they are defined and how they relate to each other matters more than memorizing their values.

    • Pass rate: A task counts as passed only if all of its acceptance checks are met. Otherwise, it counts as failed. The pass rate is the average of these binary results across the task set, and it reflects whether a model or agent can deliver a working result.
    • Average completion: Each task is scored by the proportion of acceptance checks it meets, and the scores are averaged across all tasks. This metric reflects partial-completion ability. A high completion score paired with a low pass rate means many tasks fail on the final step, often because of missed edge cases or incomplete adaptation of details.
    • Average duration: The actual time from issuing a task to producing the final result. This includes reasoning, tool calls, compilation, testing, and retries. In long tasks, repeated self-correction significantly extends duration, so this metric reveals the characteristics of an execution strategy.
    • Cost per run: The total fees for one complete evaluation run, including model calls and tool usage. Cost depends on input and output length, the number of calls, and the number of retries. Track these components separately to locate high-cost steps.

    These metrics are linked. For example, repeated planning and checking during execution usually raises completion, but it also increases duration and cost. Looking at a single metric can easily lead to a one-sided conclusion.

    Engineering Trade-offs: Effectiveness, Time, and Cost

    The value of evaluation results lies in supporting decisions. Teams face different constraints, so the same data can lead to opposite conclusions about which approach to adopt.

    High-completion approaches typically use multi-round planning, step-by-step implementation, and self-checking. They suit complex migrations, long unattended tasks, and scenarios that demand high deliverable quality. The costs are longer wait times and higher fees, and these approaches require more thorough logging and review processes.

    Fast, low-cost approaches typically use single-round or few-round generation. They respond quickly and cost less. They suit frequent small changes, prototype validation, and tasks that reviewers can check quickly by hand. If a task often needs manual repair, its real cost may exceed the billed amount.

    Factors to consider when choosing an approach:

    • Failure cost: whether failures can be detected and rolled back quickly;
    • Manual review capacity: whether reviewers have enough time and experience;
    • Response time requirements: whether developers need to wait for results immediately;
    • Budget limits: whether billing is per request or per batch, and whether the budget can absorb fee fluctuations on long tasks.

    Converting these factors into quantifiable metrics helps. A common approach is to calculate the average cost per passed task, which is total cost divided by the number of passed tasks. This metric reflects both effectiveness and cost, and it is more intuitive than comparing the two separately.

    Building Your Own Evaluation Process

    If a team wants to assess AI coding ability against its own business needs, it can follow these steps.

    1. Define the task set: Extract tasks from real requirements, cover the four scenarios described above, and write acceptance checks for each task.
    2. Fix the runtime environment: Lock dependency versions, build tool versions, and device simulation settings so that environment differences do not affect the results.
    3. Unify inputs and permissions: Use the same task descriptions and tool permissions, limit network access to the necessary scope, and manage keys securely.
    4. Run multiple times and use statistics: Randomness means the same task can produce different results. Run each task several times, take the mean, and record the standard deviation.
    5. Record and aggregate: Save the raw data from every run, then calculate the metrics in one consistent pass.
    6. Spot-check manually: Sample the passed tasks and review code quality, maintainability, and security risks. Passing tests does not mean the code is ready to deliver.

    The following pseudocode shows how the metrics are calculated.

    1. Record structure RunRecord:
    2. task_id Task identifier
    3. passed Whether all checks passed (boolean)
    4. completion Completion score, range 0.0 to 1.0
    5. duration_h Duration in hours
    6. cost Cost of this run
    7. Function summarize(records):
    8. If records is empty, raise an error and exit
    9. n = number of records
    10. pass_rate = number of passed records / n
    11. avg_completion = average of all completion values
    12. avg_duration = average of all duration_h values
    13. avg_cost = average of all cost values
    14. passes = number of passed records
    15. If passes > 0:
    16. cost_per_pass = sum of all cost values / passes
    17. Else:
    18. cost_per_pass = undefined
    19. Return all of the metrics above

    Common Pitfalls

    Several problems appear often in evaluation practice and deserve close attention.

    • Looking only at pass rate and ignoring cost and duration: Two approaches with similar pass rates can differ in cost several times over, so compare them on all dimensions before choosing.
    • Treating completion as pass rate: A high completion score does not mean the output is ready to ship. If a key feature is missing, a partially complete result may be useless.
    • Drawing conclusions from a single run: Randomness can make single-run results vary widely. Compare approaches only after multiple runs.
    • Overlap between the evaluation set and training data: If task content already appears in a model’s training data, the results will be inflated and may not reflect real ability. Use newly constructed or confidential tasks.
    • Ignoring maintenance cost: Code that passes tests may still be hard to modify later. Implementations with messy structure and heavy duplication increase long-term cost.

    Practical Recommendations

    Use evaluation results to support engineering decisions, not to produce a general ranking. Combine the results with your team’s actual workflow. Start with low-risk tasks, track the pass rate, rework count, and manual review time, and then expand usage gradually. Update the evaluation set regularly with new tasks so that the conclusions keep pace with changes in tools and requirements.