How to Evaluate Complex Task Execution in LLMs: A Model Selection Checklist

    This article explains what complex task execution involves for large language models, how to design a fair evaluation, how to build an execution loop with step limits, retries, and logging, and which metrics to check when choosing a model.

    In single-turn Q&A, mainstream large language models often give similar answers. Most models can handle everyday chat, translation, and document summarization. Differences usually appear when tasks get longer, require tool calls, or span multiple steps. This article explains what complex task execution involves, how to design an evaluation, how to build an execution loop, and which metrics to check when choosing a model.

    Why Single-Turn Q&A Doesn’t Show the Gap

    A single-turn Q&A test measures the quality of one generated response. An evaluator gives a math problem or a piece of code and checks whether the model produces the correct answer in one pass. This kind of test measures static knowledge and reasoning ability. It does not reflect how a model performs in a real project.

    Real development work looks more like the following process. The model first understands the requirements, breaks the work into steps, creates files, runs tests, reads error messages, modifies the code, and tests again. The result of each step affects the next one. If one step fails, the steps that follow may also be affected. For this reason, the evaluation target should shift from “Is the answer correct?” to “Can the task be completed end to end?”

    What Does Complex Task Execution Involve?

    Execution ability can be broken down into four capabilities.

    • Planning: Breaking a goal into verifiable steps and adjusting the plan based on execution results.
    • Tool use: Choosing the right tool, generating parameters that follow the interface specification, and parsing return values correctly.
    • State management: Remembering completed operations, file changes, and key constraints so the goal is not lost during a long task.
    • Error correction: After a failure, reading the error message, fixing parameters or switching to another approach, and knowing when to stop.

    All four capabilities are necessary. A model with strong planning but frequent tool-call errors still cannot finish the task.

    How Should the Evaluation Be Designed?

    A model’s results can vary widely under different conditions, so the evaluation conditions must be fixed before results are compared. Record the following five items.

    1. Model version and test date. Models get updated, and results without a recorded version cannot be reproduced.
    2. Task set. Include at least three task types, for example small script development, multi-file code modification, and report generation with data queries. Each task type should have a clearly defined range of steps.
    3. Tool environment. Record tool versions, timeouts, sandbox configuration, and available permissions.
    4. Success criteria. Judge results by automated test pass rates, manual acceptance decisions, or both. Do not rely only on the model’s own report that it has “completed” the task.
    5. Cost. Record input tokens, output tokens, number of calls, retry count, and human intervention time for each task.

    Model output is stochastic, so each task should be run several times. Report the mean success rate and its range of variation. Reporting a single run can mistake a lucky success for stable capability.

    How Are Tool Calls and State Management Implemented in Long-Horizon Tasks?

    The key to long-horizon tasks is control. A model should not call tools without limit. The result of each step should be written to explicit state, and failures need a cap and a fallback path. The pseudocode below shows an execution loop with a step limit, a retry limit, and logging. The llm and tools objects must be registered before the loop runs. The plan and step.params values are generated by the model and must be validated before use.

    1. MAX_STEPS = 50 # Maximum number of steps allowed for a single task
    2. MAX_RETRY = 3 # Maximum number of retries allowed for the same step
    3. def execute_complex_task(task_description, llm, tools, logger):
    4. # 1. Planning: returns an ordered list of steps, each containing an id, a goal, and initial parameters
    5. plan = llm.generate_plan(task_description)
    6. context = {"history": [], "state": {}}
    7. for step_index, step in enumerate(plan):
    8. if step_index >= MAX_STEPS:
    9. logger.error("Maximum step count exceeded, task terminated")
    10. return {"status": "aborted", "reason": "max_steps"}
    11. retries = 0
    12. while True:
    13. # 2. Tool selection: only tools on the allow list can be chosen, and parameters must conform to the tool's JSON Schema
    14. tool_call = llm.select_tool(step, context, tools.allowed_list())
    15. # 3. Tool execution: run in a sandbox with a timeout
    16. result = tools.execute(tool_call, timeout_seconds=60)
    17. logger.info({"step": step.id, "tool": tool_call.name,
    18. "status": result.status})
    19. if not result.has_error():
    20. # 4. Success: write to history and state, then move to the next step
    21. context["history"].append({