Measuring Capability Gaps in Large Language Models: Evaluation Systems and Distillation Compliance Essentials

    This article addresses the challenge of measuring performance differences between large language models (LLMs), explaining why single benchmark scores are inadequate and how to build reproducible evaluation systems with confidence intervals. It also covers data contamination prevention, the principles of knowledge distillation and anti-distillation, compliance checklists for using model outputs in training, and practical evaluation guidelines for coding agents. A final checklist helps engineering teams make model selection decisions based on reliable evidence rather than leaderboard rankings.

    Why Capability Gaps Are Hard to Measure

    Two opposing views often appear in industry discussions. One holds that open-weight models are rapidly approaching closed-source frontier models; the other argues the gap is widening. Both sides frequently cite the same public leaderboards yet reach opposite conclusions. The reason is that a single benchmark score is only a point-in-time observation. Question distribution, prompt templates, decoding parameters, evaluation versions, and training data leakage can all shift the score.

    Therefore, before discussing gaps, one must answer three questions: Which capability does the gap refer to, what metric is used, and does the sample size support the conclusion? Engineering teams that select models purely by leaderboard rank often find that real-world performance does not match expectations.

    Building a Reproducible Evaluation System

    Splitting Capability Dimensions by Task Type

    General question answering, mathematical reasoning, code generation, long-context comprehension, tool calling, and multi-step agent tasks exercise different abilities. A model that leads in Q&A may not lead in multi-step code repair. It is recommended to define dimensions according to actual business tasks and score each dimension separately. A weighted total score can hide weaknesses and should not serve as the sole criterion.

    Confidence Intervals and Statistical Reporting

    For binary pass/fail results, the sample size determines the variability of the result. With 100 tasks and a pass rate of 65%, the 95% confidence interval is roughly 55% to 74%, with a half-width of about 9 percentage points. If two models differ by only three or four percentage points, such a sample cannot prove which one is better.

    The following code uses the bootstrap method to estimate the confidence interval of the pass rate:

    1. import random
    2. def bootstrap_ci(results, n_iter=2000, alpha=0.05, seed=42):
    3. """results is a list of 0/1 values, where 1 means the task passed.
    4. Returns the pass rate and confidence interval.
    5. Assumes tasks are independent and identically distributed.
    6. Percentile intervals are narrow for very small samples; cross-check with Wilson interval."""
    7. if not results:
    8. raise ValueError("results is empty; cannot compute confidence interval")
    9. rng = random.Random(seed)
    10. n = len(results)
    11. means = []
    12. for _ in range(n_iter):
    13. sample = [results[rng.randrange(n)] for _ in range(n)]
    14. means.append(sum(sample) / n)
    15. means.sort()
    16. low = means[int(n_iter * alpha / 2)]
    17. high = means[int(n_iter * (1 - alpha / 2)) - 1]
    18. return sum(results) / n, (low, high)

    Before using this code, three points must be confirmed. First, the result list must not be empty. Second, for very small samples, use the Wilson interval to cross-check. Third, if the same question is sampled multiple times, the statistical unit should be the question, not the number of calls, to avoid overestimating the sample size.

    Use a fixed template when reporting results. Each item must state:

    • Task dimension and task version number
    • Sample size (number of questions)
    • Pass rate and 95% confidence interval
    • Difference between two models and the confidence interval of that difference
    • Conclusion: if the interval for the difference contains 0, state “difference is not significant”

    Example: Two models achieve pass rates of 65% and 68% on 100 tasks each. The difference is 3 percentage points, and the 95% confidence interval for the difference is roughly ±13 percentage points, crossing zero. The conclusion is that the difference is not significant. Even if each group is enlarged to 400 tasks, the interval for the difference remains about ±6.5 percentage points, still crossing zero.

    Preventing Data Contamination and Building Private Evaluation Sets

    Public benchmark questions may already be part of training data, causing inflated scores. Common practices include the following.

    1. Determine the source of questions. Prefer real business tickets, anonymized historical cases, and team-authored questions.
    2. Anonymize and restrict access. Remove personal information and business secrets; limit access to evaluation leads and necessary members.
    3. Version control. Assign a version number to each question set, recording additions, removals, and answer updates.
    4. Update cycle. Replace a portion of questions quarterly while retaining a fixed portion for longitudinal comparison.
    5. Leakage check. Verify whether questions appear on public web pages, open-source repositories, or known training corpora.
    6. Equivalent rewriting validation. Rewrite public questions equivalently and retest. Larger drops in score indicate a higher degree of memorization.

    Record equivalent rewriting results in a table for traceability:

    Question ID Original Prompt Rewritten Prompt Original Pass Rewritten Pass Notes
    Sample-001 Public question Equivalent rewrite Yes No Suspected memorization

    Knowledge Distillation and Anti-Distillation: Principles and Compliance Boundaries

    What Knowledge Distillation Is

    Knowledge distillation refers to using a stronger teacher model to train a smaller student model. The typical workflow is: the teacher model generates outputs for a batch of inputs, and these outputs (including text or probability distributions) serve as training signals for the student model to imitate the teacher’s behavior. Distillation can reduce inference cost and latency and is convenient for edge deployment.

    The effectiveness of distillation depends on three factors: the teacher model’s capability, the coverage of the training data, and the student model’s capacity. A student model usually approaches the teacher model only on a subset of tasks and cannot fully replicate all capabilities.

    What Anti-Distillation Means

    Anti-distillation refers to measures taken by model providers to prevent others from using their outputs to train competing models. Common forms include service terms prohibiting the use of outputs to train other models, limits on call frequency and usage, traceability markers on outputs, and monitoring for abnormal batch call patterns.

    For users, understanding anti-distillation is about assessing risk. Even if large volumes of outputs can be obtained technically, they may not be legal or contractually permissible to use in that way.

    Compliance Checklist

    Before starting any distillation project, confirm each item:

    • Whether the teacher model’s service terms allow using outputs to train other models.
    • Whether the open-source model’s license permits derivative training and whether it requires attribution or the same license.
    • The copyright and licensing status of training data, including whether third-party copyrighted content is included.
    • Whether the data contains personal information, whether proper authorization has been obtained, and whether local data protection regulations are followed.
    • Whether the intended use of the distilled product is subject to export controls or industry regulations.
    • Whether project records are complete, including data sources, license documents, and approval conclusions.

    If any item cannot be confirmed, obtain a legal or compliance review before proceeding.

    Evaluation Key Points for Coding Agents

    Coding agents must execute multi-step operations in an environment and adjust strategies based on tool return values, so evaluation is more complex than single-turn Q&A. The following points apply to most evaluation frameworks.

    Isolated Environments and Deterministic Judgments

    Each task should run in a separate container or sandbox, with no shared files or state between tasks. Dependency versions should be pinned, network access disabled by default, and only whitelisted addresses opened when necessary. Tool permissions follow the principle of least privilege, for example, read and write access only to the task directory.

    Judgments should be based on reproducible tests rather than subjective human scoring. The following example runs tests in a specified directory with a timeout:

    1. import subprocess
    2. def run_tests(repo_dir: str, timeout_s: int = 300) -> dict:
    3. """Run tests in an isolated directory. Arguments are passed as a list, not parsed by the shell."""
    4. try:
    5. proc = subprocess.run(
    6. ["pytest", "-q", "--maxfail=1"],
    7. cwd=repo_dir,
    8. capture_output=True,
    9. text=True,
    10. timeout=timeout_s,
    11. )
    12. except subprocess.TimeoutExpired:
    13. return {"status": "timeout", "passed": False}
    14. return {
    15. "status": "done",
    16. "passed": proc.returncode == 0,
    17. "log": proc.stdout[-4000:],
    18. }

    Timeouts, Retries, and Logging

    • Timeout: Set a uniform limit for each task. Timeout is treated as failure and the cause must be recorded.
    • Retries: The retry count must be predetermined. Report both the first-attempt pass rate and the pass rate after retries to avoid masking instability.
    • Logging: Preserve every tool call, returned result, and test output. Keep logs for a period consistent with the data management policy.

    Failure Attribution

    Each failure should be assigned to a clear category to facilitate debugging:

    • Model error: the generated code logic is incorrect.
    • Tool error: invalid call parameters or abnormal tool returns.
    • Environment error: missing dependencies, disk or port issues.
    • Judgment error: the test case itself is flawed.

    Environment errors and judgment errors should be fixed and retested first; they should not be counted as model capability failures.

    Model Selection Checklist

    Do not rely solely on total scores when selecting a model. Review the following items:

    1. Whether scores are provided per business task dimension instead of only a weighted total.
    2. Whether the difference between two models is beyond the confidence interval.
    3. Whether evaluation questions have undergone anti-contamination processing and include results from a private question set.
    4. Whether distillation or use of model outputs complies with service terms, licenses, and data regulations.
    5. Whether inference cost, latency, and deployment method fit business constraints.
    6. Whether failures of coding agents have been attributed and environment errors have been excluded.

    Conclusions drawn from this checklist are more reliable than a single leaderboard ranking and easier to communicate to management.