arXiv Science⌕ Search

arXiv subjects

Miaoqing Tian

Publications and source records attributed to Miaoqing Tian.

2 recordsLinked to original sources

GRAML: Graph-Grounded Reasoning and Multi-Task Learning for LLM-Based Software Vulnerability Detection

Large language models (LLMs) have shown promise in software vulnerability detection. Existing approaches leverage program graphs to provide structural evidence for vulnerability analysis and description generation. However, redundant or weakly relevant graph relations make it difficult to identify vulnerability-related code lines and their connections to vulnerable statements. Meanwhile, generated descriptions may omit key information or contain claims unsupported by the source code. To address these challenges, we propose GRAML, a graph-grounded multi-task framework for LLM-based vulnerability detection. Specifically, GRAML uses structural propagation, relation diversity, and redundancy control to identify vulnerability-relevant code lines and their associated program relations. To improve description reliability, we further develop Tree-of-Thought-based Vulnerability Reasoning (ToT-VR), which explores multiple candidate explanations and evaluates their consistency with source code. The resulting descriptions are organized as Description samples and combined with Detection, Localization, and Assessment samples for four-task fine-tuning. We evaluated four code LLMs on seven vulnerability detection datasets. In particular, GRAML achieves average F1 scores of 67.08% to 69.32%, outperforming the evaluated baselines by 2.02 to 31.54 percentage points. Furthermore, ToT-VR improves average F1 by 4.43 to 6.99 percentage points over Chain-of-Thought (CoT)-based description generation, while multi-task training improves it by 8.03 to 18.26 percentage points over Detection-only training. These results demonstrate the effectiveness of graph-grounded multi-task supervision for software vulnerability detection.

cs.SE↗

Trained on Harm, Still Refusing: A Training-Time Defense for Code Generation

Fine-tuning enables safety-aligned code language models to adapt to diverse downstream tasks. However, training on untrusted data can severely undermine their ability to refuse harmful requests. Notably, we find that models comply with harmful requests even though harmfulness information remains highly decodable from their internal representations. Moreover, an initial preference for refusal does not necessarily translate into sustained refusal behavior throughout generation. Together, these findings reveal a critical gap between recognizing harmful requests and consistently refusing to fulfill them. To address this gap, we introduce SAFEHOLD, a novel provider-enforced defense framework that preserves safety alignment during harmful fine-tuning by treating refusal as a sustained generation process rather than a single response decision. Specifically, SAFEHOLD preserves the aligned model's full-vocabulary response distribution at the initial generation position through decision-boundary anchoring, while supervising the complete refusal sequence through refusal-path reinforcement. We conduct extensive experiments evaluating safety, utility, and internal mechanisms. SAFEHOLD reduces average ASR by 72.03 percentage points relative to undefended fine-tuning, outperforming five SOTA defenses by 24.32 to 70.87 percentage points. Meanwhile, it improves average HumanEval pass@1 by 10.24 percentage points over undefended fine-tuning, while maintaining an average XSTest over-refusal rate of only 2.73 percent. Overall, these results demonstrate that SAFEHOLD effectively mitigates safety degradation during harmful fine-tuning while preserving benign-task utility.

cs.AI↗