mlsanityData to 14 Oct 2026

Detecting Functional Memorization in Code Language Models

arXiv 2606.12764 ↗First posted 11 Jun 2026cs.LG cs.CL cs.CRcited by 1

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) are increasingly used to generate code at scale. Meanwhile, prior work has investigated whether training data may be recoverable from model outputs, by auditing the textual overlap between training examples and model generations. Code, however, can preserve the same logic while differing substantially in syntax and structure. We here study functional memorization: the leakage of training data logic from LLM generations in ways that textual audits fail to detect. We leverage AI coding agents to generate diverse test inputs for training data functionality and evaluate whether model-generated continuations produce the same outputs. We formalize this through a counterfactual framework, comparing target models (exposed to specific code) against reference models (not exposed) and requiring functional equivalence only for the target. We instantiate this framework across 4 open-source models and explicitly filter for functions with meaningful logic in 5 programming languages. We find that 0.3-3.4% of filtered functions are counterfactually functionally memorized, i.e., reproduced with equivalent behavior in restructured code that textual metrics fail to detect. We further show that LLM-based judges offer a scalable proxy for execution-based testing, achieving a true positive rate of 68% at 1% false positive rate, and find that functional memorization is associated with semantic duplication in the training corpus.

Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 16 of its 79 references that are in the map. First posted on arXiv 11 Jun 2026.

Builds on

16 of 79 references.

References · 16

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2025Qwen3 Technical Reportcited by 8,820
  3. 2021Program Synthesis with Large Language Modelscited by 3,637
  4. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  5. 2023StarCoder: may the source be with you!cited by 799
  6. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
  7. 2025SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Modelcited by 335
  8. 2023SemDeDup: Data-efficient learning at web-scale through semantic deduplicationcited by 303
  9. 2022Efficient Training of Language Models to Fill in the Middlecited by 255
  10. 2025Olmo 3cited by 129
  11. 2025How much do language models memorize?cited by 61
  12. 2025Rewriting Pre-Training Data Boosts LLM Performance in Math and Codecited by 21
4 more
  1. 2025Extracting alignment data in open modelscited by 8
  2. 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewritingcited by 7
  3. 2025HyClone: Bridging LLM Understanding and Dynamic Execution for Semantic Code Clone Detectioncited by 2
  4. 2025How Small Transformation Expose the Weakness of Semantic Similarity Measurescited by 1

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 1.

1 paper.

Similar, not cited

Close in wording, no citation either way

  1. 2026Memorization Diagnostics for Code LLMs Should be Scale-Aware
  2. 2026Evaluating Language Models on Cross-Language Code Functional Equivalence
  3. 2026UNBIND: UNlearning By INference-time Directional Steering for Code LLMs
  4. 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
  5. 2023Traces of Memorisation in Large Language Models for Code
  6. 2025Functional Consistency of LLM Code Embeddings: A Self-Evolving Data Synthesis Framework for Benchmarking
  7. 2025PACIFIC: a framework for generating benchmarks to check Precise Automatically Checked Instruction Following In Code
  8. 2025Artificial or Just Artful? Do LLMs Bend the Rules in Programming? ↗