Evaluating LLM Coding Capabilities: Highlights and Hallucination Pitfalls

    This article evaluates the real-world coding capabilities of Large Language Models (LLMs) in large-scale project refactoring and creative algorithmic programming. It highlights their strengths in generating execution plans and visual algorithms, while identifying common pitfalls such as environment hallucinations, shotgun programming, and disconnects between chain-of-thought and output. The article also provides practical guidelines for building verification loops and effectively collaborating with coding LLMs.

    1. Why Re-evaluate Coding LLMs

    Over the past year or two, the capability boundaries of intelligent coding tools and LLMs have been heavily debated. Marketing materials often emphasize “complex effects” and “end-to-end delivery,” but in actual engineering environments, developers care more about whether the model can complete a large-scale change in an existing codebase and self-correct upon failure, rather than fabricating excuses. This article does not target any specific product but abstracts two typical evaluation scenarios: large-scale compiled project refactoring and creative visual/algorithmic programming, to discuss capability highlights and common pitfalls.

    2. Large-Scale Project Refactoring: Execution Plans and Verification Loops

    2.1 High-Quality Execution Plans as a Prerequisite

    When making structural changes in a large-scale compiled language project, the first step is not to have the model write code directly, but to produce a step-by-step, verifiable execution plan. An ideal plan should be detailed down to “what to change at each step, how to verify, and what the pass criteria are.” In practice, decomposing tasks into several independently verifiable steps significantly reduces the risk of losing control from a massive one-time change.

    2.2 Hallucination: Fabricating Non-Existent “Environment Failures”

    The most typical failure mode in evaluations is when the model, failing to compile, fabricates a non-existent environmental excuse. For instance, it might claim that “the build cache is corrupted, causing compilation to fail” and suggest clearing the cache. When compilation still fails after clearing, it repeatedly emphasizes that “the cache issue is so severe it cannot work,” shifting the blame to the environment rather than its own code.

    The danger of this “environmental hallucination” is that it transforms an issue that should be fixed by reading error messages and locating syntax or type errors into a troubleshooting session for a non-existent failure, consuming significant time with zero progress. The basis for judgment is simple—compiler error messages are deterministic, and any excuse about “cache corruption” should be required to be verified against actual error logs.

    2.3 Anti-Pattern: Shotgun Programming

    When required to “write the code correctly and pass tests before continuing,” another typical failure is shotgun patching: changing a line here, tweaking something there, lacking root cause analysis. The volume of changes rapidly expands to hundreds or thousands of lines, yet it still fails to compile. The essence of this behavior is the absence of a converging “hypothesis-verification” process, replacing logical reasoning with random perturbations.

    In contrast, a better approach is: first explain the root cause of a problem, make a minimal change, recompile and test, and only proceed to the next step after passing. Whether the model possesses this closed-loop awareness is an important indicator distinguishing usable from unusable.

    2.4 Practical Template for Enforcing Verification Loops

    To constrain model behavior, explicit verification checkpoints can be integrated into the workflow, as shown below:

    1. for step in plan.steps:
    2. result = agent.apply(step)
    3. build = run_build() # Compilation must succeed
    4. if not build.ok:
    5. agent.must_fix(build.errors) # Only allow fixing based on real errors
    6. continue
    7. test = run_tests() # Tests must pass
    8. if not test.ok:
    9. agent.must_fix(test.failures)
    10. continue
    11. commit(step) # Only allowed to proceed after passing

    There are three key constraints: prohibiting unfounded environmental attribution, limiting the scope of single-step changes, and no advancement without passing verification. In engineering, pipelines and logging services can be used to record each build and test result, paired with monitoring alerts, allowing humans to intervene promptly when the model is “spinning its wheels.”

    3. Creative Visual and Algorithmic Programming: Highlights and Lack of Common Sense

    The second category of evaluation focuses on “generating interactive visual and algorithmic demonstrations,” which further exposes the model’s shortcomings in common sense and physical intuition.

    • Sliding Puzzle Tasks: Most models can arrange the blocks neatly with a basically correct layout. However, if the chain-of-thought claims to present a specific artistic style but the final product completely lacks the corresponding effect, this is a hallucination of inconsistency between chain-of-thought and the product—the intent at the language level did not translate into implementation.
    • 3D Physics Simulation (e.g., ball rolling to hit pins): With general web 3D rendering capabilities, it can run, but a common problem is physics layouts violating common sense, such as pins being spaced too far apart to be knocked down in one hit, or the interface being too dark to observe. This shows the model can generate code that “looks right” but lacks validation against real-world constraints.
    • Maze Reinforcement Learning (Q-learning): This is the task that creates the widest gap. An ideal product should correctly render the maze, align the agent’s action layer with the terrain layer, and show converging training curves. Common failures in testing include: abnormal agent size, unrendered maze, failure to run, and misalignment between actions and terrain. It is worth noting that a few attempts successfully visualized Q-values onto the ground and achieved training convergence, which is not easy among similar attempts.

    The core update logic of Q-learning itself is not complicated, as shown below:

    1. Q[s][a] += alpha * (reward + gamma * max(Q[s2].values()) - Q[s][a])

    The difficulty lies not in the formula, but in engineering details like state encoding, action and coordinate alignment, and termination conditions. Whether the model converges depends on whether it handles these details correctly, not whether it has memorized the formula.

    4. How to Scientifically Evaluate and Use Coding LLMs

    Based on the above observations, here are a few reusable recommendations:

    1. Use verifiable tasks as the benchmark: Prioritize objective metrics like “can it compile, can it pass tests, can it converge,” rather than visual spectacles.
    2. Enforce closed loops, reject excuses: Require any environmental attribution to be backed by real error logs; no advancement to the next step without passing verification.
    3. Limit change granularity: Encourage minimal changes and root cause analysis, curbing shotgun patching.
    4. Beware of chain-of-thought hallucinations: Cross-check language-level intent with the final product; do not declare success just because the description sounds beautiful.
    5. Human-machine collaboration fallback: Leverage logs, monitoring, and pipelines to quickly take over when the model gets stuck in a loop.

    5. Conclusion

    The value of coding LLMs lies not in how flashy the demo effects are, but in whether they can stably “do the job right step-by-step” in real engineering. For developers, establishing a verification-centric evaluation and collaboration process is far more important than chasing a single metric. When elastic computing power and engineering support are needed, utilizing general containers, pipelines, and monitoring capabilities provided by cloud platforms like Baidu AI Cloud can help this verification loop land more robustly.