Insights into LLM Long-Context Failures: When Transformers Know but Don’t Tell
필름·전자재료 · (13) 프리즘 필름
기본 정보
- 저자
- DOI
- 10.18653/v1/2024.findings-emnlp.447
- 저널
- –
- 발행년도
- 2024
- 발행기관
- –
- 피인용수
- 8
- 라이선스
- cc-by
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.18653/v1/2024.findings-emnlp.447
- 토픽
- Advancements in Photolithography Techniques
- OpenAlex ID
- W4404782068
평가 내용
- 관련도
- 사업분야
- 필름·전자재료 · (13) 프리즘 필름
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
본문 49,266자
본문 펼치기
섹션 본문 56문단 · 24,638자
(제목 없음)
1Large Language Models (LLMs) exhibit positional bias, struggling to utilize information from the middle or end of long contexts.Our study explores LLMs' long-context reasoning by probing their hidden representations.We find that while LLMs encode the position of target information, they often fail to leverage this in generating accurate responses.This reveals a disconnect between information retrieval and its communication, a 'know but don't tell' phenomenon.We further analyze task accuracy vs layers, offering insights into the underlying mechanics of transformer models.The code for reproducing our results is accessible at https://github.com/TaiMingLu/knowdont-tell.
Introduction
2The advent of Transformer-based Large Language Models (LLMs) has delivered marked improvement in language processing capabilities (Vaswani et al., 2017;Dubey et al., 2024).These models excel at simultaneously processing extended contexts (Ding et al., 2024;Chen et al., 2023), significantly benefiting various downstream tasks like long-text question answering, summarization, and inference (Wang et al., 2024;Zhang et al., 2024a;Shaham et al., 2022Shaham et al., , 2023)).
3Despite their advanced capabilities, LLMs often struggle to utilize long inputs fully.This tendency, known as positional bias, leads LLMs to disproportionately prioritize information at the beginning or end of the input sequence (Wang et al., 2023), while crucial details in the middle are frequently overlooked (Liu et al., 2023b).Numerous strategies have been proposed to address these biases (Tang et al., 2024;Li et al., 2023;Zhang et al., 2024b;Goldman et al., 2024), yet the underlying causes and potential solutions remain unclear.This underscores the need for a deeper investigation into how ✰ indicates equal contributions.{"7f66":"2a1d0ba0", "6f90": "d2c6acn0", ⋮ "7421": "4df5987a"} LLMs handle long-context integration.To fully assess the capabilities of LLMs in handling extended contexts, it is not enough to merely evaluate their final performance: some important information is hidden in models' representations.
4This work presents a probing analysis of LLMs' long-context generalization.We develop probes based on LLMs' internal representations for various layers and positions to measure the accuracy of reconstructing the position they correspond to (Fig. 1).Our working hypothesis is that, for LLMs to effectively process long contexts, they must encode positional information in their intermediate representations.
5We conduct experiments on two tasks from Liu et al. (2023b) and three recent open-source models.
6Our findings reveal a gap between the accuracy of LLMs' generations and the probes on their representations.Notably, while LLM representations identify the position of crucial information within the context (surfaced via probes), they often fail to utilize this information effectively in their responses, leading to what we term the 'Know but don't Tell' phenomenon.To our knowledge, this is the first work to use probing analysis to highlight this observation.We hope that our work on distinguishing "knowing" and "telling" motivates future work on tackling LLMs' long-context challenges.
7In summary, our contributions are as follows: (1) Probing analysis: We introduce a novel framework to investigate the long-context reasoning capabilities of LLMs.This framework allows us to measure how accurately LLMs encode positional information across various layers and positions within their intermediate representations.
8(2) Empirical evaluation: We conduct comprehensive experiments using tasks from Liu et al. (2023b) and three recent open-source models.Our empirical evaluation provides new insights into the positional biases of LLMs and their impact on model performance.(3) 'Know but Don't Tell' phenomenon: Our analysis reveals a critical gap between LLMs' ability to encode and utilize positional information.We identify the "Know but don't Tell" phenomenon, where LLMs accurately identify the position of crucial information but fail to leverage this knowledge in generating accurate responses.By distinguishing between the encoding and utilization of positional information, our work lays the foundation for future advancements in LLM performance and reliability.
Related Work
9Positional bias.LLMs exhibit a positional bias, where the location of crucial context information influences their performance (Zhao et al., 2021).One prominent example is the "lost in the middle" phenomenon, where comprehension declines for information in the center of a long context (Liu et al., 2023b).Additionally, recency bias is observed, particularly in few-shot learning scenarios, where models tend to favor information near the end of the prompt (Zhao et al., 2021).Such biases could stem from the positioning of key data in pre-training sets, which often places important elements near critical points (Peysakhovich and Lerer, 2023).Our work delves into this phenomenon by examining the underlying mechanisms within the transformer layers of LLMs.
10Probing.Probing classifiers are extensively used to elucidate the inner workings of LLMs (Alain and Bengio, 2016;Azaria and Mitchell, 2023;Jin et al., 2024;Ju et al., 2024;Templeton et al., 2024;Jiang et al., 2024;Sky et al., 2024).Various works train probes on model representations to assess how well they encode various linguistic features, such as phrase-level, syntactic, and semantic information (Liu et al., 2023a;Marks and Tegmark, 2023;Li et al., 2024).The efficacy of a classifier in a given task indicates the degree to which that layer successfully captures pertinent information.Our study employs probing as a proxy to determine whether the LLMs accurately identify and represent crucial parts of the context.
Experimental Setup
11We conduct a layer-wise probing analysis to determine if the model accurately identifies target information from a given prompt.We expect that higher probing accuracy shows a stronger connection between the model's hidden representations and its internal understanding of the target information.
12Datasets and prompts.We follow the datasets and prompts used by Liu et al. (2023b).Our datasets include: (1) Key-Value Pairs Retrieval (kv-pairs) where the context contains a collection of keys and their corresponding values (128-bit randomly generated UUIDs).The goal of this task is to identify a value given its key.Each prompt for this task contains 100 kv-pairs and a target key.(2) Multi-Document Question Answering (MDQA) where the context contains multiple sets of evidence paragraphs.The goal of this task is to, given a question, identify the relevant document and produce an answer.Each prompt for this task contains 30 documents, and a target question.Given a set of key-value pairs/documents, with only one containing target information, the LLM is prompted to output the value/answer given the key/question.Details (e.g., prompts) are in §A.pairs/documents).The classifier aims to minimize the following objective:
13is the union of all parameters, L is the number of layers, N is the number of data points, C is the number of different gold IDs (classes), x l i represents the input embedding of the l-th layer from the i-th data point, y i is the label for the i-th data point.Ultimately, this recipe gives one probing classifier for embeddings of each layer.Using these models, we show results per layer and across layers.We select training and test datasets that are mutually exclusive across each other, containing entirely different sets of keyvalue pairs/documents.Thus, neither classifiers nor the language model had access to the test samples' gold pair/document ID during the evaluation.We provide implementation details in §B.
14Models and hyperparameters.We employ two SOTA models, LLaMa3-8B-Instruct (AI@Meta, 2024) and Mistral-7B-Instruct-v0.3 (Jiang et al., 2023) to do our probing analysis.The results for the third model, Gemma (Team et al., 2024), are provided in the Appendix due to space constraints.To minimize uncertainty from random initialization, each classifier is trained ten times.We report the mean and standard deviation (error bars) from these ten independent experiments.As we observe in §4, consistency across the three models confirms that the 'Know but Don't Tell' phenomenon is not specific to a single model's architecture.
15Metrics.Following Liu et al. (2023b), we use accuracy to evaluate our models' success.We measure two types of accuracy: (a) Generation accuracy, which quantifies how well LLMs generate the correct value in kv-pair retrieval or the correct We examine the maximum accuracy across all transformer layers as an indicator of whether the model successfully identifies key information within the prompt during the forward pass.Specifically, we choose the probing classifier with the highest accuracy among all layers.This peak layer probing accuracy is displayed in Fig. 2. For comparison, we also present the accuracy of LLMs in generating the answer, independent of our probing classifiers.
16LLMs know but don't tell.Our results indicate that the model's hidden representations do contain information about the location of the target information.Specifically, in the kv-pairs setup (Fig. 2; left) there is always a layer where its probe can almost perfectly identify the location of the correct keyvalue pair associated with the prompt.This holds true even when the LLM provides an incorrect answer or suggests no gold information is present in the input.This suggests a disconnect between the model's ability to locate the information and generate a response based on that information.
17A similar trend is also observed for MDQA (Fig. 2; right) where the peak probing accuracy is consistently higher than the direct answer accuracy, indicating the same disconnect.These findings highlight that while the model can recognize and encode the location of relevant information within its layers, this knowledge does not always translate into an accurate generation answer.
Experiment: Probing Across Layers
18We focus on the probing classifiers' accuracy across LLM layers to understand the flow of information across an LLM's layers.Fig. 3 visualizes the probing classifier accuracy per layer.In both kv-pairs and MDQA setups, we show this accuracy for three positions: when the target information is at the start, middle, or end of the input.
19Middle-context information requires more layers to be located.Our results reveal that LLMs locate target information gradually at early layers.Specifically, in the kv-pair setup (Fig. 3; left), probing accuracy consistently increases until it reaches perfect accuracy at layer 13.Notably, when the target kv-pair is at the middle position of the input prompt, LLM requires more layers to locate the target information.
20The general trends of the MDQA scenario (Fig. 3; right) are similar in principle but with nuanced differences.The patterns vary significantly with the position of target information.Classifiers perform best when the target document is at the start or end of the input context, with early layers near-perfect prediction maintaining across subsequent layers.However, it takes more layers for the probing classifier to achieve peak accuracy when the gold information is in the middle or tail of the context.Interestingly, classifier accuracy decreases after the peak when the target document is in the middle.
21Related to the results in this section, in §D we present visualizations of LLM intermediate representations using PCA and UMAP dimension reduction.In these visualizations, projected representations corresponding to adjacent gold documents are connected by lines.We observe that as the number of layers increases, particularly in the middle layers, the projected representations are spaced apart and arranged in a path.In contrast, these embeddings are more entangled in the earlier layers.This further corroborates our probing results.
Experiment: Number of Layers Taken for
22Locating Target Information
23Our probing experiments ( §4.2) reveal that the model's encoding of target information position improves with more layers but then it degrades.This motivates, the investigation of the relationship between the number of layers needed by the The LLM layer that achieves the peak probing accuracy (x-axis) vs. the accuracy of LLM in generating the correct answer (y-axis).We observe that a later peak correlates with lower accuracy in the language model's final output.This implies that the earlier an LLM encodes information from a specific index, the higher the accuracy of the final output for that position.model to locate target information from the prompt and the LLM's accuracy in generating that target information.
24We conduct additional multi-document probing tasks with 35, 40, 45, and 50 documents.In Fig. 4, for all IDs with probing accuracy exceeding 60% (to minimize the impact of outliers), the x-axis represents the layer where peak probing accuracy is achieved, while the y-axis displays the LLM's generation accuracy (without involving probes).
25Early-layer information localization leads to higher generation accuracy.As Fig. 4 shows, there is a negative correlation between the layer with peak accuracy of locating target information and its final output accuracy.A two-sided t-test was employed to confirm the statistical significance of this observation (p-value < 5e-5; null hypothesis: zero slope).This negative correlation implies that the earlier the model identifies the target document within its layers, the more likely it is to generate an accurate final answer.
Conclusion
26Our study shows that LLMs capture context internally but fail to generate the correct answer due to positional bias.Probing experiments reveal that middle-context information requires deeper layers to be accessed, reducing performance.We also found that delayed extraction leads to lower accuracy.We hope these findings shed more light on the underlying cause behind positional bias and point to new areas for improving long-range information processing in LLMs.
27Knowledge of the gold document's location and the ability to cite from it are distinct but connected; the model might know the location but still, fail to integrate it into a coherent and accurate answer.This comparison does not fully capture the nuanced interactions between the model's internal attention mechanisms and output generation capabilities.While these limitations are acknowledged, they do not detract from the core contributions of our work.Our findings provide insights into the positional effects on model performance and highlight the importance of document sequence in information retrieval tasks.By identifying specific areas where the model struggles, we lay the groundwork for future improvements and optimizations in model design and training.
A Prompting Details
28Following setup by Liu et al. (2023b), we construct key-value pairs retrieval and multi-document question answering prompting dataset.
Key-Value pairs retrieval (kv-pairs)
29We generate n pairs of 128-bit randomly generated UUID.
30Example Key-Value pair "7f666c61-573f-4212-a0a9-6f90d487cd4a" : "2a1d0ba0-cfe4-4df5-987a-6ee1be2c6ac0"
31The n kv-pairs are composed into one single JSON object.To test at ID k, we choose one pair as gold, insert it at ID k, and then construct as a prompt in the format:
32Extract the value corresponding to the specified key in the JSON object below.
JSON data:
33{ "key 1 : "value 1 ", "key 2 ": "value 2 ", ... "key k ": "value k ", ... "key n ": "value n ", } Key: "key k " Corresponding value:
34Multi-document question answering (MDQA) In the n document setting, we randomly select one question answer pair from the dataset by Liu et al. (2023b).Subsequently we retrieve the document containing this answer and mark it as gold.We then sample n − 1 distractors, relevant documents that do not contain the answer.To test at ID k, we randomly shuffle the distractors and then insert the gold document at ID k.Example prompt with gold document at ID k is like: Write a high-quality answer for the given question using only the provided search results (some of which might be irrelevant).
B Probing Setup
35In the experiment described in §3, we employ linear classifiers as our probing method.For any given task, we choose {1, 0.1n, 0.2n, . . ., 1.0n}-th position as gold ID, where n is the number of documents (0.1n for n = 30 means at ID 3).Following the prompt format in §A, we generate prompts with all chosen IDs, for 10, 000 iterations, resulting in a set of 110,000 prompts.Each prompt is fed into language model, and the embedding from each layer's last token is collected.For each layer, separately, we have 110, 000 embeddings corresponding to 11 IDs and train a classifier for ten times, with embedding as input and ID as output.We calculate their mean accuracy and standard deviation.
36C Experiments Results on Gemma-7b-it (Team et al., 2024) Following §4.1 and §4.2, we conduct same experiment procedure on one additional model, which produces the same pattern.The experiment is running on one A100 GPU.The findings for this model also align with the observations in §4.1 and §4.2.On the right, there is a notable gap between generation accuracy and peak probing accuracy, mirroring the results observed with Mistral in the main text.The findings for this model also align with the observations in §4.1 and §4.2.On the left, while the beginning and end contexts follow the same pattern, the middle context exhibits a sudden drop in accuracy, indicating a brief loss of information, which is quickly regained.
D 2D Visualization of Hidden States Per Layer
37We illustrate the model's internal representations by employing Principal Component Analysis (PCA) (Shlens, 2014) (Fig. 7) and Uniform Manifold Approximation and Projection (UMAP) (McInnes et al., 2020) (Fig. 8) to reduce the hidden states to two dimensions.Each subplot depicts the hidden states of a single layer within the Transformer.The subplots feature 11 colored points, each representing a different gold document ID.The color-to-ID mapping can be found in the color bar located in the upper right corner.We reuse the 30-documents prompts.Among this same set of documents, we rotate the ID of the gold document to 11 equally separated positions, as in §B.For the 11 prompts, we extract the last token dimensions from LLaMa3-8B-Instruct and perform dimensional reduction.Each dots in the plot represent a single data point.Below, we calculate the average distance between points in the PCA visualization (Fig. 7).For each layer l (each subfigure), there are 11 points x l 1 , x l 2 , x l 3 , . . ., x l 11 , each corresponding to a different gold ID.We compute the average distance for layer l as d l = 10 i=1 distance(x l i , x l i+1 )/10.As shown in Fig. 9, the average distance d l increases up to layer 21, indicating a growing degree of separability.After reaching the peak distance, it decreases until the final layer.This pattern further supports our probing results.Additionally, as observed in §4.3, most gold IDs achieve peak accuracy around layer 18, which is very close to the peak distance layer (layer 20) identified here.
Average Distance between Points Across Layers
38Figure 9: Average distance between scatter points across layers.The average distance has an obvious increasing trend during early layers, after achieves peak value around layer 21, it gradually decreases.The overall trend is similar to the probing accuracy in Fig. 3.
E Language Generation Logits Trends Across Layers
39We apply the logit lens (nostalgebraist, 2021) to examine the layers where the model begins to produce more probability mass over the correct answer.Specifically, for each layer, we multiply the last token embedding x l with the LM Head and apply SoftMax to obtain the generation distribution over the entire vocabulary.We then record the probability of generating the correct token.The logit lens enables internal analysis of the LLM output distribution flow across layers.We reuse the 30-document prompts and apply the logit lens to each.Fig. 10 shows how the logits for the correct answer evolve across layers, with visualizations for prompts containing the gold document at different locations.x-axis is the layer index, and y-axis is the logits across 1000 different prompts.During middle layers, blue line(ID 30) rises much more significantly than other IDs, however it also drops as the lowest at the last layer.
40For other lines, they share similar patterns in most layers but diverge in last few layers.
41Layer-wise logit divergence.The changes in logits across layers reveal certain key observations:
421.In all prompts, the logits follow an almost identical pattern before layer 20, showing a steady, minimal increase.The divergence begins at layer 20.
432. At layer 20, when the gold document is placed at the end of the prompt, there is a sharp and significant increase in the logits.This is supported by Fig. 3, where the same prompt achieves near-perfect probing accuracy.
443. All prompts reach their peak logit at layer 31, but exhibit a positional bias.The later the gold document appears in the prompt, the higher the peak logit.
45These findings reveal that positional bias emerges during the model's internal processing, with a noticeable shift at a certain layer, where the position of gold information influences the quality of language output.
46The first Nobel in… ⋮ Doc 30: Scientist … Question: who got the first nobel physics prize?
Figure 1 :
47Figure 1: Following prompts by Liu et al. (2023b), we train a probing classifier for each transformer layer to probe the model's ability to identify useful information.The peak accuracy among layers indicates the model's long-context processing effectiveness.
Figure 2 :
48Figure2: Accuracy of LLMs in directly generating answers (blue line) compared to the maximum probing accuracy across layers by our probing classifiers (red line).In both tasks, our probing classifiers surpass the model's generated answers across all gold positions.This highlights a distinction between knowing the context and utilizing it.
Figure 3 :
49Figure 3: The probing accuracy for each layer in the two tasks: kv-pairs (left) and MDQA (right).Different colors represent the position of target information within the input context.In both tasks, extracting mid-context information requires more layers.
50got the first nobel prize in physics Answer: Wilhelm Conrad Röntgen Document: (Title: List of Nobel laureates in Physics) The first Nobel Prize in Physics was awarded in 1901 to Wilhelm Conrad Röntgen, of Germany, who received...
51Document [1](Title: Asian Americans in science and technology) Prize in physics for discovery of the subatomic... ... Document [k](Title: List of Nobel laureates in Physics) The first Nobel Prize in Physics was awarded in 1901... ... Document [n] (Title: Scientist) and pursued through a unique method, was essentially in place.Ramón y Cajal won ... Question: who got the first nobel prize in physics Answer:
Figure 5 :
52Figure5: Replicating the results of Fig.2and Fig.3using the Gemma model with 100 kv-pairs.The findings for this model also align with the observations in §4.1 and §4.2.On the right, there is a notable gap between generation accuracy and peak probing accuracy, mirroring the results observed with Mistral in the main text.
Figure 6 :
53Figure6: Replicating the results of Fig.2and Fig.3using the Gemma model with 30-document MDQA.The findings for this model also align with the observations in §4.1 and §4.2.On the left, while the beginning and end contexts follow the same pattern, the middle context exhibits a sudden drop in accuracy, indicating a brief loss of information, which is quickly regained.
Figure 7 :
54Figure7: PCA visualization across layers: We apply PCA dimension reduction to the last embedding of each layer and visualize the results.The color of the dots indicates the position of the gold document in the prompt, ranging from 0% (gold document at the beginning) to 100% (gold document at the end).We observe that the dots are entangled in the early layers, start to form a path in the order of gold document ID in the middle layers, and this order diminishes in the later layers.This observation further supports our findings in §4.2, indicating that the internal representation of LLMs becomes richer with more layers, although the final layer may not exhibit the peak of representation richness.
Figure 8 :
55Figure 8: UMAP visualization across layers reveals a pattern similar to that in PCA Fig. 7.The embeddings become less entangled in the middle layers and appear more random in the extreme (earlier and final) layers.
Figure 10 :
56Figure 10: Logits of generating the first token of the correct answer across layers.The lines indicate different gold document ID.x-axis is the layer index, and y-axis is the logits across 1000 different prompts.During middle layers, blue line(ID 30) rises much more significantly than other IDs, however it also drops as the lowest at the last layer.For other lines, they share similar patterns in most layers but diverge in last few layers.
참고문헌
참고문헌 정보가 없습니다.