Table of Contents
Fetching ...

LLM In-Context Recall is Prompt Dependent

Daniel Machlab, Rick Battle

TL;DR

This paper investigates in-context recall in large language models using a needle-in-a-haystack paradigm to measure retrieval of prompt-embedded facts across varying haystack lengths and needle positions. It demonstrates that recall is highly prompt-dependent and can degrade when prompts conflict with training data, while larger models, architectural adjustments, and fine-tuning can substantially improve recall. The study analyzes nine prominent models with diverse context windows, employs heatmap-based evaluation, and highlights practical implications for model selection and prompt design in real-world deployments. The findings stress the need for multifaceted evaluation to capture recall behavior, guiding robust application of LLMs in scenarios requiring precise prompt-based retrieval.

Abstract

The proliferation of Large Language Models (LLMs) highlights the critical importance of conducting thorough evaluations to discern their comparative advantages, limitations, and optimal use cases. Particularly important is assessing their capacity to accurately retrieve information included in a given prompt. A model's ability to do this significantly influences how effectively it can utilize contextual details, thus impacting its practical efficacy and dependability in real-world applications. Our research analyzes the in-context recall performance of various LLMs using the needle-in-a-haystack method. In this approach, a factoid (the "needle") is embedded within a block of filler text (the "haystack"), which the model is asked to retrieve. We assess the recall performance of each model across various haystack lengths and with varying needle placements to identify performance patterns. This study demonstrates that an LLM's recall capability is not only contingent upon the prompt's content but also may be compromised by biases in its training data. Conversely, adjustments to model architecture, training strategy, or fine-tuning can improve performance. Our analysis provides insight into LLM behavior, offering direction for the development of more effective applications of LLMs.

LLM In-Context Recall is Prompt Dependent

TL;DR

This paper investigates in-context recall in large language models using a needle-in-a-haystack paradigm to measure retrieval of prompt-embedded facts across varying haystack lengths and needle positions. It demonstrates that recall is highly prompt-dependent and can degrade when prompts conflict with training data, while larger models, architectural adjustments, and fine-tuning can substantially improve recall. The study analyzes nine prominent models with diverse context windows, employs heatmap-based evaluation, and highlights practical implications for model selection and prompt design in real-world deployments. The findings stress the need for multifaceted evaluation to capture recall behavior, guiding robust application of LLMs in scenarios requiring precise prompt-based retrieval.

Abstract

The proliferation of Large Language Models (LLMs) highlights the critical importance of conducting thorough evaluations to discern their comparative advantages, limitations, and optimal use cases. Particularly important is assessing their capacity to accurately retrieve information included in a given prompt. A model's ability to do this significantly influences how effectively it can utilize contextual details, thus impacting its practical efficacy and dependability in real-world applications. Our research analyzes the in-context recall performance of various LLMs using the needle-in-a-haystack method. In this approach, a factoid (the "needle") is embedded within a block of filler text (the "haystack"), which the model is asked to retrieve. We assess the recall performance of each model across various haystack lengths and with varying needle placements to identify performance patterns. This study demonstrates that an LLM's recall capability is not only contingent upon the prompt's content but also may be compromised by biases in its training data. Conversely, adjustments to model architecture, training strategy, or fine-tuning can improve performance. Our analysis provides insight into LLM behavior, offering direction for the development of more effective applications of LLMs.
Paper Structure (24 sections, 18 figures, 7 tables)

This paper contains 24 sections, 18 figures, 7 tables.

Figures (18)

  • Figure 1: GPT-4 Turbo performs worse in the needle-in-a-haystack test when the needle conflicts with training data in the San Francisco test (top) versus in the Thornfield Hollow (middle) and PistachioAI tests (bottom).
  • Figure 2: Llama 2 70B (bottom), with 5.3x more parameters, outperforms Llama 2 13B (top) in in-context factoid recall.
  • Figure 3: Mistral v0.1 (top) lags behind Mistral v0.2 (middle) and Mixtral (bottom) in recall performance.
  • Figure :
  • Figure :
  • ...and 13 more figures