TRACE: TRansformer-based Attribution using Contrastive Embeddings in LLMs

Cheng Wang, Xinyang Lu, See-Kiong Ng, Bryan Kian Hsiang LowarXiv 2024 · DOI

Introduction

As Large Language Models (LLMs) become integrated into daily life, the "black box" nature of their training data poses significant challenges for accountability. Identifying which specific training source contributed to a model's output is crucial for legal compliance (e.g., GDPR) and intellectual property protection. While Membership Inference (MI) can determine if a specific datum was used, it lacks the granularity required for multi-source attribution.

Methodology

The authors introduce TRACE (TRansformer-based Attribution using Contrastive Embeddings), a framework that frames source attribution as a supervised contrastive learning task.

The TRACE architecture: from source-specific semantic distillation to contrastive projection.

The pipeline involves three primary stages:

  1. Semantic Distillation: Using TF-IDF to extract the most representative "principal sentences" (10-20% of a document) to reduce computational overhead.
  2. Supervised Contrastive Training: An SBERT-based model with a non-linear projection head is trained using the NT-Xent loss function to cluster embeddings from the same source while separating those from different sources.
  3. Proximity-based Inference: Attributing outputs by projecting them into the embedding space and identifying neighbors via Hard kNN, Soft kNN, or Nearest Centroid methods.

Experimental Setup

TRACE was evaluated across three diverse datasets to test its versatility and scalability:

  • Booksum: 405 books treated as individual providers, scaling from 10 to 100 sources.
  • DBpedia_14: 10 distinct encyclopedic classes treated as separate providers.
  • CC_News: 25 domains from a massive news dataset (149M+ documents).

Analysis of Contrastive Embeddings

A primary insight from the study is the effectiveness of contrastive learning in creating highly distinct, compact clusters.

UMAP visualization of embeddings showing clear separation between 25 different data providers.

The compactness of these clusters (shown above) allows the Nearest Centroid method to perform nearly as well as full kNN, significantly reducing inference time. Furthermore, the framework demonstrates model agnosticism, successfully attributing text from T5, GPT-2, and Llama-2 without requiring access to their internal weights. Ablation studies also identified a "Goldilocks" zone for context, finding a WINDOW_SIZE of 30 words optimal for capturing semantic meaning.

Key Results

  • Accuracy: TRACE achieved 84.4% to 86.2% accuracy on the Booksum dataset with 25 providers.
  • Scalability: Top-5 accuracy remained near 80% even when scaling to 100 providers.
  • Robustness: The system is resilient to minor edits and synonym substitution, though paraphrasing remains a challenge, causing a 9.5% drop in accuracy.
  • Interpretability: By linking outputs to the "nearest principal sentence" from the source text, TRACE provides human-verifiable evidence for its attributions.

Discussion and Future Work

While TRACE offers a robust solution for attribution, challenges remain regarding data imbalance and overlapping information across sources. Additionally, the authors note a "privacy paradox": while enhancing transparency, such tools could potentially be used to reverse-engineer sensitive training data, necessitating careful deployment and privacy safeguards.

Summary updated

BibTeX
@misc{wang2024trace,
  author = {Cheng Wang and Xinyang Lu and See-Kiong Ng and Bryan Kian Hsiang Low},
  title = {{TRACE: TRansformer-based Attribution using Contrastive Embeddings in LLMs}},
  year = {2024},
  eprint = {2407.04981},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.04981},
}
Figure