LLM Evaluation in Practice: Comparing Text Generation, Coding, and Reasoning
A practical framework for evaluating large language models across Chinese-language understanding, code generation, and mathematical reasoning. Using anonymized model comparisons, user preference results, and a Python example, this article explains how standardized prompts, blind testing, and failure scenarios can support more informed model selection.
As the large language model ecosystem expands, developers and businesses face a growing challenge: choosing the right model for their applications. Vendor-reported benchmark scores alone cannot establish how a model will perform in a specific business context.
To make comparisons more accessible, this article sets aside brand identities and focuses on underlying technical capabilities. It presents a standardized evaluation approach covering Chinese-language understanding, code generation, and logical reasoning, with an emphasis on practical performance rather than marketing claims.
1. Core Evaluation Dimensions and Baseline Design
Before comparing models, define the capabilities that matter to the intended application. Key dimensions include:
- Long-context processing: The maximum number of tokens a model can accept and meaningfully process affects the feasibility of tasks such as summarizing lengthy documents and refactoring code across a repository.
- Multimodal support: Native support for images, audio, and other non-text inputs influences whether a model can handle more complex interactions.
- Chinese-language semantic understanding: Accurate interpretation of Chinese context, cultural references, idioms, and colloquial expressions is essential for applications serving Chinese-speaking users.
- Software engineering capability: Useful code generation requires more than runnable output. Exception handling, defensive programming, and sound engineering practices also matter.
In practical testing, a unified API gateway or an enterprise model platform, such as Baidu AI Cloud’s Qianfan platform, can provide a consistent way to invoke different models. Keeping the network environment and system prompts consistent helps reduce environmental differences that could distort the comparison.
2. Evaluating Chinese-Language Understanding and Writing
Test task: Write a short essay in Chinese about AI ethics, approximately 500 Chinese characters long, with a clear position.
For this comparison, two mainstream models are anonymized as Model A and Model B.
- Model A: The essay had a complete structure and drew extensively on classical Chinese and Western philosophical perspectives. Its language was fluent, but some terminology was overly academic, making the text less accessible to non-specialists. This style may suggest an emphasis on academic material in its training data, although the output alone cannot establish that.
- Model B: The essay also had a clear structure and position, but used examples to introduce its arguments. Familiar scenarios, such as ethical dilemmas involving autonomous vehicles, made its discussion of AI ethics easier to follow.
Blind-test feedback: Among 10 participants, 60% preferred Model B and 40% preferred Model A.
These results suggest that audience awareness matters in user-facing text generation. Semantic coherence is necessary, but accessible language and relatable examples can also shape the user experience. The small sample offers useful feedback on this task, rather than a general ranking of the two models.
3. Testing Code Generation and Engineering Robustness
Test task: Write a Python script that extracts headlines from a public news website, handles network errors, and accounts for basic anti-scraping measures.
For developers, code generation is a major evaluation category. The question is not simply whether the generated code runs, but how well it handles conditions beyond the expected execution path.
- Model A: It generated a basic scraper using
requestsandBeautifulSoup, with detailed comments. Its error handling, however, was limited to a basictry-exceptblock for network timeouts, with little attention to anti-scraping restrictions. - Model B: Its code was more concise and showed stronger engineering awareness. It included retries with exponential backoff and a randomized
User-Agentpool intended to address basic request filtering. Its comments also suggested using Selenium or Playwright if the target website relied on dynamic rendering.
The following illustrative code shows Model B’s retry approach and randomized user-agent selection:
import requestsfrom bs4 import BeautifulSoupimport randomimport timefrom urllib.parse import urljoindef fetch_news_titles(base_url, max_retries=3):# Randomized User-Agent pool intended to address basic request filteringuser_agents = ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36...","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36..."]headers = {'User-Agent': random.choice(user_agents)}# Retry mechanism with exponential backofffor attempt in range(max_retries):try:response = requests.get(base_url, headers=headers, timeout=10)response.raise_for_status()soup = BeautifulSoup(response.text, 'html.parser')# Assume headlines appear in <h2 class="news-title"> elementstitles = [h2.get_text(strip=True) for h2 in soup.find_all('h2', class_='news-title')]return titlesexcept requests.RequestException as e:print(f"Attempt {attempt + 1} failed: {e}")if attempt < max_retries - 1:time.sleep(2 ** attempt) # Exponential backoffelse:raisereturn []
Execution and robustness: Both models produced code that ran successfully in the reported tests. Under simulated high-frequency scraping conditions involving anti-scraping responses, such as HTTP 403 errors, Model B’s retry and user-agent strategy was reported to be more robust and closer to practical development needs.
The example should nevertheless be read precisely: it selects one user agent before the retry loop, rather than rotating user agents between retries. It illustrates basic resilience features, not a guarantee that requests blocked by a website will succeed.
4. Evaluating Logical Reasoning and Mathematical Accuracy
Test task: “A swimming pool has an inlet pipe and an outlet pipe. The inlet alone fills the pool in 5 hours, while the outlet alone empties it in 8 hours. If both are open, how long will it take to fill the pool?”
This classic rate problem tests whether a model can maintain the correct direction of each operation and perform fractional arithmetic accurately. Two common errors are treating the outlet rate as positive and making mistakes when combining fractions.
The correct calculation is:
- Let the pool’s total capacity be 1.
- The inlet fills (1/5) of the pool per hour.
- The outlet drains (1/8) of the pool per hour.
With both pipes open, the net filling rate is:
[
\frac{1}{5} - \frac{1}{8}
= \frac{8}{40} - \frac{5}{40}
= \frac{3}{40}
]The time required to fill the pool is:
[
T = 1 \div \frac{3}{40}
= \frac{40}{3}\text{ hours}
]
The answer is 13 hours and 20 minutes.
A strong response provides both the correct result and a clear breakdown of the calculation. In this test, well-performing models correctly distinguished filling from draining and maintained accuracy when working with fractions and decimal representations.
Such a response demonstrates successful multistep calculation on this task; the final number alone provides less insight into where an incorrect response might have gone wrong.
5. Evaluation Methodology and Model Selection
The comparisons above point to a practical evaluation approach for developers and enterprise teams:
Standardize prompts. Build a shared test set and use a fixed system prompt so that instruction differences do not become a source of output variation.
Use blind testing and quantitative feedback. For subjective tasks, remove model names before asking participants to evaluate outputs. Preference counts and scores help reduce brand bias and make comparisons more explicit.
Test engineering weaknesses, not just the happy path. For code generation and tool use, deliberately introduce failure conditions, such as incomplete APIs or simulated network instability. Evaluate whether the model handles errors and applies defensive programming practices.
Coordinate multiple models through a shared platform. A single model may not lead across every capability. Enterprise platforms such as Baidu AI Cloud’s Qianfan platform can support access to multiple models through a unified gateway. Task-based routing can then direct complex mathematical reasoning to a model with stronger reasoning performance, while routine customer-service conversations go to a model that responds quickly and communicates clearly.
The goal is not to identify an abstract winner, but to match model strengths to application requirements.
Conclusion
LLM evaluation should extend beyond specification sheets and benchmark leaderboards. Standardized tests covering Chinese-language semantics, software engineering robustness, and logical reasoning provide a more useful view of practical capabilities.
By combining consistent prompts, anonymized human feedback, and deliberate failure testing, developers can make better-informed choices and select models that fit the work their applications actually need to perform.
