Open-Source LLM Evaluation in Practice: Code Generation and Logical Reasoning
This article evaluates several open- and closed-source large language models across code generation, visual rendering, and mathematical reasoning tasks. It examines how well models produce runnable game projects, maintain consistency across complex systems, follow compound constraints, and deliver stable answers across repeated reasoning attempts. The findings provide practical guidance for developers building model evaluation and selection frameworks.
1. Evaluation Background: From “Can Answer” to “Can Deliver”
Evaluating large language models has moved beyond a single metric such as answer accuracy. In real-world engineering scenarios, developers care more about whether a model can turn an instruction into a runnable, maintainable, and predictable result.
For example, when asked to “build an HTML fighting game,” a model must do more than generate syntactically valid code. The game should have a complete gameplay loop, correct rendering, and responsive interaction. Similarly, when solving mathematical logic problems, the model should not only produce the correct number but also remain consistent across multiple independent samples.
This article compares several mainstream open- and closed-source models through a set of carefully designed evaluation tasks. The tests cover three core dimensions: code generation, visual rendering, and logical reasoning. The goal is to provide a neutral reference for developers making technology and model-selection decisions.
2. Evaluation Scenarios and Task Levels
To expose both the strengths and weaknesses of different models, the evaluation tasks were divided into three progressive levels:
| Level | Task Type | Representative Scenario | Evaluation Focus |
|---|---|---|---|
| Level 1 | Instruction following and code generation | 2D HTML/JavaScript fighting game | Syntax correctness and logical completeness |
| Level 2 | Complex system construction and visual rendering | WebGL-based 3D sandbox game | System design and rendering-pipeline correctness |
| Level 3 | Mathematical logic and multi-step reasoning | Number theory, combinatorics, and geometry | Reasoning stability and numerical accuracy |
The underlying idea is that lower-level tasks test a model’s basic coding ability, while more advanced tasks examine abstract modeling and optimization under multiple constraints.
2.1 Scenario One: Generating a 2D Fighting Game
Custom evaluation prompt:
“Help me write an HTML fighting game. Characters should be able to block, perform normal attacks, double-jump, dodge, and use skills based on five elements: wind, earth, water, fire, and lightning. The game should include complete mechanics and enemy AI, have a scene, and use stick figures for the characters.”
This is a typical task with limited constraints and substantial room for creative implementation. It requires the model to understand and combine:
- A game state machine covering idle, attacking, defending, jumping, taking damage, and dying;
- Collision detection and interaction mapping from keyboard events to character actions;
- Enemy AI behavior, including pursuit, blocking, spell casting, and dodging;
- Particle effects and visual rendering for abilities.
Observed results:
- Model A, an open-weight model: Basic movement, jumping, and dodging worked correctly, and the AI did not remain idle. However, skill projectiles were not rendered, and the normal-attack hitbox did not align with its visual representation. This exposed a weakness in synchronizing physical logic with rendering: the underlying logic was partly correct, but event binding and animation timing were not aligned.
- Model B, a closed-source commercial model: The visual quality was clearly better than Model A. Skill effects were rendered effectively, and attack areas were relatively easy to understand. However, jumping failed completely. This suggests that while the model generated a polished presentation layer, it neglected the underlying physics engine, including gravity, jump height, and ground detection. The result was a mismatch between the visual layer and the gameplay logic.
Key observation: Models can often generate individual functional modules correctly. Problems appear when those modules must work together—for example, when rendering must remain synchronized with hit detection or when input must trigger coordinated state transitions. This is a common weakness in current code generation systems: local optimization can produce globally inconsistent behavior.
2.2 Scenario Two: A 3D Sandbox Game Clone
Evaluation prompt:
“Code a 3D Minecraft game clone within a single .html file. Make it beautiful, with pixel graphics like the original, add all main features of the game, terrain and tree generation, mobs, and a bunch of other stuff. Use three.js for the rendering to make things look nice.”
This task is significantly more difficult than text generation or the creation of a standalone script. It requires the model to:
- Integrate a WebGL-based 3D engine into a single file;
- Implement procedural terrain generation, including noise algorithms and lazy chunk loading;
- Design a player controller with camera movement, collision volumes, and block placement and destruction;
- Add mobs with basic AI and spawning logic.
Observed results:
- Model A: The generated code could run and render a scene, but camera sensitivity was abnormal, movement axes were seriously offset, and world-generation coordinates were inconsistent. The game was not playable, although it did produce visible output.
- Model B: Multiple attempts resulted in runtime crashes or a blank screen. In some cases, the browser reported errors before the game interface could load.
Key observation: When task scale and complexity exceed the average length of familiar code patterns in the model’s training data, maintaining global state consistency becomes difficult. Three-dimensional coordinate transformations, camera-matrix updates, and the integration of event and rendering loops directly test the model’s understanding of system architecture rather than syntax alone.
2.3 Scenario Three: Mathematical Logic and Multi-Step Reasoning
The mathematical tests covered the following problem types:
- Question 1: Negative square number: What is the smallest integer whose square is between 15 and 30?
Answer: -5 - Question 2: Permutations and combinations: Arrange the six numbers 2, 0, 1, 9, 20, and 19 in any order to form an eight-digit number, with 0 not allowed in the first position. How many distinct eight-digit numbers can be formed?
Answer: 498 - Question 3: Solid geometry and water displacement: A cube-shaped iron block with an edge length of 30 cm has a cube with an edge length of 10 cm removed from each of its eight corners. It is then placed into a container with a base area of 2,500 square centimeters and an initial water depth of 20 cm. What is the resulting water level?
Answer: 27 cm
Observed results across repeated samples:
| Model | Question 1 | Question 2, five samples | Question 3, five samples |
|---|---|---|---|
| Model A, open-weight | Correct | Correct in all five samples | Correct in all five samples |
| Model C, closed-source commercial | Incorrect | Correct in none of the samples | Not tested |
| Model D, deep-reasoning model | Not tested; reasoning was very slow | Correct once | Not tested |
| Model E, lightweight closed-source model | Correct | Correct in all five samples | Not tested |
| Model F, compact model | Correct | Correct twice | Not tested |
Key observations:
- Reasoning stability matters more than one-time accuracy. A model that produces the same correct answer across multiple independent samples is more likely to have structured logical understanding rather than having succeeded by chance.
- Speed and accuracy involve a clear trade-off. Although the deep-reasoning model showed some useful reasoning behavior on Question 2, it required a long time to respond, increasing the cost of production use. Lightweight open models were more stable on this type of problem, suggesting that a smaller model with targeted fine-tuning may outperform a general-purpose large model in a specific logical domain.
- Pure reasoning without tools remains important. None of the models used an external calculator or code interpreter. Their results therefore came entirely from internal semantic understanding and symbolic computation. The negative-square question in particular exposed a failure mode for several closed-source models.
3. A Multidimensional Comparison of Model Capabilities
3.1 Code Generation: The Gap Between Logic and Rendering
Based on the two game-development tasks, code-generation ability can be divided into four levels:
- Lexical level: Can the model produce valid, parseable code? Most current models can handle this level.
- Structural level: Can it organize modules such as input handling, the game loop, and AI updates? Most open-source models meet this standard in simpler scenarios.
- Semantic level: Do interactions between modules behave as intended? For example, does a jump trigger ground detection after the character lands, and does using a skill create a projectile entity? This is a major dividing line.
- Presentational level: Does the output provide attractive rendering, detailed effects, and a user-friendly interface? Closed-source commercial models are usually stronger in this area, but they may sacrifice important low-level logic.
In real engineering work, developers deliver product-level code rather than demos or toys. A model’s combined performance across all four levels is therefore more valuable than excellence in any single area.
3.2 Mathematical Reasoning: Symbolic Operations Versus Numerical Intuition
Questions 2 and 3 are typical examples of highly constrained combinatorics and physical water-displacement calculations. Solving them requires the model to:
- Identify repeated elements and combination constraints, including the relationships among 0, 1, 20, and 19;
- Build the correct counting model and subtract cases in which the first digit is zero;
- Visualize the geometry and correctly account for the displacement caused by the remaining volume after the corners are removed.
The strongest models did not appear to rely on memorized answers. Instead, they reached the results through internal symbolic reasoning. This helps explain why some smaller models fine-tuned for mathematics can be more reliable than general-purpose models: their supervised training places greater emphasis on symbolic manipulation.
3.3 Constraint Following and Prompt Robustness
In the 3D sandbox task, the prompt explicitly required the use of Three.js and a single HTML file. Nevertheless, both models ignored or failed to satisfy some of the constraints in their outputs.
This indicates that:
- Current models still struggle with compound constraints that combine format, technology-stack, and feature requirements;
- During long generations, models can experience attention decay and forget requirements stated earlier in the prompt.
A practical recommendation for developers is to break complex, multi-constraint requirements into smaller prompts. Generating the system step by step and assembling the results with human review is often more reliable than requesting a complete long-form implementation in one pass.
4. Practical Guidance for Building a Scientific Evaluation Framework
Based on these tests, developers should consider building an evaluation matrix with three horizontal and three vertical dimensions:
- Three horizontal dimensions: instruction adherence, code executability, and output stability;
- Three vertical dimensions: standalone scripts, system-level applications, and logical reasoning.
A practical implementation process includes:
- Define a baseline task set. Create a fixed regression suite of 10 to 20 representative scenarios so that each model iteration can be compared against the same tasks.
- Evaluate repeated samples. Run the same task at least five times and measure both the pass rate and the consistency of core outputs instead of recording only one response.
- Add compilation and static-analysis tools. Automatically check for undefined variables, invalid references, and other common code-generation problems.
- Include human evaluation. For difficult-to-quantify dimensions such as visual quality and UI design, use a small evaluation group and track average scores together with confidence intervals.
5. Conclusion: Open-Source Models Are Closing the Gap, but Engineering Maturity Still Matters
The evaluation suggests that open-weight models can match or even outperform some closed-source commercial models in mathematical reasoning and code logic generation. Their lightweight, fine-tuned variants were particularly impressive in the stability of multi-step mathematical reasoning.
However, all models showed clear weaknesses when generating complex system-level code or maintaining constraints over long contexts. The common pattern was essentially: a model can write what it can represent locally, but its output becomes unreliable when the required system-level relationships extend beyond that local view.
Developers should therefore avoid searching for a universally capable model. The right choice depends on the target task. Using evaluation data as the basis for selection and decomposing complex tasks into smaller steps can maximize model value while keeping costs under control.
As developers gain access to a broader range of models, the main competitive distinction will increasingly shift away from parameter count and toward evaluation systems that are stricter, more reproducible, and more representative of production environments.
