Open-Source vs. Closed-Source LLMs: Evaluating Three Core Capabilities
This article explains why anecdotal chatbot comparisons are unreliable and presents a reproducible framework for comparing open-source and closed-source LLMs across code generation, long-context understanding, and tool calling. It covers fixed inputs and sampling parameters, repeated runs, blind scoring, a sample evaluation harness, a composite web-animation-to-video task with automated frame validation, common interpretation pitfalls, and how to turn evaluation results into model-selection decisions.
Why Subjective Experience Is Not Enough
When evaluating LLMs, many people rely on the intuitive impression from a few conversations. This approach is easily affected by prompt wording, randomness in a single generation, and personal usage habits. The same question phrased differently can produce a completely different result. Before comparing two models, therefore, the comparison conditions need to be fixed: identical input content, identical generation parameters, pre-agreed judging criteria, and multiple repetitions per task with statistical results.
Evaluation Framework: Three Core Capabilities
Code Generation
Code generation capability is usually reflected at three levels: whether the model can understand a requirement and provide a runnable implementation; whether it can make local modifications to existing code without breaking other logic; and whether it can locate and fix errors. Evaluation should use automatically executable tests, such as unit tests or output comparisons, rather than only checking whether the code “looks reasonable.”
Long-Context Understanding
Long-context understanding focuses on the model’s ability to retrieve, reason over, and summarize information in a longer context. Typical tests include embedding several key facts in a long document and requiring the model to extract them one by one, or asking the model to compare whether two statements across paragraphs are consistent. Evaluation results should record both accuracy and missed-answer rate, because in long-context scenarios omissions are often harder to notice than errors.
Tool Calling
Tool calling means that the model selects the appropriate function according to task needs, generates parameters in the required format, and correctly handles returned results. Evaluation focuses on three points: whether function selection is correct, whether parameter format conforms to the interface definition, and whether state remains consistent across multi-step calls. This capability is especially critical for building automated workflows, because a single parameter-format error can cause the entire chain to fail.
Building a Consistent Evaluation Environment
The core principle of an evaluation environment is reproducibility. Specifically, this can be approached from the following aspects:
- Fixed inputs: each group of test cases uses the same text, code, and instructions.
- Fixed parameters: sampling parameters such as temperature and maximum output length remain consistent, and are noted in the report.
- Multiple runs: the same test case is run at least several times, recording success rate and fluctuation range.
- Blind evaluation: scorers do not know which model produced a result, reducing subjective preference.
Below is illustrative code for an evaluation workflow. The model-calling part is replaced by a placeholder function and should be replaced with the corresponding interface in actual integration:
def run_suite(models, cases, runs=5):report = {}for name in models:scores = []for case in cases:passed = 0for _ in range(runs):output = call_model(name, case["prompt"], temperature=0.2)if case["check"](output):passed += 1scores.append(passed / runs)report[name] = sum(scores) / len(scores)return report
Here, check is the judging function included with each test case, such as running unit tests, comparing structured output, or matching key facts. The quality of the judging function directly determines the credibility of the evaluation, so priority should be given to designing it carefully.
Composite Scenario Example: Generating Video with Web Technologies
Beyond single-capability tests, a composite task can be designed to examine how a model performs in real engineering work. One feasible approach is to have the model write an animation with shot transitions and text effects using web technologies (HTML, CSS, and JavaScript), then have a headless browser render it frame by frame and export a video. This task involves code generation, structured output, and multi-step execution at the same time, making it suitable as a composite comparison task.
Validation also needs to be automated. The specific approach is as follows:
- Use a headless browser to capture the page at a specified frame number (for example, frame 150).
- Read the same frame from the exported video.
- Calculate the pixel difference between the two images; if the difference exceeds the threshold, it is judged as a dropped frame or rendering inconsistency.
The threshold needs to be recalibrated according to image complexity and compression parameters, and a fixed value cannot be applied directly. The value of this step is that it turns “whether it looks right” into numbers that can be recorded and compared.
Common Pitfalls in Interpreting Results
First, when success rates are close, a conclusion should not be drawn directly. The stability of the difference should be judged together with sample size and fluctuation range. Second, the same task may perform very differently under different prompt templates, so the complete prompts need to be included in the report. Third, model versions are updated frequently, so conclusions are time-sensitive; test dates and version information should be recorded. Fourth, open-source models can be deployed locally, but deployment method, hardware, and inference framework also affect latency and output quality. When comparing, a distinction should be made between “model capability” and “deployment effect.”
From Evaluation Results to Model Selection
The ultimate purpose of evaluation is to support decisions. The following process is recommended: first determine weights according to business scenarios, for example, whether code-related tasks should carry more weight or long-document processing is more important; then use a unified test set to obtain scores for each capability; then make a comprehensive judgment based on cost, data security requirements, controllability, and maintenance difficulty. For scenarios that are data-sensitive or require private deployment, the controllability of open-source models is often an important advantage. For scenarios that pursue the highest general capability and can accept external calls, closed-source models may still be more suitable. The two types of models are not in a simple relationship of better versus worse; they suit different scenarios.
During continuous use, it is recommended to rerun the evaluation set regularly and include the results in version management. This helps identify capability drift caused by model upgrades or business changes in a timely manner, so that selection conclusions are always based on the latest data.
