Research map / Large language models / Language, safety and interpretability
DeepGuard: Secure Code Generation via Multi-Layer Semantic Aggregation
Li Huang, Zhongxin Liu, Yifan Wu, Tao Yin, Dong Li, Jichao Bi, Nankun Mu, Hongyu Zhang, Meng Yan
Chongqing University · Zhejiang University · Peking University
Read the paperPlace an idea next to itCheck your own paper ↗
AI-extracted. The measured effects below were read by AI from the paper's full text (no summary yet). Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
This paper tried a common change: Add a contrastive loss
add security contrastive loss L_sec · secure code benchmark, Seed-Coder-8B · sec-pass@1: 59.12 -> 80.71 Improved
What 1,804 accepted papers report for this change
- 1,706 improved
- 42 no clear effect
- 21 mixed
- 35 hurt
- Beyond Looking Up, Try Looking Around: Harmonizing Global Structure and Local Consistency in Optimal Transport for Short Text Clustering ICML 2026 · add contrastive learning · SearchSnippets · ACC: 56.65 -> 80.12Improved
- SleepLM: Natural-Language Intelligence for Human Sleep ICML 2026 · add contrastive objective to captioning (CoCa vs Cap) · sleep event IoU · IoU: 29.2 -> 27.4Hurt
- LIMSSR: LLM-Driven Sequence-to-Score Reasoning under Training-Time Incomplete Multimodal Observations ICML 2026 · add contrastive loss L_con · FS1000 average · Spearman correlation: 0.759 -> 0.789Improved
See this change in detailMatched by the wording of each paper's own result, read by AI from the full text. Papers report gains more often than failures, so this shows what gets published, not the chance a change works.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| add security contrastive loss L_sec (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | sec-pass@1: 59.12 -> 80.71 | Improved |
| add KL stability loss L_kl (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | pass@1: 74.12 -> 86.59 | Improved |
| add KL stability loss L_kl (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | sec@1_pass: 98.49 -> 93.21 | Hurt |
| add generation (fluency) loss L_gen (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | sec-pass@1: 78.65 -> 80.71 | Improved |
| add guided inference (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | sec-pass@1: 61.47 -> 80.71 | Improved |
| add prompt conditioning to guided inference (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | sec-pass@1: 66.88 -> 80.71 | Improved |
| use learned token statistics instead of random priors (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | sec-pass@1: 61.06 -> 80.71 | Improved |
| aggregate top-4 layers with attention instead of last layer only (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | sec-pass@1: 73.76 -> 80.71 | Improved |
| attention pooling instead of mean pooling (ablation) | DeepGuard · secure code benchmark, Seed-Coder-8B | sec-pass@1: 78.12 -> 80.71 | Improved |
| enable guided inference (ablation) | DeepGuard · HumanEval | pass@1: Qwen2.5-Coder-3B 62.4 -> 56.0; Seed-Coder-8B 79.6 -> 72.1 | Mixed |
| train with DeepGuard but disable guided inference | DeepGuard · HumanEval | pass@1: Qwen2.5-Coder-3B 52.4 -> 62.4; DeepSeek-Coder-1.3B 34.8 -> 29.4 | Mixed |
| refresh security bias every k=64 tokens | DeepGuard · 300-token generation latency | overhead: +38.7% | Hurt |
Open problems this paper states
- “Requires access to internal hidden states, so it is not directly applicable to API-only or closed-source models.” → The method needs open weights or hidden states, so closed models are out of reach. (an open problem in pruning and circuits in LLMs)
Open problems in pruning and circuits in LLMs
Can circuit and interpretability findings be shown to be causal, and to hold on larger and closed models?
- Larger models than the ones studied are left untested. · 17 papers state it
- Evaluated on English only, so other languages are untested. · 11 papers state it
- Findings are correlational, with no causal test of what the model uses. · 8 papers state it
Closest papers by meaning
- CoreGuard: Safeguarding Foundational Capabilities of LLMs Against Model Stealing in Edge Deployment (NeurIPS 2025 · similarity 0.86)
- CodeMimicry: Exploiting Safety Generalization Lag in Large Language Models via Structured Code Completion (NeurIPS 2026 · similarity 0.86)
- SecCodePRM: A Process Reward Model for Code Security (ICML 2026 · similarity 0.86)
- Instruction Tuning for Secure Code Generation (ICML 2024 · similarity 0.86)
- Safety Layers in Aligned Large Language Models: The Key to LLM Security (ICLR 2025 · similarity 0.86)
- DOMAINEVAL: An Auto-Constructed Benchmark for Multi-Domain Code Generation (AAAI 2025 · similarity 0.86)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.