Large Language Model Selection and Hallucination Mitigation: A Practical Guide

    This guide reframes general-purpose LLM selection as a question of evaluation methodology rather than brand choice, and explains how to build controllable quality boundaries around uncertain outputs. It covers the nature and three categories of hallucination, four evaluation dimensions (factual accuracy versus conservatism, instruction following under long constraints, multimodal detail localization, and context engineering with tool coordination), reusable regression test set design, a risk control checklist, and cloud-based production guidance. Readers will learn how to treat hallucination as a constant risk and design measurable, regression-testable systems with human fallback.

    1. Reframing the Problem: From “Which Model” to “How to Evaluate”

    Many teams start model selection by choosing between two candidate general-purpose LLMs. What actually determines project success, however, is usually not the brand but whether the evaluation method is rigorous. The correct engineering starting point is to abstract the problem as “how to establish controllable quality boundaries over uncertain output.”

    The most valuable conclusion from prior experience is that no model achieves 100% accuracy. The goal of selection is therefore not to find a model that never fails, but to find the one with a lower error rate on your task distribution, errors that are easier to detect, and error costs that are easier to contain.

    2. The Nature and Categories of Hallucination

    Hallucination refers to content a model generates that contradicts facts yet is stated with great confidence. In engineering practice it is usually divided into three types:

    • Factual hallucination: people, dates, data, or citation sources are fabricated.
    • Instruction hallucination: constraints are not followed, for example a parameter that should be disabled is still enabled.
    • Perceptual hallucination: in multimodal input, a nonexistent target is “seen” as present, or a present one is missed.

    The mitigation approaches for these three types are entirely different, and discussing them together is the main reason selection loses focus.

    3. Evaluation Dimension 1: Factual Accuracy vs. Conservatism

    A frequently overlooked dimension is confidence calibration. Some models tend to give more confident, more agreeable judgments on open-ended questions; others are more conservative and tend to declare uncertainty. Neither is absolutely better:

    • Confident output gives a smoother experience in writing, brainstorming, and draft proposals.
    • Conservative output carries lower risk in fact-checking, compliance review, and technical documentation validation.

    Practical advice: treat overconfidence as a risk signal to be detected, not as personal charm.

    4. Evaluation Dimension 2: Instruction Following and Long-Constraint Retention

    Prompts in real business scenarios often contain multiple negations and exception clauses. Evaluation should include trap-style cases, for example:

    1. Constraint: additional weights for the high-noise branch are prohibited;
    2. Input: a model that merges the high-noise and low-noise dual branches into a
    3. single checkpoint, plus two sets of additional weights corresponding to
    4. different noise ranges.
    5. Requirement: give the single correct loading strategy and explain the reasoning.

    If the model loses a negation constraint in a long context, that is instruction hallucination. Such issues carry the highest cost in parameter configuration, deployment scripts, and permission policy scenarios.

    5. Evaluation Dimension 3: Multimodal Detail Localization

    Joint image-text understanding must be evaluated separately. Construct prompts with “locally similar, globally different” content, for example requiring that a certain region of the image resembles a musical instrument while the overall scene is something else. There are three evaluation points: whether the target is detected, whether the localization is explainable, and whether the model contradicts itself under follow-up questions.

    A practical approach is to require the model to output coordinates or a region description and then verify it manually. If the model gives an explanation in follow-up questioning that cannot be mapped to the image, the perception pipeline is unreliable.

    6. Evaluation Dimension 4: Context Engineering and Tool Coordination

    Model capability alone is not enough to support a production system. A more robust architecture is “model + retrieval + validation”:

    1. Retrieval layer: chunk authoritative documents into a store, using hybrid recall with vector retrieval and keyword retrieval.
    2. Generation layer: the model is only allowed to answer based on retrieved snippets, and citation is mandatory.
    3. Validation layer: apply rule-based checks to key fields or cross-validate with a second model.
    4. Fallback layer: escalate to a human when confidence is insufficient.

    Illustrative flow:

    1. def answer(query):
    2. ctx = hybrid_retrieve(query, top_k=8)
    3. draft = llm.generate(query, context=ctx, require_citation=True)
    4. if not rule_check(draft) or low_confidence(draft):
    5. return escalate_to_human(query, ctx)
    6. return draft

    7. Designing a Reusable Test Case Set

    It is advisable to build four categories of regression cases and run them after every model or prompt change:

    • Fact-checking: verifiable dates, quantities, and citations.
    • Constraint traps: multiple negations, exception clauses, prohibited items.
    • Multimodal localization: images where local and global content conflict.
    • Open-ended judgment: no definite answer, testing whether uncertainty is declared.

    Cases should be version-controlled, with expected answers and judgment rules recorded, forming a comparable evaluation baseline.

    8. Risk Control Checklist

    • Important conclusions must be verified through two channels, not relying on a single model output.
    • Generated content must be labeled with source and confidence; missing either is treated as unusable.
    • High-risk scenarios (medical, financial, legal) retain human final review.
    • Establish online sampling audits that continuously track hallucination rate rather than a one-time evaluation.
    • Prompts and the retrieval corpus are both included in regression testing scope.

    9. Cloud Engineering Implementation

    To productize the capability, you can compose general cloud capabilities: object storage for evaluation sets and corpora, a message queue for peak shaving, a container platform to host inference services, and log services with monitoring and alerting to close the observability loop. Baidu AI Cloud offers corresponding capabilities in these general categories and can serve as a reference foundation for architecture selection.

    10. Conclusion

    The core of selection is not taking sides but building a quality system that is measurable, regression-testable, and backed by fallback. Factual tasks lean toward conservative models, and creative tasks can accept more fluent expression, but both must be constrained by the same validation mechanism. Designing systems that treat hallucination as a constant risk, rather than praying that it is an occasional defect, is the sustainable engineering practice.