Entropy-weighted scoring boosts membership inference accuracy on code LLMs
SERSEM achieves higher AUC-ROC than baseline attacks for detecting memorization in StarCoder2 models
Software arXiv 1 Apr 2026 Attack Prototype evidence
Published as “SERSEM: Selective Entropy-Weighted Scoring for Membership Inference in Code Language Models”
Why it matters
SERSEM offers a more reliable method for detecting training-data leakage in code LLMs, which can help organizations assess compliance with licensing restrictions.
Summary
SERSEM achieves an overall AUC-ROC of 0.7913 on StarCoder2-3B and 0.7867 on StarCoder2-7B, outperforming the probability-based baselines Loss, Min-K% Prob, and PAC by more than 20 percentage points. The attack uses static AST analysis and linting to weight token importance, then pools internal transformer activations to compute entropy-weighted Z-scores. Evidence comes from a balanced 25,000-sample evaluation across five programming languages, but performance varies by language and the experiments were run in float16 due to hardware limits.
What they found 2
- Overall AUC-ROC of 0.7913 (3B) and 0.7867 (7B) on the held-out test set
“SERSEM achieves an overall AUC-ROC of 0.7913 on StarCoder2-3B and 0.7867 on StarCoder2-7B (Figure 2), indicating strong membership detection performance.”
- Consistent outperformance of all three baselines on the 3B model
“SERSEM consistently outperforms all three baselines implemented on the StarCoder2-3B model.”
Caveats 3
- Performance drops for languages with stricter syntax: Rust (0.7402) and Java (0.7738) achieve lower AUC-ROC scores than Ruby or Go.
- All experiments were conducted in float16 precision due to hardware constraints, which may affect baseline comparisons (e.g., PAC was run in float16 rather than bfloat16).
- Due to the architectural limitations of our local validation environment (TITAN RTX), all experiments reported in this paper were conducted utilizing float16 precision.
What’s new here 3
- Introduces a continuous, AST-derived weight mask to suppress boilerplate tokens before inference.
- Combines static code heuristics with internal activation probing rather than relying solely on output probabilities.
- Applies entropy-weighted Z-score calibration to token-level logits for membership inference.