Poisoning 10% of a code dataset stays compilable and functionally correct
FunPoison can degrade unauthorized training while preserving 100% compilability and functional correctness using only 10% of the dataset
Software arXiv 24 Apr 2026 Defense Simulation evidence
Published as “Train in Vain: Functionality-Preserving Poisoning to Prevent Unauthorized Use of Code Datasets”
Why it matters
Dataset owners can deter unauthorized fine-tuning of CodeLLMs without breaking code usability, enabling practical protection of copyrighted code.
Summary
FUNPOISON degrades fine-tuning gains of CodeLLMs with only 10% of the dataset poisoned while preserving 100% compilability and functional correctness; the evidence includes a significant negative ΔPass@1 at 10% poisoning and zero runtime impact on real-world code.
What they found 5
- Effective poisoning at low injection ratio with full compilability
“FUNPOISON achieves effective poisoning by contaminating only 10% of the dataset, while maintaining 100% compilability and functional correctness.”
- Significant performance degradation at 10% poisoning
“When the poisoning rate reaches 10%, FUNPOISON already yields a clear negative effect (with ∆Pass@1 becoming significantly negative), and this degradation intensifies as the poisoning rate increases (e.g., it is more pronounced at 50%).”
- 100% compilation success on poisoned code
“Compilation success 984/984”
- Execution-path placement drives degradation, not mere template exposure
“As shown in Table 2, DeadBranchInsertion at 10% matches clean finetuning, while FUNPOISON at the same rate reduces Pass@1 to 0.20.”
- Negligible runtime overhead on poisoned programs
“The results show that all poisoned programs run correctly and incur negligible overhead: the mean p95 latency increase is only 2.29%, with memory overhead below 0.1%.”
Caveats 4
- We evaluate FUNPOISON on Java, but this is not a complete cross-language study.
- Compact or highly optimized functions may have few valid execution-safe insertion sites. In CodeSearchNet Java, 80.3% of functions admit valid sites under full coverage, and FUNPOISON operates at the dataset level rather than requiring every function to be poisoned.
- FUNPOISON is not theoretically unremovable.
- The effect under substantially different training regimes, such as aggressive curriculum learning, large-scale pretraining from scratch, or reinforcement-learning-based adaptation, remains open.
What’s new here 4
- Injects short, compilable weak-use fragments that preserve program semantics, unlike prior destructive transformations.
- Achieves strong poisoning effect with only 10% of the dataset poisoned.
- Maintains 100% compilation success and functional equivalence across benchmarks and a large real-world codebase.
- Demonstrates robustness against detection, purification, rewriting, static-analysis, formatting, and adaptive detectors.