Evaluating Open-Source LLMs for Vertical Tasks and Managing Hallucinations

    This article presents a transferable methodology for evaluating open-source large language models in vertical domains and treating hallucination as an optimizable metric. It covers blind testing with expert crowdsourcing, score normalization with confidence intervals, layered task design, separating ungrounded generation from guess-based errors, evidence-grounded retrieval with citation constraints, confidence thresholds and refusal mechanisms, and engineering practices for reproducibility and deployment.

    1. Background: “Runnable” Does Not Mean “Usable”

    Over the past year, both the number and parameter scale of open-source large language models have grown rapidly, yet this has raised the selection cost for developers rather than lowering it. The real pain points cluster in three areas:

    • Generic leaderboard scores are disconnected from actual business performance.
    • Hallucination and “guess-style answering” in vertical tasks are hard to quantify.
    • There is no reproducible evaluation process, so after a model upgrade it is impossible to tell whether the change is progress or regression.

    Rather than discussing specific products, this article abstracts a transferable methodology: how to design a trustworthy vertical evaluation, how to turn hallucination rate into an optimizable metric, and how to balance retrieval augmentation against decoding constraints.

    2. Designing a Trustworthy Vertical Evaluation

    2.1 Blind Testing and Expert Crowdsourcing

    The first principle of trustworthy evaluation is blind testing: model outputs must have identity markers removed, and raters must not know the source, so brand priors do not influence scoring. The second principle is that the expert panel must cover both internal and external reviewers; the higher the share of external experts, the better the results reflect the real business distribution. The third principle is that tasks must come from real support tickets rather than constructed questions, and the task set must cover both high-frequency and long-tail cases.

    2.2 Score Normalization and Confidence Intervals

    Five-level or hundred-point scores need normalization, and you should report the mean, variance, and confidence interval. Comparing means alone invites misjudgment: if the gap between two models is smaller than the interval width, the result should be treated as “no significant difference.” Example:

    1. import statistics, math
    2. def summarize(scores):
    3. n = len(scores)
    4. mean = statistics.mean(scores)
    5. sd = statistics.stdev(scores) if n > 1 else 0.0
    6. ci = 1.96 * sd / math.sqrt(n) # approximate 95% confidence interval
    7. return {"n": n, "mean": round(mean, 3), "ci95": round(ci, 3)}

    2.3 Layering Tasks

    It is advisable to split the evaluation set into three layers: basic comprehension, domain reasoning, and tool/engineering constraint following. Financial analysis tasks, for instance, should include four categories: report interpretation, metric calculation, risk clause extraction, and compliance wording, instead of covering all capabilities with “question answering” alone.

    3. Hallucination Management: Turning a Vague Problem into Metrics

    3.1 Count the Two Error Types Separately

    A common mistake in hallucination management is lumping all errors together. A more effective approach splits errors into two types: “ungrounded generation” caused by missing retrieval or knowledge, and “guess-based errors” where the model still forces a conclusion while uncertain. The optimization levers are completely different: the former relies on retrieval and knowledge bases, the latter on confidence thresholds and refusal mechanisms.

    3.2 Search Augmentation and Citation Constraints

    Specialized search optimization typically includes query rewriting, multi-path recall, reranking, and evidence pruning. The key constraint is “no evidence, no conclusion”: every key conclusion in the model output must carry a verifiable source snippet, otherwise it is downgraded to “insufficient information.”

    1. System constraint (illustrative):
    2. 1. Answer using only the provided evidence;
    3. 2. Tag each conclusion with the evidence ID;
    4. 3. When evidence is insufficient, output "insufficient information"; speculation is prohibited.

    3.3 Uncertainty and Refusal

    Once confidence estimation is introduced, requests below the threshold should trigger clarification or refusal. In engineering terms, a combination of rules and model judgment can be used, and the refusal rate should be monitored to avoid hurting usability through over-refusal in the name of reducing hallucination.

    4. Engineering and Vertical Scenario Adaptation

    4.1 Game Development Scenario

    Game logic and toolchain invocation emphasize structured output and constraint following. Evaluation should cover tasks such as engine script generation, state machine design, and asset pipeline configuration, and should use objective metrics like “compilable rate” and “unit test pass rate for logic” rather than subjective scoring alone.

    4.2 Deployment and Platformization

    Putting open-source models into production usually requires four general cloud capabilities: a container platform to host inference services, object storage to hold models and datasets, a message queue for asynchronous evaluation scheduling, and logging plus monitoring and alerting to track latency and error rates. A unified gateway for canary release and rollback can significantly reduce upgrade risk.

    4.3 A Reproducible Experiment Loop

    It is recommended to fix the random seed, fix the prompt templates, fix the evidence base version, and version every evaluation artifact. Only when variables are controlled are model iteration conclusions trustworthy.

    5. Conclusion

    The key to selecting open-source models is not chasing a single score, but building a closed loop of “blind testing + layered tasks + two-class error metrics + constrained decoding.” Continuously monitoring hallucination rate and guess error rate as first-class metrics, combined with retrieval augmentation and refusal strategies, is what makes results reliably usable in demanding scenarios such as financial analysis and game development.