Skip to content

Evaluating harmful memorization in large language model code generationEvaluating Harmful Memorization in LLM Code Generation

arXiv· arXiv:2503.02296· Lizhe Zhang, Wentao Chen, Li Zhong, Letian Peng, Zilong Wang, Jingbo Shang·Indexed by this site · 24 days ago· Originally publishedEvaluation
AI summary

The researchers propose a code rewriting semantic perturbation pipeline and a harmful memorization index (HMI) to diagnose the failure mode in large language model code generation where, after the task semantics change, the model still generates code highly similar to the original solution. The pipeline constructs task variants that are superficially similar but semantically different by modifying core logic elements of the reference solution and regenerating the corresponding prompts; HMI combines similarity to the original solution with the performance drop on the rewritten task, and the authors note that HMI cannot determine whether the original task or solution appeared in the model's training data. Results on MBPP+ and BigCodeBench show that HMI does not rise monotonically with model scale and often decreases on simpler tasks; high-HMI failures concentrate in specific logic edit types such as constraint changes and data transformations; supervised fine-tuning improves accuracy on the original task but may significantly raise HMI on held-out tasks; among the evaluated post-training settings, PPO exhibits a better accuracy–HMI trade-off than SFT.

Read originalarxiv.org