ISACL: Internal State Analyzer for Copyrighted Training Data Leakage

Guangwei Zhang, Qisheng Su, Jiateng Liu, Cheng Qian, Yanzhou Pan, Yanjie Fu, Denghui Zhang · OpenReview

Abstract

Large Language Models (LLMs) have revolutionized Natural Language Processing (NLP) but pose risks of inadvertently exposing copyrighted or proprietary data, especially when such data is used for training but not intended for distribution. Traditional methods address these leaks only after content is generated, which can lead to the exposure of sensitive information. This study introduces a proactive approach: examining LLMs' internal states before text generation to detect potential leaks. By using a curated dataset of copyrighted materials, we trained a neural network classifier to identify risks, allowing for early intervention by stopping the generation process or altering outputs to prevent disclosure. Integrated with a Retrieval-Augmented Generation (RAG) system, this framework ensures adherence to copyright and licensing requirements while enhancing data privacy and ethical standards. Our results show that analyzing internal states effectively mitigates the risk of copyrighted data leakage, offering a scalable solution that fits smoothly into AI workflows, ensuring compliance with copyright regulations while maintaining high-quality text generation.

Introduction

Large Language Models (LLMs) are notorious for "memorizing" chunks of their training data. When prompted correctly, they can regurgitate copyrighted text—from famous fiction to proprietary code—verbatim. Current solutions usually rely on output filtering, which checks generated text against a database. This approach is problematic due to high latency, the exposure of sensitive information in internal logs before filtering, and potential inaccuracies in catching paraphrased content.

ISACL (Internal State Analyzer for Copyrighted Training Data Leakage) proposes moving the checkpoint from the output stage to the prefill stage—the moment the model processes the user's prompt but before it starts decoding the answer.

Methodology: Reading the LLM's "Mind"

The core innovation of ISACL is treating copyright leakage as a classification problem based on the LLM's latent representations. When a prompt is processed, ISACL extracts internal hidden state activations from the final encoder layer.

High-level workflow of ISACL detecting leakage risk by analyzing internal states before decoding.

To boost accuracy, the system is integrated with a Retrieval-Augmented Generation (RAG) component. It uses the input prompt to query a database of copyrighted materials indexed via FAISS. The retrieved reference text is encoded and concatenated with the LLM’s internal states, providing a "ground truth" for a Multi-Layer Perceptron (MLP) classifier to compare against. If the classifier predicts a high risk of leakage, the system can halt generation immediately.

Detailed architecture of the ISACL framework, including database construction, model training, and the RAG-integrated inference pipeline.

Datasets and Evaluation

The researchers evaluated ISACL using a mix of literal and non-literal copying tasks:

  • Literal Copying: Excerpts from 16 famous fiction titles (e.g., 1984, Dune, Harry Potter) using the BookMIA dataset.
  • Non-Literal Copying: To test paraphrasing detection, the team used CliffsNotes study guides and human-written summaries to see if the model could detect replication of specific plot points without exact wording.
  • Models Tested: The framework was validated across the Llama (8B, 13B, 70B) and Mistral (7B) families.

Key Results

  • High Accuracy: ISACL achieved accuracy and F1 scores ranging from 91.88% to 95.05%. In tests with the 70B model, it reached near-perfect detection rates.
  • Massive Speedup: ISACL is roughly 10 to 20 times faster than "LLM-as-a-Judge" baselines. For example, on Llama-3.1-8B, ISACL took about 0.05s to assess risk, compared to 0.49s for standard checks.
  • Scaling Success: Unlike many safety tools, ISACL performs better on larger models because their internal states are more semantically rich and distinct.

Conclusion and Future Work

ISACL demonstrates that an LLM’s "intention" to leak data is semantically present in its hidden layers before it ever picks a word. While the system performs exceptionally well on literal copying, non-literal leakage (paraphrasing) remains a difficult frontier. Future work aims to develop more sophisticated agents that can cross-reference against complex, multi-modal data usage policies in real-time.

Summary updated

BibTeX
@misc{zhang2025isacl,
  author = {Guangwei Zhang and Qisheng Su and Jiateng Liu and Cheng Qian and Yanzhou Pan and Yanjie Fu and Denghui Zhang},
  title = {{ISACL: Internal State Analyzer for Copyrighted Training Data Leakage}},
  year = {2025},
  eprint = {2508.17767},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.17767},
}
Figure