Identifying Semantic Induction Heads to Understand In-Context Learning

Jie Ren, Qipeng Guo, Hang Yan, Dongrui Liu, Quanshi Zhang +2 more
2/20/2024
cs.CLcs.AI

No confident code implementation found for this paper.

Abstract

Although large language models (LLMs) have demonstrated remarkable performance, the lack of transparency in their inference logic raises concerns about their trustworthiness. To gain a better understanding of LLMs, we conduct a detailed analysis of the operations of attention heads and aim to better understand the in-context learning of LLMs. Specifically, we investigate whether attention heads encode two types of relationships between tokens present in natural languages: the syntactic dependency parsed from sentences and the relation within knowledge graphs. We find that certain attention heads exhibit a pattern where, when attending to head tokens, they recall tail tokens and increase the output logits of those tail tokens. More crucially, the formulation of such semantic induction heads has a close correlation with the emergence of the in-context learning ability of language models. The study of semantic attention heads advances our understanding of the intricate operations of attention heads in transformers, and further provides new insights into the in-context learning of LLMs.

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{ren2024identifying,
  title  = {Identifying Semantic Induction Heads to Understand In-Context Learning},
  author = {Jie Ren and Qipeng Guo and Hang Yan and Dongrui Liu and Quanshi Zhang and Xipeng Qiu and Dahua Lin},
  year   = {2024},
  eprint = {2402.13055},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2402.13055v2}
}

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/2402.13055.svg)](https://codeofpaper.com/paper/2402.13055)

Discussion