NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DETAIL: Task DEmonsTration Attribution for Interpretable In-context Learning

Zijian Zhou, Xiaoqiang Lin, Xinyi Xu, Alok Prakash, Daniela Rus, Bryan Kian Hsiang Low

In-context learning (ICL) allows Large Language Models (LLMs) to perform new tasks using only a few demonstrations without parameter updates. However, ICL is notoriously sensitive to the selection and ordering of these demonstrations. To address this, researchers from the National University of Singapore and MIT proposed DETAIL (Task DEmonsTration Attribution for Interpretable In-context Learning), a mathematically grounded framework for attributing model performance to specific demonstrations.

The Internal Optimizer Framework

DETAIL operates on the premise that a transformer's forward pass can be interpreted as an "internal optimizer" solving a kernelized ridge regression problem. By viewing the hidden states as representations being optimized to fit the provided demonstrations, the researchers adapted classical influence functions to the ICL setting.

Methodology

The framework calculates two primary metrics:

  1. Test Influence ($I_{test}$): Measures the contribution of a specific demonstration to the model's prediction on a new test query.
  2. Self-Influence ($I_{self}$): Identifies demonstrations that are inconsistent or outliers relative to the rest of the context.

To handle the high dimensionality of LLM embeddings (e.g., 4096 in Llama-2), DETAIL employs Random Matrix Projection (based on the Johnson-Lindenstrauss lemma). This technique reduces the embedding space to a manageable size (e.g., 1000 dimensions) while preserving the essential information needed for accurate attribution, resulting in a 10x speedup over traditional "Leave-One-Out" (LOO) methods.

The DETAIL framework: From transformer hidden states to influence scores via random projection.

Experimental Evaluation

The authors tested DETAIL across diverse models, including Vicuna-7b, Llama-2 (7b & 13b), Falcon-7b, and the state-space model Mamba-2.8b. Tasks ranged from a toy MNIST-based in-context mapping task to standard NLP benchmarks like AG News, SST-2, and Rotten Tomatoes.

Key Results

DETAIL demonstrated superior performance in identifying "noisy" or corrupted demonstrations. When labels were intentionally corrupted, DETAIL identified them with significantly higher precision than baseline methods. Furthermore, the framework proved effective for prompt curation and reordering.

Performance impact of removing or corrupting high-influence vs. low-influence demonstrations across different models.

Key findings include:

  • Efficiency: DETAIL is approximately 10x faster than LOO attribution.
  • Accuracy Gains: Simply reordering existing demonstrations based on DETAIL scores improved test accuracy by 1.4% to 3.0%.
  • Transferability: Influence scores calculated on open-source "white-box" models (like Vicuna) successfully transferred to closed "black-box" APIs like GPT-3.5. For GPT-3.5, DETAIL-based curation led to a 17.9% average improvement over random selection.

Conclusion

DETAIL provides a robust, efficient, and theoretically sound method for understanding and optimizing in-context learning. By moving beyond trial-and-error prompt engineering, it enables data-driven demonstration selection and ordering, even for models where internal states are inaccessible. Future work may extend this framework to more complex generative tasks like Chain-of-Thought reasoning.

Summary updated

BibTeX
@inproceedings{zhou2024detail,
  author = {Zijian Zhou and Xiaoqiang Lin and Xinyi Xu and Alok Prakash and Daniela Rus and Bryan Kian Hsiang Low},
  title = {{DETAIL: Task DEmonsTration Attribution for Interpretable In-context Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=4jRNkAH15k},
}
Figure