## 4 Experiments
### Experimental Results
#### 4.3.4 Case Study of Reasoning Traces  
As demonstrated in the preceding sections, reasoning-enabled LLMs exhibit superior performance over non-reasoning counterparts in vulnerability detection tasks. While both types of models ultimately produce vulnerability assessments, the reasoning models, exemplified by DeepSeek-R1, adopt a structured, step-by-step analysis pipeline that closely resembles human expert review processes. This section analyzes the fundamental differences between reasoning and non-reasoning mechanisms, their influence on detection accuracy, and their potential implications for vulnerability remediation.  
Non-reasoning models typically generate direct and concise outputs that flag potential vulnerabilities based on surface-level features. These outputs are often driven by heuristics derived from training data, such as known insecure code patterns, function calls, or syntactic cues. As a result, such models may overly rely on explicit indicators of insecurity and standard coding idioms. When presented with code that is syntactically correct and incorporates superficial security checks, non-reasoning models may be prone to false negatives, failing to identify deeper semantic flaws or logic-based vulnerabilities.  
In contrast, reasoning models operate with a more deliberate and interpretable analytical process. For instance, DeepSeek-R1 begins by explicitly identifying the security objective of the given task (e.g., buffer bounds checking, input sanitization, memory management), followed by a systematic examination of the code's logic, control flow, and functional semantics. Rather than relying on static patterns, the model attempts to understand the intended behavior of the code, evaluate how input is processed, and identify whether any security guarantees are violated in context. This paradigm shift from pattern recognition to semantic reasoning is aligned with how professional security analysts approach code auditing. A representative reasoning trace from DeepSeek-R1 for a vulnerability case, CWE-787 in packet-dcp-etsi.c (ID: 231378) is illustrated in Figure 13.  
As illustrated in Figure 13, DeepSeek-R1 approaches vulnerability detection through a structured, step-by-step reasoning process. It begins by interpreting the overall purpose of the function, then analyzes how memory is allocated and how pointers are manipulated, and finally identifies specific conditions under which memory access might exceed allocated bounds. This systematic breakdown forms a clear and logical path from input code to vulnerability conclusion, enhancing both transparency and reproducibility--key factors in building developer trust.  
Another notable strength of reasoning-enabled models is their ability to provide quantified probability estimates for each detection. DeepSeek-R1, for instance, outputs a confidence score alongside each vulnerability it identifies, indicating how certain the model is about its assessment. These probabilistic insights allow downstream tools or human reviewers to make informed decisions--such as prioritizing high-confidence vulnerabilities for immediate remediation or flagging low-confidence cases for further analysis.  
Beyond detection, the structured reasoning output of models like DeepSeek-R1 adds value by revealing the root causes of vulnerabilities. By clearly outlining where the logic fails or which operations introduce risk, the model offers actionable insights that can guide remediation. Developers can use this information to refactor problematic code, introduce appropriate validations, or redesign unsafe data flows--ultimately contributing to stronger and more secure software.  
In summary, reasoning-capable models such as DeepSeek-R1 offer notable advantages in software vulnerability detection. They improve not only accuracy but also interpretability and support for mitigation. These qualities make them especially well-suited for integration into real-world secure coding practices, including those in safety-critical domains.