Decoding In-Context Learning: Neuroscience-inspired Analysis of Representations in Large Language Models

Safoora Yousefi, Leo Betthauser, Hosein Hasanbeig, Raphaël Millière, Ida Momennejad
9/30/2023
cs.CL

No confident code implementation found for this paper.

Abstract

Large language models (LLMs) exhibit remarkable performance improvement through in-context learning (ICL) by leveraging task-specific examples in the input. However, the mechanisms behind this improvement remain elusive.

Show full abstract

In this work, we investigate how LLM embeddings and attention representations change following in-context-learning, and how these changes mediate improvement in behavior. We employ neuroscience-inspired techniques such as representational similarity analysis (RSA) and propose novel methods for parameterized probing and measuring ratio of attention to relevant vs. irrelevant information in Llama-2 70B and Vicuna 13B. We designed two tasks with a priori relationships among their conditions: linear regression and reading comprehension. We formed hypotheses about expected similarities in task representations and measured hypothesis alignment of LLM representations before and after ICL as well as changes in attention. Our analyses revealed a meaningful correlation between improvements in behavior after ICL and changes in both embeddings and attention weights across LLM layers. This empirical framework empowers a nuanced understanding of how latent representations shape LLM behavior, offering valuable tools and insights for future research and practical applications.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{yousefi2023decoding,
  title  = {Decoding In-Context Learning: Neuroscience-inspired Analysis of Representations in Large Language Models},
  author = {Safoora Yousefi and Leo Betthauser and Hosein Hasanbeig and Raphaël Millière and Ida Momennejad},
  year   = {2023},
  eprint = {2310.00313},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.00313v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2310.00313.svg)](https://codeofpaper.com/paper/2310.00313)

Discussion