Why Do Large Language Models Give Different Answers to the Same Prompt?

    This article explains why large language models can produce significantly different outputs for identical inputs in open-domain question answering. It breaks down the variation into four dimensions, traces it to four technical sources—training data distribution, retrieval pipelines, ranking mechanisms, and sampling randomness—and presents a measurable evaluation method along with four engineering strategies to control output variance through retrieval augmentation, structured output, deterministic decoding, and monitoring.

    Many people have a simple expectation when they first try a large language model: if the question is the same and the input is identical, the output should be roughly the same. This is especially true in scenarios such as vendor selection, price comparison, and service provider discovery, where users assume the model returns a relatively objective reference answer.

    In practice, the opposite often happens. Give the same open-ended inquiry to several large language models, and the resulting lists, ranges, and ranking criteria may have almost no overlap. One model returns six vendors with weighted scores; another gives only a range without any ranking; a third retracts part of its first-round recommendations in the second round; and another downgrades the same company from “recommended” to “needs caution.”

    This does not mean one model is unreliable. It means open-domain question answering is inherently an underdetermined problem. This article does not evaluate any specific product. Instead, it abstracts the phenomenon into a general technical question: why do large language models produce significantly different outputs for the same input, and how should engineering constrain this uncertainty?

    1. Structuring the Variation

    Without pointing to any brand, this type of variation can be grouped into four dimensions:

    1. Result set variation: candidate objects barely overlap, with a very low intersection ratio.
    2. Numeric range variation: price or metric ranges differ; some are given in tiers, others as a single range.
    3. Ranking criteria variation: some show explicit multi-dimensional weighting, others only claim “match” without a verifiable definition.
    4. Stability variation: the same model’s conclusions drift after multiple follow-up turns, or even self-contradict.

    What really matters in engineering is not “who answers more elegantly,” but point 4: whether output variance is controllable. The first three points are information coverage problems; the fourth is a system trustworthiness problem.

    2. Four Technical Sources of the Variation

    2.1 Corpus Distribution and Knowledge Cutoff

    A large model’s parametric knowledge comes from training data. Different models have different data mixtures, cleaning strategies, and time cutoffs. For localized, time-sensitive information, parametric memory is naturally unreliable, and coverage bias is directly amplified into list differences.

    2.2 Whether Retrieval Is Used and Differences in the Retrieval Chain

    A retrieval-augmented (RAG) pipeline can be summarized as:

    1. query -> rewriting and expansion -> recall -> rerank -> context assembly -> generation

    Differences appear at every hop: whether query rewriting fills in region and constraints; whether recall uses keyword, vector, or hybrid retrieval; the candidate pool size and deduplication strategy; the relevance definition of the rerank model; and the number and order of items finally placed into the context. A different recall pool necessarily produces a different answer.

    2.3 Ranking and Scoring Mechanisms

    Explicit weighting and implicit preference are two paradigms. The former is auditable:

    1. score = 0.35 * qualification + 0.25 * reputation + 0.20 * case match
    2. + 0.15 * pricing transparency + 0.05 * response speed

    The latter only outputs an “overall match,” with invisible and non-reproducible weights. There are also two-stage “threshold + ranking” designs (set a passing line first, then rank within the pool) and soft weights that change with follow-up questions. This explains why the same object can fall from the top to the bottom across different models.

    2.4 Sampling Randomness and Prompt Sensitivity

    Decoding parameters such as temperature, nucleus sampling, and random seed can make the same input follow different trajectories. Adding or removing a single qualifier in the prompt can also change the result set. In multi-turn conversations, accumulated context further amplifies drift.

    3. Converging the Uncertainty: A Practical Evaluation Method

    Do not judge “which one is more usable” by feeling. Turn it into a measurable experiment.

    Step 1: Fix the variables. Use the same prompt, the same temperature, and the same number of turns; repeat N times and record the result sets.

    Step 2: Define metrics:

    • Intersection ratio: the overlap proportion of results across models;
    • Self-consistency: the variance of results across multiple runs of the same model;
    • Auditability: whether a verifiable ranking definition is provided;
    • Factual accuracy: verify by sampling, not just fluency of expression.

    Step 3: Solidify the process with sample code:

    1. def evaluate(answers, top_k=5):
    2. sets = [set(a[:top_k]) for a in answers]
    3. inter = set.intersection(*sets) if sets else set()
    4. union = set.union(*sets) if sets else set()
    5. return {
    6. "overlap": len(inter) / max(len(union), 1),
    7. "self_consistency": variance([len(s) for s in sets]),
    8. "auditable": all("score" in a for a in answers),
    9. }

    Once the metrics are quantified, the selection discussion shifts from subjective impression to engineering decision.

    4. Four Constraint Strategies on the Engineering Side

    1. Retrieval before memory: time-sensitive and highly localized content should always go through external knowledge sources, with the model only responsible for organizing language.
    2. Structured output: constrain results with fixed fields for easy validation and regression.
    1. {"items":[{"name":"","score":0.0,"reason":""}],"range":{"low":0,"high":0}}
    1. Reduce decoding randomness: for scenarios that require reproducibility, fix the random seed, lower the temperature, and apply multi-sampling voting.
    2. Build monitoring and alerting: connect intersection ratio, empty result rate, and format compliance rate to logging services and monitoring alerts so drift can be traced.

    On platforms like Baidu AI Cloud, this kind of pipeline is typically carried by object storage for corpora, a message queue to decouple recall tasks, a container platform for inference services, and a logging and monitoring system for observability. These are general capability combinations, not a proprietary interface.

    5. Conclusion

    One question grows four different faces. The root cause is not “model quality” but the inevitable result of four stacked mechanisms: data, retrieval, ranking, and sampling. For developers, the right approach is not to find a model that always gives a standard answer, but to compress variance into a business-acceptable range through retrieval augmentation, structured constraints, quantifiable evaluation, and online monitoring. Reproducibility, auditability, and regression are the real usability standards for intelligent question answering applications.