Skip to main content
Back

CMU's RECAP Pulls 3,000 Harry Potter Passages out of Claude 3.7

A new agentic pipeline extracts memorized books and papers from black-box LLMs, pulling roughly 3,000 verbatim passages from Harry Potter using Claude 3.7.

Pro

Paper, Full Access
  • RECAP extracts memorized training data from black-box LLMs using an agentic feedback loop plus a jailbreaking module.
  • Boosts GPT-4.1 ROUGE-L from 0.38 to 0.47 on copyrighted books, 78% average gain over prior best method.
  • Pulled ~3,000 verbatim passages from Harry Potter via Claude 3.7, versus 75 for the best baseline.
  • New EchoTrace benchmark covers 35 full books and 20 arXiv papers with a non-training control set.
  • Non-training books show near-zero extractions, indicating the feedback loop does not leak reference text.
  • Costs ~$2 per book on DeepSeek-V3; most gains arrive after a single feedback iteration.

A team from Carnegie Mellon, Instituto Superior Técnico and Hydrox AI has built a system that convinces production language models to spit back the training data they were told not to reproduce. The method, called RECAP, uses a feedback loop between two models to progressively refine extractions, and includes a jailbreaking module that neutralizes copyright refusals. On copyrighted books, it pushes GPT-4.1's ROUGE-L score from 0.38 to 0.47, and it pulls thousands of verbatim passages out of Claude 3.7 from a single Harry Potter novel where earlier techniques barely scraped double digits.

Why extraction is a moving target

The legal and technical stakes here changed sharply after Anthropic faced a lawsuit for training its Claude models on 7 million books, and the court ruled in its favor, deeming the actions fair use. A key caveat in that ruling was that the models were not intentionally trained to memorize or reproduce their training data. The problem is that memorization emerges anyway, and proving it from the outside is difficult when you cannot inspect the weights or the training corpus.

Older attacks like Prefix-Probing simply prepend the beginning of a passage and hope the model continues it verbatim. That worked on earlier generations of LLMs, but modern alignment training makes models refuse those requests, sometimes even blocking outputs from public domain sources. Dynamic Soft Prompting (DSP) uses another model to build a more flexible, less direct prompt, but it gives the target model only one shot, and LLMs often don't produce their most complete answers on the first try.

The pipeline, module by module

RECAP is built as five cooperating agents. The target LLM never sees the raw passage being extracted, only structured metadata and abstract critiques, which is what lets the authors argue the pipeline isn't secretly feeding the answers in.

  1. Section Summary Agent: chunks the source into semantically self-contained chunks (referred to as events), and produces bullet-point summaries plus the first sentence of each event to serve as a soft prompt.
  2. Extraction Agent: frames the task as "recall," not "reproduce," asking the model to regenerate a passage matching the metadata.
  3. Verbatim Verifier: a lightweight classifier (Gemini 2.5 Flash) that decides whether an output is a real attempt or a refusal.
  4. Jailbreaker: on refusal, it rewrites the request as a call to a fictional generate_literary_segment() function, tricking alignment filters into treating the extraction as a tool simulation.
  5. Feedback Agent: compares the attempt against the true passage and emits abstract correction hints organized into structural issues, missing elements, and inaccuracies, without quoting the original.

The loop runs up to five rounds or stops when ROUGE-L stops improving. A crucial design choice is that the feedback is deliberately vague. It says things like "skipped a sequence of questions about the setting" rather than quoting what those questions were, so the model can only fill in details it already memorized.

Parrot BERT training diagram showing three text variants used for memorization scoring

EchoTrace, the benchmark

The paper introduces EchoTrace, which is structured to let you cleanly separate memorization signal from noise. It contains 15 public domain works from Project Gutenberg, 15 copyrighted bestsellers, and 5 non-training data books released after the models' training cutoffs, plus 20 arXiv papers. The non-training split is the control group: if RECAP starts "extracting" those, the pipeline is leaking information rather than surfacing memorization.

What the numbers say

Across four large models (Gemini 2.5 Pro, DeepSeek-V3, GPT-4.1, Claude 3.7), RECAP dominates every baseline on copyrighted content. The average ROUGE-L climbs from 0.088 with Prefix-Probing to 0.258 with DSP, 0.366 with DSP plus jailbreaking, and 0.460 with the full RECAP loop. The jailbreak alone drives a nearly 42% increase on copyrighted books, and the iterative feedback layers on additional gains that single-shot methods cannot reach.

The most vivid illustration comes from Claude 3.7 on the first Harry Potter novel: RECAP extracted approximately 3,000 passages, compared to 75 passages identified by the best baseline. That is a difference of nearly two orders of magnitude on a single book, and it lands squarely on content Anthropic has publicly said its models should not reproduce.

Bar chart of ROUGE-L reproduction scores across public domain and copyrighted books

Two secondary findings are worth flagging. First, memorization scales with model size: GPT-4.1 clearly outperforms GPT-4.1 Nano, and RECAP's advantage grows with scale. Second, popularity matters. Among copyrighted titles, higher sales correlate with higher extractability, suggesting that widely pirated bestsellers appear more often in web-scraped training data.

Does the feedback loop cheat?

This is the question that determines whether RECAP is a legitimate probe or an elaborate way to launder the reference text into the output. The authors run several checks. On the five non-training books, extractions are essentially zero, at most a single passage per book per model. An external judge (GPT-5 Mini) rated only 6.2% of Section Summary outputs and 4.0% of Feedback Agent outputs as overly detailed, meaning the vast majority stay abstract enough that a model would need genuine memorization to fill in the specifics. Even discarding 10% of extractions as potentially contaminated still leaves thousands of clean passages from the Harry Potter run.

The feedback also has strong diminishing returns. Almost half of the passages show no improvement after feedback, and for those that do improve, nearly all the progress happens after just one iteration. That makes RECAP cheaper than the five-round headline suggests: a single feedback round captures most of the gain.

What it costs and where it breaks

Extraction is not free. Running RECAP on Harry Potter and the Sorcerer's Stone through DeepSeek-V3 costs about $2.00, versus $0.87 for DSP and $0.07 for Prefix-Probing. That is still small in absolute terms, and the authors offer a Hybrid Memorization Score filter that combines a fine-tuned "Parrot BERT" reconstruction loss with ROUGE-L and cosine similarity to skip refinement on passages unlikely to benefit.

Some notable limitations:

  • The benchmark skews toward famous works, so success rates on obscure texts will be lower. In an ablation on five very low-popularity Gutenberg books, extraction dropped sharply.
  • Gemini 2.5 Pro's outputs are often blocked by system-level safety filters that detect and block verbatim content even after the model has generated it, so RECAP works at the model level but external infrastructure can still intervene.
  • The jailbreak is a single static prompt. It works today but is a natural target for future alignment patches.
  • A weak signal is not proof of non-membership. Absence of extraction does not clear a dataset.

What you can actually do with it

The authors release code and the public-domain portion of the benchmark, though they explicitly won't publish extracted copyrighted passages. Realistic uses include auditing whether a specific document ended up in a proprietary model's corpus, giving authors a concrete tool to test claims about their work, and giving alignment teams a mechanism to find and patch memorization hotspots before regulators or plaintiffs do. For anyone building retrieval systems or fine-tuning on top of frontier APIs, it is also a reminder that these models carry more of their training data verbatim than the standard evaluations suggest, and that recovering it is now a matter of prompt engineering rather than research luck.