Measuring memorization in RLHF for code completion
On the map: LLM alignment / RLHF / preference optimisation → Reward modeling and RLHF
Abstract (arXiv)
Reinforcement learning with human feedback (RLHF) has become the dominant method to align large models to user preferences. Unlike fine-tuning, for which there are many studies regarding training data memorization, it is not clear how memorization is affected by or introduced in the RLHF alignment process. Understanding this relationship is important as real user data may be collected and used to align large models; if user data is memorized during RLHF and later regurgitated, this could raise privacy concerns. In addition to RLHF, other methods such as Direct Preference Optimization (DPO) and PsiPO have gained popularity for learning directly from human preferences, removing the need for optimizing intermediary reward models with reinforcement learning. In this work, we analyze how training data memorization can surface and propagate through each phase of RLHF and direct preference learning. We focus our study on code completion models, as code completion is one of the most popular use cases for large language models. We find that RLHF significantly decreases the chance that data used for reward modeling and reinforcement learning is memorized in comparison to directly fine-tuning on this data, but that examples already memorized during the fine-tuning stage of RLHF, will, in the majority of cases, remain memorized after RLHF. In contrast, we find that aligning by learning directly from human preference data via a special case of PsiPO, Identity Preference Optimization (IPO), increases the likelihood that training data is regurgitated compared to RLHF. Our work suggests that RLHF, as opposed to direct preference learning, is a safer way to mitigate the risk of regurgitating sensitive preference data when aligning large language models. We find our conclusions are robust across multiple code completion datasets, tasks, and model scales.
Key facts. Cited by 13 papers in the map (data through 14 Oct 2026). Placed in Reward modeling and RLHF, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 30 of its 48 references that are in the map. First posted on arXiv 17 Jun 2024.
Builds on
30 of 48 references.
Closest ancestors · 3
Same direction, newest first
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Model29 May
- 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback12 Apr
- 2017Deep reinforcement learning from human preferences12 Jun
Other references · 27
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2019The Curious Case of Neural Text Degenerationcited by 2,916
- 2020Learning to summarize from human feedbackcited by 2,588
- 2020Extracting Training Data from Large Language Modelscited by 2,189
- 2018Hierarchical Neural Story Generationcited by 1,193
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2023A General Theoretical Paradigm to Understand Learning from Human Preferencescited by 912
- 2022Quantifying Memorization Across Neural Language Modelscited by 763
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
15 more
- 2023Scalable Extraction of Training Data from (Production) Language Modelscited by 434
- 2023Detecting Pretraining Data from Large Language Modelscited by 387
- 2022Efficient Training of Language Models to Fill in the Middlecited by 255
- 2024Do Membership Inference Attacks Work on Large Language Models?cited by 195
- 2023Beyond Memorization: Violating Privacy Via Inference with Large Language Modelscited by 175
- 2021Counterfactual Memorization in Neural Language Modelscited by 156
- 2023Emergent and Predictable Memorization in Large Language Modelscited by 148
- 2018Learning to Write with Cooperative Discriminatorscited by 119
- 2020Trading Off Diversity and Quality in Natural Language Generationcited by 96
- 2019Analyzing Information Leakage of Updates to Natural Language Modelscited by 90
- 2023Exploring Memorization in Fine-tuned Language Modelscited by 45
- 2024Elephants Never Forget: Memorization and Learning of Tabular Data in Large Language Modelscited by 36
- 2024Alpaca against Vicuna: Using LLMs to Uncover Memorization of LLMscited by 33
- 2023Identifying and Mitigating Privacy Risks Stemming from Language Models: A Surveycited by 30
- 2023Assessing Privacy Risks in Language Models: A Case Study on Summarization Taskscited by 8
Built on by
Citing papers per year: 2025: 8; 2026: 5.
13 papers.
Sort:
By area:
- 2025Preference Leakage: A Contamination Problem in LLM-as-a-judgecited by 125
- 2025The Landscape of Memorization in LLMs: Mechanisms, Measurement, and Mitigationcited by 10
- 2025Extracting alignment data in open modelscited by 8
- 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewritingcited by 7
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuningcited by 3
- 2025PATCH: Mitigating PII Leakage in Language Models with Privacy-Aware Targeted Circuit PatcHingcited by 2
- 2025Tuning without Peeking: Provable Generalization Bounds and Robust LLM Post-Trainingcited by 1
- 2025Rethinking Memorization Measures and their Implications in Large Language Modelscited by 1
- 2026Beyond Indistinguishability: Measuring Extraction Risk in LLM APIscited by 1
- 2026How Much Can a LoRA Adapter Memorize? Measuring Adapter Capacity in Bitscited by 1
- 2026Balancing Privacy, Utility, and Safety in LLM Alignment through Preference Optimizationcited by 1
- 2026Behavioral Canaries: Auditing Private Retrieved Context Usage in RL Fine-Tuningcited by 0
1 more
- 2026Balancing Privacy, Utility, and Safety in LLM Alignment through Preference Optimization31 Aug 2026
- 2026How Much Can a LoRA Adapter Memorize? Measuring Adapter Capacity in Bits23 Jul 2026
- 2026Boundary-targeted Membership Inference Attacks on Safety Classifiers21 May 2026
- 2026Behavioral Canaries: Auditing Private Retrieved Context Usage in RL Fine-Tuning24 Apr 2026
- 2026Beyond Indistinguishability: Measuring Extraction Risk in LLM APIs20 Apr 2026
- 2025Extracting alignment data in open models21 Oct 2025
- 2025PATCH: Mitigating PII Leakage in Language Models with Privacy-Aware Targeted Circuit PatcHing8 Oct 2025
- 2025Rethinking Memorization Measures and their Implications in Large Language Models20 Jul 2025
- 2025The Landscape of Memorization in LLMs: Mechanisms, Measurement, and Mitigation8 Jul 2025
- 2025Tuning without Peeking: Provable Generalization Bounds and Robust LLM Post-Training2 Jul 2025
- 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewriting4 Mar 2025
- 2025Preference Leakage: A Contamination Problem in LLM-as-a-judge3 Feb 2025
- 2025The Landscape of Memorization in LLMs: Mechanisms, Measurement, and Mitigationcited by 10
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuningcited by 3
- 2025Tuning without Peeking: Provable Generalization Bounds and Robust LLM Post-Trainingcited by 1
- 2026Beyond Indistinguishability: Measuring Extraction Risk in LLM APIscited by 1
- 2026Boundary-targeted Membership Inference Attacks on Safety Classifierscited by 0
- 2026Boundary-targeted Membership Inference Attacks on Safety Classifiers21 May 2026
- 2026Beyond Indistinguishability: Measuring Extraction Risk in LLM APIs20 Apr 2026
- 2025The Landscape of Memorization in LLMs: Mechanisms, Measurement, and Mitigation8 Jul 2025
- 2025Tuning without Peeking: Provable Generalization Bounds and Robust LLM Post-Training2 Jul 2025
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuning29 Jan 2025
- 2025Preference Leakage: A Contamination Problem in LLM-as-a-judgecited by 125
- 2025Extracting alignment data in open modelscited by 8
- 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewritingcited by 7
- 2025PATCH: Mitigating PII Leakage in Language Models with Privacy-Aware Targeted Circuit PatcHingcited by 2
- 2026How Much Can a LoRA Adapter Memorize? Measuring Adapter Capacity in Bitscited by 1
- 2026How Much Can a LoRA Adapter Memorize? Measuring Adapter Capacity in Bits23 Jul 2026
- 2025Extracting alignment data in open models21 Oct 2025
- 2025PATCH: Mitigating PII Leakage in Language Models with Privacy-Aware Targeted Circuit PatcHing8 Oct 2025
- 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewriting4 Mar 2025
- 2025Preference Leakage: A Contamination Problem in LLM-as-a-judge3 Feb 2025
Similar, not cited
Close in wording, no citation either way
- 2024Secrets of RLHF in Large Language Models Part II: Reward Modeling
- 2024Understanding and Alleviating Memory Consumption in RLHF for LLMs
- 2024Does RLHF Scale? Exploring the Impacts From Data, Model, and Method
- 2024How to Evaluate Reward Models for RLHF
- 2024RLHF Deciphered: A Critical Analysis of Reinforcement Learning from Human Feedback for LLMs
- 2026Reinforcement Learning from Human Feedback: A Statistical Perspective
- 2024Towards Data-Centric RLHF: Simple Metrics for Preference Dataset Comparison
- 2026Generalisation of RLHF under Reward Shift and Clipped KL Regularisation