TL;DR
Production RAG systems often face imperfect, noisy retrieval, but how does this external noise interact with an LLM's internal generation settings? This paper introduces TempPerturb-Eval, a framework demonstrating that higher generation temperatures drastically amplify an LLM's vulnerability to text perturbations, revealing distinct, model-specific thresholds for robust deployment.
What Problem Does This Paper Address?
Retrieval-Augmented Generation (RAG) is highly effective because it grounds Large Language Models (LLMs) with external knowledge. However, in real-world deployments, retrieval is rarely perfect—it frequently introduces noise in the form of irrelevant text, missing facts, or corrupted entities. At the same time, developers adjust generation hyperparameters like temperature to balance creativity and determinism.
Traditionally, researchers evaluate retrieval quality and generation parameters in isolation. This paper addresses a critical gap: the unstudied interaction between external text perturbations and internal model temperature. Failing to account for how these two forces compound can lead to misleading robustness assessments and unexpected system failures in production.
Methods
The authors propose the RAG Perturbation-Temperature Analysis Framework to systematically evaluate how LLMs handle noisy contexts across different temperature settings.
The methodology involves:
- Temperature Scaling: Varying the LLM sampling temperature from 0.0 to 2.0 in increments of 0.2.
- Context Perturbations: Applying three distinct types of text modifications to the supporting documents to simulate retrieval errors:
- Sentence Replacement: Replacing the latter portion of supporting sentences with irrelevant sentences from the same document title (simulating correct entity retrieval with incorrect evidence).
- Sentence Removal: Deleting the latter half of supporting sentences (simulating incomplete evidence).
- NER Replacement: Masking named entities with
[MASK]tokens to disrupt entity recognition and relationship inference. - Multiple Evaluation Runs: Executing each query three times per condition to separate the model's internal stochasticity (due to temperature) from the impact of the external perturbations.
Outputs are evaluated using semantic similarity metrics, primarily BERTScore, against reference answers that are expanded into complete sentences using a standardized template.
Datasets
The framework is evaluated using the training set of the fullwiki version of HotpotQA, a popular benchmark for multi-hop question answering that requires complex reasoning across multiple documents. The authors randomly selected 600 samples, evenly balanced across different fact counts (2, 3, and 4 facts) and reasoning types ("bridge" vs. "comparison" questions).
Key Insights and Ideas
- Temperature is a Degradation Amplifier: Temperature does not just introduce randomness; it actively amplifies a model's vulnerability to noisy context. While models tolerate perturbations reasonably well at low temperatures, their performance drops sharply as temperature increases.
- Model-Specific Fragility Landscapes: Different LLM architectures show completely unique sensitivity profiles. GPT models maintain high stability until they hit a sharp performance cliff at $T = 1.4$. Llama models begin degrading much earlier ($T = 0.6$) but experience a more gradual decline.
- The Extreme Temperature Flip: At lower temperatures ($T < 1.4$), proprietary GPT models achieve the highest BERTScores. However, at extreme temperatures ($T = 2.0$), this hierarchy completely reverses:
deepseek-reasonermaintains stable performance, while GPT models degrade below the open-source Llama models. - DeepSeek’s Chain-of-Thought Resilience: Uniquely,
deepseek-reasonerremains nearly invariant to temperature changes. The authors attribute this to its test-time Chain-of-Thought (CoT) architecture, which enforces logical coherence and insulates the final answer from sampling noise.
Key Results
The quantitative effects of temperature and perturbations across different models are highlighted in the paper's trend analysis:
- GPT-4o Vulnerability: For
gpt-4o, NER Replacement caused minimal issues, but Sentence Replacement and Sentence Removal triggered severe performance drops and model refusal behaviors (e.g., "The retrieved document does not provide...") at temperatures above 1.4. - Output Variability: Using the Coefficient of Variation (CV), the authors found that temperature exerts a much stronger influence on output variability than the specific type of perturbation applied.
- Practical Deployment Guidelines: To maintain acceptable correctness under noisy retrieval conditions, the authors recommend strict temperature ceilings:
- DeepSeek-reasoner: Ideal for applications requiring consistent performance across any temperature.
- GPT Models: Keep temperature ceilings at $T \le 1.4$ to avoid sharp performance cliffs.
- LLaMA Models: Use conservative temperature limits of $T \le 0.6$.
Limitations and Future Work
- Task Generalizability: The findings are currently restricted to multi-hop factoid QA (HotpotQA). How temperature and perturbations interact in other common RAG tasks, such as long-form summarization or open-ended dialogue, remains to be validated.
- Other Hyperparameters: The study held other decoding parameters (like
top-por frequency penalties) constant, though they likely also interact with context noise. - Controlled vs. End-to-End Noise: The authors isolated generator sensitivity by perturbing "gold" contexts. A crucial next step is integrating actual, messy vector retrieval systems to observe how real-world retrieval inaccuracies compound with generation stochasticity in end-to-end pipelines.
Summary updated