When Models Know but Can't Linearly Say: Relational Encoding Limits Linear Vulnerability Classification in Code LLMs
Rui Melo, Andre Catarino, Claudia Mamede, Corina Pasareanu, Rui Abreu
Key points
From the paper's conclusion- We analyze 8 code models spanning 6.7B-15B parameters on C programs using three datasets (DELTASECOMMITS, SVEN, and PRECISE-BUGS), comparing two diagnostic tasks on the same representations: identifying what patterns the code instantiates, and determining whether it is vulnerable.
Abstract
Large language models can detect vulnerable code, yet the form of vulnerability encoding in their representations remains unclear. We analyze 8 code models spanning 6.7B-15B parameters on C programs using three datasets (DELTASECOMMITS, SVEN, and PRECISE-BUGS), comparing two diagnostic tasks on the same representations: identifying what patterns the code instantiates, and determining whether it is vulnerable. Models encode the first with high fidelity. Under the studied paired C-code datasets and linear-probing setup, vulnerability information is more accessible as a paired relational signal-whether code A is riskier than code B-than as a globally separable categorical label. This structural difference has implications for classification: the model reliably ranks which code is riskier but standard classifiers on isolated samples achieve limited accuracy because vulnerable and secure samples form overlapping distributions in representation space.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Enhancing LLM-Based Vulnerability Detection via Representation-Aware Logical EnsemblearXiv · 2026
- Right Verdict, Right Reason? An Execution-Grounded Study of Whether LLM Vulnerability Detectors Understand VulnerabilitiesarXiv · 2026
- GRAML: Graph-Grounded Reasoning and Multi-Task Learning for LLM-Based Software Vulnerability DetectionarXiv · 2026
- Reassessing Dataset Quality and Fine-Tuning Practices for Vulnerability Detection on PrimeVul datasetarXiv · 2026
- Context-Enhanced Vulnerability Detection Based on Large Language ModelsACM Transactions on Software Engineering and Methodology · 2025
- Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAGACM Transactions on Software Engineering and Methodology · 2026