ContextCite: Attributing Model Generation to Context

Benjamin Cohen-Wang, Harshay Shah, Kristian Georgiev, Aleksander Madry
9/1/2024
cs.LGcs.CL

Official code: MadryLab/context-cite (337 stars, MIT, PyTorch, last commit 2024-10-08).

Abstract

How do language models use information provided as context when generating a response? Can we infer whether a particular generated statement is actually grounded in the context, a misinterpretation, or fabricated? To help answer these questions, we introduce the problem of context attribution: pinpointing the parts of the context (if any) that led a model to generate a particular statement. We then present ContextCite, a simple and scalable method for context attribution that can be applied on top of any existing language model. Finally, we showcase the utility of ContextCite through three applications: (1) helping verify generated statements (2) improving response quality by pruning the context and (3) detecting poisoning attacks. We provide code for ContextCite at https://github.com/MadryLab/context-cite.

View on arXivView PDF

Code Implementations(1)

PyTorchMIT

Attribute (or cite) statements generated by LLMs back to in-context information.

33724Python, Jupyter NotebookApr 30, 20242 years agoMIT
attributionhuggingfacellmpytorch

Similar Papers

Cite this paper

@article{cohenwang2024contextcite,
  title  = {ContextCite: Attributing Model Generation to Context},
  author = {Benjamin Cohen-Wang and Harshay Shah and Kristian Georgiev and Aleksander Madry},
  year   = {2024},
  eprint = {2409.00729},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2409.00729},
  url    = {http://arxiv.org/abs/2409.00729v2},
  journal = {NEURIPS 2024 2024}
}

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

Discussion