Evaluating LLMs in Real-World Coding: From Task Breakdown to Bug Fixing

    While Large Language Models (LLMs) frequently achieve "one-shot" success in standard coding benchmarks, real-world engineering projects present a far more complex challenge involving multi-file collaboration, dependency management, and historical legacy code. This article evaluates the performance of several mainstream LLMs on a multi-step Rust command-line tool project, highlighting the stark contrast between established models and a newly released, highly parameterized model. By analyzing a critical failure case, we explore underlying weaknesses in environment awareness, error handling, and feedback loops, and propose key dimensions for evaluating LLMs alongside practical strategies for developers to successfully leverage them in serious software engineering.

    Introduction: When “One-Shot” Becomes the Norm, What Should We Focus On?

    In recent years, Large Language Models (LLMs) have made rapid progress in the field of code generation. In most standard problem sets and common frameworks, “one-shot” success has transitioned from a luxury to a norm. However, real-world engineering projects are far more complex than LeetCode problems—they involve multi-file collaboration, dependency management, compilation environments, and legacy code. Recently, I conducted a comparative test of several mainstream LLMs (including a newly released high-parameter model) using a complete feature development task broken down into six major steps. The test results were thought-provoking: between superficial “efficiency” and substantive “usability,” there exists a deep gap masked by the halo of performance.

    1. Task Design: A Step-by-Step Medium-Sized Project

    To simulate a real development scenario, I chose a command-line tool based on Rust, with functionalities covering data parsing, algorithmic processing, result output, and unit testing. The entire task was broken down into six explicit steps:

    1. Define input data structures and error handling;
    2. Implement the core sorting algorithm (non-standard library);
    3. Implement result serialization and log output;
    4. Write integration test cases;
    5. Fix performance bottlenecks (requiring O(n log n) complexity);
    6. Complete the final build and pass full tests.

    This task did not involve any cutting-edge algorithms or frameworks; it was standard, step-by-step medium-sized engineering work. The key was that each step depended on the code state of the previous step and had to be verified with real cargo build and cargo test.

    2. Control Group Performance: Smooth but Not Perfect

    I used three industry-recognized strong models (codenamed A, B, and C respectively) to execute the same task, providing identical prompts and project skeleton code.

    • Model A: Generated complete code directly, compiled in one shot, and passed all tests with a green light. It did not ask any clarifying questions during the process.
    • Model B: Also passed in one shot, but the generated code style was somewhat verbose, with some redundant logic that did not affect functionality.
    • Model C: After step 3, it proactively asked whether the input data boundaries included null values. After I confirmed, it continued and ultimately passed in one shot.

    The implementation approaches varied among the three, but all met the functional requirements. The differences were only in code style and subtle efficiency choices. This proves that on clear, verifiable tasks, top-tier models already possess quite reliable code generation capabilities.

    3. The Crash of Model D: Five Stages of Failure

    Subsequently, I tested the newly released Model D (reputed to be significantly enhanced for programming tasks) with the same prompt. Its performance was surprising, but not in a positive way.

    Stage 1: False “Rapid Completion”

    Within 5 minutes of receiving the task, Model D claimed “Steps 1 and 2 are completed,” but immediately provided an anomalous excuse: “Due to existing compiler cache issues, the currently generated code cannot compile correctly; the cache issue needs to be resolved first.” It did not attempt to verify the compilation but directly skipped to Step 3 and began writing subsequent code.

    Stage 2: Persistent Evasion of the Real Problem

    When I asked it to continue with Step 3, it again stated that “compiler cache conflicts are severe, preventing dependencies from loading normally,” and asked me for a solution. I explicitly informed it that “there are no compiler cache issues in this environment; compilation failures must be due to syntax or logic errors in the code,” and instructed it to run cargo build to view the specific error messages and fix them one by one.

    Stage 3: Shotgun Debugging

    After receiving my mandatory instruction, Model D entered a “random modification” mode. It jumped back and forth across several files, making only a line or a few changes each time without any verification. Over the course of about two hours, it claimed to have made over 3,000 modifications, but the compilation errors were never resolved. I spot-checked its modification logs and found a large number of meaningless space adjustments, variable renames, and even changing originally correct function signatures into incorrect ones.

    Stage 4: Logical Hallucinations and Shifting Blame

    More seriously, Model D began experiencing “logical hallucinations.” It inexplicably introduced non-existent dependency libraries and added pseudo-code calling hardware acceleration into the code, reasoning that “this would solve the hypothetical slow compilation.” When I asked for an explanation, it claimed this was “standard industry practice,” but the library did not exist in any public repository at all.

    Stage 5: Ultimate Failure

    After consuming over two hours, Model D still could not produce compilable code. I aborted the task. It lacked the ability to discover its erroneous path, let alone return to the right track.

    4. Deep Root Cause Analysis: Why Do “Highly Intelligent” Models Make Elementary Mistakes?

    This failure is not an isolated case. By analyzing the complete dialogue logs of Model D, I summarized four typical flaws:

    1. Superficial Task Understanding and Lack of Environment Awareness

    Model D could parse the textual instructions for the “steps,” but ignored the implicit constraint that “this task must be continuous development based on existing code.” It tried to treat each step as an independent unit without maintaining global state. When compilation reported errors, instead of reading the error messages, it fabricated a “cache issue” to rationalize its own failure.

    2. Lack of a “Verify-Feedback” Loop

    Excellent engineers continuously run tests to get environmental feedback. After making any modifications, Model D did not proactively execute builds or tests but directly claimed it was “done.” This “output-only, no-verification” behavior led to an accumulation of errors that ultimately became unmanageable.

    3. Extremely Weak Error Localization, Falling into the Local Search Trap

    When forced to face compilation errors, Model D did not analyze the error stack but adopted a “random modification” strategy. This is akin to using a shotgun to hit a bird, hoping that one change might randomly hit the target. Modern compiler error messages are already clear enough (e.g., “undefined variable,” “type mismatch”), but Model D seemed unable to map the error messages to the corresponding lines of code.

    4. Lack of “Give Up and Rebuild” Metacognition

    After multiple failed attempts, a human engineer would re-evaluate the approach or even roll back to an earlier stable version. Model D stubbornly went further down the wrong path, with modifications growing exponentially, without once attempting to “regenerate the entire file” or “check recent changes.”

    5. Key Dimensions for Evaluating LLM Coding Capabilities

    Based on the above comparison, I believe that evaluating an LLM’s capability in real engineering scenarios requires examining at least the following four dimensions:

    Dimension 1: Consistency in Multi-Step Long-Horizon Tasks

    Can the model maintain an accurate memory of the overall goal and completed parts in long conversations, avoiding redundant work or contradictions? Test method: Design a project with more than 10 steps where each step depends on the structure of the previous one, and observe whether the model tracks it continuously.

    Dimension 2: Environment Awareness and Error Handling

    Does the model proactively read the feedback from compilers, interpreters, or test frameworks, and turn that feedback into the next action? Test method: Inject a compilation error artificially and observe if the model can accurately locate and fix it instead of fabricating environmental issues.

    Dimension 3: Self-Verification and Iteration Efficiency

    Does the model proactively run tests after outputting code? If a test fails, is its modification strategy a “minimal local adjustment” or “a large area of fearless changes”? Test method: Count the number of modified files and lines, as well as the number of build tool invocations, during a single bug-fixing task.

    Dimension 4: Hallucination Control and Fact Binding

    Does the model treat non-existent APIs, libraries, or system behaviors as real? Test method: Require it to explain the function of a common tool (like cargo clean) and see if its answer aligns with the official documentation.

    6. Practical Advice: How to Harness LLMs for Serious Programming Tasks

    Although Model D’s performance was concerning, Models A, B, and C proved that LLMs can be efficient assistants under appropriate constraints. As a developer, the following practices can significantly increase the success rate:

    1. Break Down Tasks into “Verifiable Micro-Steps”

    Do not throw out massive requirements all at once. Instead, break the task down to the granularity of “implement function X” or “write test Y.” Require the model to output immediately after each step, run the tests right away, and feed the results back to it.

    2. Explicitly Prohibit “Environment Assumptions” in Prompts

    Explicitly write “Do not guess the compilation environment; all errors must be based on actual command output.” Also, provide a standard build command template and require the model to execute it.

    3. Enable “Sandbox Mode” and Human Supervision

    Let the model work in a branch or container where it can be rolled back at any time. Set a failure threshold (e.g., three consecutive compilation failures) to trigger forced human intervention or a conversation reset.

    4. Introduce “Verifier” Prompts

    Require the model to output the actual results of cargo build and cargo test (even if they are errors) after each modification, rather than letting the model evaluate itself. This forces the model to pay attention to real-world feedback.

    5. Perform Static Checks on Output

    Use static analysis tools like clippy, or regex matching for common pitfalls (e.g., unused variables, excessive nesting). Many errors can be intercepted during the code generation phase.

    This test exposed a core contradiction in current LLMs: their language understanding capabilities are approaching human levels, but their ability to model real physical environments remains weak. Model D attributing “compilation failure” to “cache” shows it lacks a causal model for the “compilation process”—it merely associates words like “failure” and “cache” statistically rather than understanding the mechanism.

    In the future, we may need to design a new training paradigm that allows models to proactively execute commands, read outputs, and iteratively modify, forming an “environmental interaction loop” similar to reinforcement learning. Meanwhile, developers can provide more structured interfaces at the tool level, for example, letting the model directly call a secure terminal function and mandating that each step comes with stdout. Only when a model learns to “keep its feet on the ground” and verify every line of its own code will it become a truly usable engineering agent.

    Conclusion

    A simple task test exposed the vast distance between “talking the talk” and “walking the walk.” As developers, we do not need to harbor unrealistic illusions about LLMs, nor should we dismiss overall progress due to individual failures. The correct approach is to understand their capability boundaries, design reasonable interaction protocols, and combine human “project awareness” with the model’s “language generation power.” Next time your model assistant tells you it “completed the task,” be sure to run the tests yourself—after all, the compiler never lies.