Evaluating Large Language Models: Complex Reasoning and Code Generation Benchmarks

    This article breaks down a practical framework for evaluating large language models on complex reasoning and code generation. It explains why simple integer inputs can trigger unexpected failures, categorizes common failure modes, and presents two complementary benchmark tasks: a constraint-satisfaction river-crossing puzzle and a single-file 3D interactive application. You will find scoring criteria, root-cause analysis, prompt engineering strategies, and a reusable evaluation loop for more stable and attributable model selection.

    1. Background: Why the “Simple Input, Hard Failure” Pattern Matters

    As model capabilities iterate quickly, developers care less about whether a model can answer at all and more about whether it can converge reliably on long-chain tasks. An interesting pattern in the original observations is that some models fail more often on seemingly simple integer inputs while performing adequately in complex scenarios. This contrast between simple inputs and complex failures is usually not a knowledge gap but a problem of attention allocation and self-verification.

    From an engineering perspective, model failures can be grouped into three categories:

    • Knowledge failures: missing facts or domain common sense;
    • Reasoning failures: dropping constraints, duplicate counting, or state backtracking errors under multi-step conditions;
    • Execution failures: code runs but interaction logic is wrong, such as inverted direction mapping or missing event bindings.

    The value of evaluation is turning a “feels usable” impression into quantifiable, reproducible, and attributable conclusions.

    2. Evaluation Design Principles: Tasks Must Expose Weaknesses

    High-quality evaluation tasks should meet four conditions: explicit constraints, traceable state, automatically verifiable results, and locatable failures. Two complementary task types can be constructed accordingly.

    2.1 Constraint Satisfaction: A Multi-Role River Crossing Problem

    This type of puzzle is essentially a state-space search with capacity constraints and conflict constraints. The key is whether the model maintains “state consistency” without external tools. Constraints can be formalized to help the model self-check:

    1. State: (left bank set, right bank set, boat position)
    2. Capacity: at most 2 people per trip
    3. Rowing permission: only 3 adult roles can row
    4. Conflict constraints:
    5. If mother and daughters are on the same bank without father -> violation
    6. If father and sons are on the same bank without mother -> violation
    7. If dog and people are on the same bank without grandmother -> violation
    8. Goal: all safely on the right bank

    Scoring can use an “all-or-nothing” judgment, with success rate and average time recorded across multiple runs. Success rate reflects stability better than a single result.

    2.2 Execution: A Single-File 3D Interactive Application

    The requirement is to generate a runnable interactive 3D scene in a single HTML file, including terrain and vegetation generation, character movement and jumping, block placement and destruction, creatures, and day/night cycles. This task assesses综合 capability: instruction following, module organization, rendering and input handling, and performance awareness.

    Scoring dimensions can be broken down as follows:

    Dimension Observation Point
    Runnability Opens and renders directly
    Instruction Following Covers all explicit requirements
    Interaction Correctness Movement direction, jumping, flying, camera view
    Visual Quality Pixel style, textures, lighting
    World Scale Supports chunked infinite terrain
    Performance Design Considers loading and recycling strategy

    3. Typical Failure Modes and Root Causes

    In interactive generation tasks, frequent issues include inverted forward/backward direction mapping, unbound jump events, missing flight toggles, insufficient texture and lighting depth, and terrain generation without chunking and recycling that causes lag. Root-cause analysis reveals a common trait: models tend to satisfy “looks right” first and “plays right” later, paying insufficient attention to invisible correctness such as input mapping and state machines.

    In logical reasoning tasks, failures often appear as omitting conditions like “the dog will bite people when grandmother is absent,” or repeatedly counting already-transported roles during backtracking, leading to redundant steps or conflicts.

    4. Prompt and Engineering Optimization Strategies

    Optimization should not rely on “trying a bit harder” but on structured prompts that constrain output:

    1. Model before answering: require listing states, constraints, and goals before steps;
    2. Force self-checking: verify conflict constraints after each step and output the check result;
    3. Layered implementation: rendering and input first, then terrain and interaction, then performance optimization;
    4. Explicit mapping table: write key-to-action mappings as a table to reduce direction inversions;
    5. Performance budget: specify chunk loading radius, generation, and recycling strategy.

    Example prompt structure:

    1. Please output in the following order:
    2. 1) Formalized states and constraints
    3. 2) Step-by-step solution (with conflict check per step)
    4. 3) Code implementation (single file)
    5. 4) Self-check list: direction mapping/jump/place and break/performance

    5. A Reusable Evaluation Loop

    It is recommended to make evaluation a loop: fixed task set, multiple runs, automatic judgment, archived failure samples, prompt iteration, and regression verification. For code tasks, add a “second optimization round” to observe whether the model can precisely fix issues based on feedback rather than rewriting and regressing. For reasoning tasks, distinguish between “with tools” and “without tools” conditions to avoid mistaking retrieval ability for reasoning ability.

    6. Conclusion

    Evaluating large language models should shift from single-point impressions to “stability plus attributability.” Constraint satisfaction tasks test planning and self-checking; interactive generation tasks test engineering completeness. Combining both, with metrics such as multi-run success rate, failure type distribution, and second-round fix capability, produces selection and optimization guidance that is genuinely useful for developers.