LLM Selection and Hallucination Mitigation: A Practical Guide
This guide explains how to choose a general-purpose large language model (LLM) based on scenario-specific capability priorities rather than chasing a single "strongest" model, and how to build fallback controls when the model fails. It covers four quantifiable evaluation dimensions (factuality, instruction following, multimodal understanding, and stability), a layered approach to hallucination causes and mitigation, prompt templates for premise checking and confidence control, multimodal part-versus-whole testing, and an engineering architecture that treats the model as an unreliable dependency. Readers will get reproducible evaluation practices, retrieval-augmented generation and dual-check patterns, and traceability requirements for production LLM systems.
1. Reframing the Problem: From “Which Model” to “How to Choose and How to Cover Failures”
When teams start model selection, the first instinct is often to find the “strongest model.” In real engineering practice, a more useful question is: in my business scenario, which capability carries the most weight, and can my system absorb the failure when the model is wrong? A core tension from the original discussion is representative here: one class of models is more agreeable in conversational fluency and writing experience, while another is more conservative and reliable on factual consistency. On open-ended questions, models that express themselves more “confidently” are often the ones more likely to produce content that looks plausible but does not hold up.
One premise must be stated clearly: no general-purpose LLM currently has a 100% accuracy rate. The essence of selection is therefore not finding a perfect model, but building a combined solution of “capability match + risk control.”
2. Defining Quantifiable Evaluation Dimensions
Break evaluation into four dimensions, and design an independent test set for each:
- Factuality: whether the output contains verifiable false statements, especially about people, dates, figures, and cited sources.
- Instruction following: whether negative constraints (for example, “do not use a certain configuration”) are strictly honored.
- Multimodal understanding: whether the model accurately identifies the relationship between a local region and the whole image.
- Stability: whether answers stay consistent across repeated runs on the same question, and whether errors are reproducible.
An illustrative scoring table structure:
cases = [{"id": "F-001", "dim": "factuality", "input": "...", "expect": "no fabricated facts"},{"id": "I-002", "dim": "instruction", "input": "...", "expect": "strictly follow negative constraints"},{"id": "M-003", "dim": "multimodal", "input": "image + question", "expect": "point out the location of the local feature"},]score = {c["id"]: run_and_judge(c) for c in cases}
The key is reproducibility: fix the prompt, fix the parameters, fix the input material, and keep the raw output of every run. Only then can you tell whether a problem is incidental or a systematic defect.
3. Causes of Hallucination and Layered Mitigation
Hallucinations fall into roughly three layers: knowledge-layer gaps (the model does not hold the fact), reasoning-layer jumps (similar information is incorrectly associated), and expression-layer overconfidence (uncertain content is packaged in a definitive tone). The mitigation differs per layer:
- Knowledge layer: add retrieval augmentation, supply authoritative material as context, and require answers to cite the supporting passage.
- Reasoning layer: require the model to list known conditions and uncertain items first, then give a conclusion; for missing information, explicitly answer “cannot be determined.”
- Expression layer: constrain confidence expression in the prompt, and prohibit absolute wording for content with no source.
A practical prompt template:
1) Answer only based on the material I provide;2) For parts the material does not cover, explicitly output "insufficient material";3) Tag the source number after each conclusion;4) Do not fill gaps with speculative descriptions.
4. Instruction Following: Negative Constraints Expose Weaknesses Most Clearly
A typical case from the original discussion is a technical question with a negative constraint: an integrated model has already merged two-stage weights, and the question asks how to additionally attach two adapters of different noise versions, while the authoritative documentation says “do not use one class of these adapters.” Some models still follow the presupposition of the question and give steps for “you can attach them.” This is a typical instruction-following failure: the model tends to satisfy the user’s operational intent instead of verifying whether the premise holds.
The improvement is to write “premise verification” explicitly into the flow:
First check whether the premise of the question conflicts with the documentation;If it conflicts, output the conflict explanation first, then give the documented recommendation;Do not provide operation steps that contradict the documentation.
Engineering-wise, you can add a second verification pass: the first pass generates the answer, the second pass only performs a “constraint compliance check” and outputs pass or fail, rewriting the answer on fail.
5. Multimodal Scenarios: Recognizing Part and Whole
Another typical test: the full image is a pirate ship scene at sea, and one cropped local region resembles a violin; the question asks where that region is. Better-performing models can locate it, while weaker models give explanations that are not self-consistent. The reason is that the model tends to let overall semantics override local detail.
Practical suggestions:
- When asking, state explicitly “first locate the local feature, then describe the overall scene,” and put that order into the prompt.
- Crop key images into regions, ask about each separately, then cross-compare the answers.
- Express localization results as coordinates or region descriptions so they can be validated automatically.
6. Engineering Implementation: Treat the Model as an Unreliable Dependency
The recommended architecture is “retrieval layer + model layer + verification layer + logging layer.” The retrieval layer supplies authoritative context; the model layer can keep invocation entries for multiple complementary providers and switch between them through a unified abstraction interface; the verification layer performs rule-based checks and a second model review; the logging layer records input, output, version, and score to support regression. If elastic compute and supporting capabilities are needed, a container platform can host inference services, object storage can hold evaluation corpora, and logging services with monitoring alerts can track changes in error rate.
7. Conclusion
Selection should return to scenario weights: writing and conversational experience, factual consistency, instruction following, and multimodal understanding usually cannot all be optimal in a single model. A more robust approach is to build a reproducible evaluation set, suppress hallucinations with retrieval augmentation and dual verification, and keep human review for important conclusions. Model capability keeps evolving, but the engineering methods of “verifiable, traceable, and with fallback” will not go out of date.
