Evaluating Chinese LLMs for Code Generation: Lessons from an RTL Benchmark
An RTL code generation benchmark of four Chinese-developed large language models highlights the gap between compilable code and correct hardware behavior. Its findings offer practical guidance on evaluating timing and protocol accuracy, consistency on basic tasks, and the trade-offs between correctness, cost, and execution time.
1. Why This Benchmark Matters
For many developers, AI code generation means producing a Python script or a frontend page. These tasks have abundant training examples and often tolerate mistakes that can be corrected during development. Many models perform reasonably well on them.
Hardware description languages such as Verilog and VHDL present a different challenge. Generating register-transfer level (RTL) code requires precise reasoning about timing, protocols, and state machines. A single incorrect line can change hardware behavior, and the resulting problem may not be easy to resolve through routine debugging.
A recent RTL code generation benchmark evaluated four Chinese-developed large language models on 155 problems. The results showed a clear performance gap: the leading model missed only 11 problems, the runner-up trailed by roughly nine percentage points, and the remaining two models scored between 77% and 81%.
The ranking is less important than the patterns behind it. Those patterns provide useful lessons for developers choosing a model for coding tasks.
2. Four Key Findings
2.1 Precise Timing and Protocol Details Expose Shared Weaknesses
All four models struggled with tasks involving UART/PS2 communication, a 12-hour BCD clock, and Lemmings state machines. These tasks share demanding correctness requirements:
- UART/PS2 implementations: Models must follow the relevant timing requirements and start-bit, stop-bit, and parity rules. Timing errors can cause communication failures.
- BCD clocks: Cascaded carry logic and 12-hour rollover behavior create numerous boundary conditions.
- Complex state machines: Large state-transition diagrams require complete coverage of transition conditions. Missing a condition can produce a serious functional defect.
These failures suggest a shared weakness in tasks that combine detailed specification knowledge with strict temporal reasoning.
The lesson extends beyond RTL generation. Developers should apply similar scrutiny to code that depends on timing, protocol rules, or byte order, including network protocol stacks and drivers.
2.2 Reliability on Basic Tasks Matters More Than Isolated Success on Hard Problems
The lower-ranked models did not lose points only on difficult problems. They also made mistakes in basic register and combinational logic implementations.
This finding has a direct parallel in general-purpose programming. A model’s coding ability should not be judged solely by whether it can solve a LeetCode Hard problem. Its correctness when generating a simple CRUD operation or utility function matters just as much.
Consistent performance on basic implementations is a major factor in day-to-day usability. If a model makes elementary mistakes in two or three out of every ten generations, the effort required to review and repair its output can outweigh the benefits of its occasional success on difficult tasks.
2.3 Compilation Is the Baseline; Correctness Is the Differentiator
All 155 code submissions from each model passed compilation. However, the evaluation allowed models to use compilation checks and fix errors before submitting their answers. This does not mean every initial generation compiled successfully.
Even with that qualification, the central lesson remains: code that compiles is not necessarily code that behaves correctly.
For model selection, compilation or successful execution alone is an inadequate measure. Evaluation suites need test cases that verify intended behavior and explicitly cover boundary conditions.
2.4 Higher Cost Does Not Necessarily Mean Better Value
The reported cost and timing comparisons also showed substantial differences.
Using the most expensive model as the 1.0× cost baseline, that model took approximately 90 minutes. A model costing about 0.5× completed two problem sets in 22 minutes and achieved 83.87%, close to the roughly 85% top score reported in that comparison. Another model cost approximately 0.8× and took 55 minutes. A model accessed through a free channel was interrupted by rate limits, preventing complete statistics.
These figures illustrate why model selection is a multi-objective optimization problem. Accuracy, invocation cost, and end-to-end completion time all matter.
For high-volume workflows such as batch code generation and CI integration, a mid-tier model may offer better value. Flagship models are more appropriate when the value or complexity of the task—such as architecture design or complex algorithms—justifies their additional cost.
3. A Practical Evaluation Framework for Developers
The findings suggest four principles for building an evaluation suite tailored to your workload.
Organize problems by difficulty and capability.
Separate foundational tasks involving variables, logic, and data structures from intermediate tasks such as state machines and protocol parsing, and from system-level tasks requiring coordination across modules. Report correctness for each tier rather than relying only on an overall score.Use behavioral tests, not compilation, to determine success.
Prepare automated tests for every problem, including boundary conditions. This avoids treating “it runs” as equivalent to “it is correct.”Measure cost and completion time.
Use a consistent basis for token consumption and record end-to-end elapsed time. Calculate the cost per correctly solved problem, considering time alongside monetary cost when assessing value.Check whether failures are consistent.
Run the same problem multiple times. Consistent failures suggest a capability boundary that prompt engineering may help address. Intermittent failures indicate a greater reliability risk, even when the model sometimes produces a correct answer.
4. Conclusion
Chinese-developed LLMs have demonstrated substantial code generation capability, including in demanding domains that require high precision. The gap between leading models and their competitors is also changing rapidly.
There is no universally best model. The right choice depends on the tasks you need to solve, your budget, and your reliability requirements.
Rather than choosing solely by leaderboard position, build an evaluation process that reflects your own engineering workload. Measure behavioral correctness, consistency, cost, and completion time—and use those results to guide model selection.
