Skip to content

Probing the Prefill: Detecting Code Vulnerabilities via Latent Activations

Aug 2026 · 0 citations · 33 references
Computer Science

Abstract

LLM-based code generation is now embedded in mission-critical pipelines, but defenses against vulnerable output remain post-hoc -- static analyzers, fine-tuned classifiers, or an LLM judge that screen completed code, ignoring the generating model's own internal state. We test a narrower, directly measurable question: when an LLM reads a piece of C/C++ code as context, do its hidden activations already carry a signal about that code's vulnerability status? We extract last prefill token activations from four LLMs (Granite-4.1-8B, Qwen3.5-9B, Qwen3.6-27B, Gemma-4-12B) across three model families and train MLP probes on these activations. We evaluate them on four function-level C/C++ benchmarks (Devign, Big-Vul, Draper VDISC, PrimeVul). Our probes achieve 41.7\% average F1 using 13.4--16.0M-parameter probes -- under 0.2\% of base-model size. On Devign, the best probe (Qwen3.5-9B, 68.8\% F1) matches the published fine-tuned-classifier SOTA (67.9\%) despite reading only a frozen, general-purpose LLM's activations; on the harder, more imbalanced benchmarks (Big-Vul, Draper VDISC, PrimeVul) probes trail SOTA substantially. This is early evidence that a coding LLM's own representation of arbitrary code is informative about that code's vulnerability status, motivating further work toward lightweight, model-native vulnerability screening.

View source

Similar papers

Jul 2026

Routing Ceilings Are Domain-Independent: Structural Prior Injection in Code Security Vulnerability Detection

Large language models (LLMs) exhibit a well-documented gap between latent capability and consistent activation: the router hypothesis posits that models possess the knowledge to solve a task but lack reliable internal routing to activate it. Prior work in formal mathematical reasoning (SAIR, C\'azares 2026) reports tha...

Manuel Israel Cázares · 0 citations
Preprint Aug 2026

Detecting Contaminated Code-Generation Prompt Batches via Influence Functions

The proposed CodeSIFT, a threat-model-agnostic detection method that leverages influence functions to identify batches of prompts that induce anomalous model behavior, suggests that influence-function-based detection is a promising direction for identifying malicious code-generation prompts without requiring prior know...

Francesco Quinzan, Noor Munir, Yi-Shun Lu et al. · 1 citation
Jul 2026

Which Neurons Detect Malicious Code? A Probing Study of LLM Security Knowledge

Probing the neurons associated with security-relevant knowledge helps to gain insights into how LLMs encode malicious programming concepts, identify potentially harmful memorized behaviors, and pave the way toward more reliable defense mechanisms, such as neuron-level editing, selective unlearning, and security-aware a...

Lam D. Dao, V. T. Nguyễn, Anh M. T. Bui et al. · 0 citations
Jul 2026

How Far Are We from Detecting Flaky Tests? On the Limits of Code-Based Detection

It is found that widely used benchmarks contain shortcuts that inflate reported F1 scores and that evaluation protocols overstate generalizability, and reframe flakiness prediction around whether an observed failure is flaky and how likely a test is to fail given its execution environment.

Ömer Oktay Gültekin, Alexander Berndt, Jonathan Bell et al. · 0 citations
Conference Open access 2026

Large Language Model Vulnerabilities

: Large language models are increasingly being deployed in safety-critical domains, yet remain vulnerable to jailbreak attacks that circumvent safety alignments. This systematic review synthesizes empirical jailbreak research published between 2024 and 2025, using a PRISMA-guided search protocol, followed by BERTopic-b...

Meda Račaitytė, Hélder Bastos, R. Ribeiro et al. · 0 citations
#small language model Preprint Aug 2026

Vulnerable Code Search: Transferable Attack for Code Language Models

This paper introduces a programming language-agnostic, transferable, adversarial attack that exploits this CLM vulnerability and demonstrates that this attack, even when computed using smaller code embedding models, is highly effective and transferable to larger, closed-source embedding models.

Kaicheng Wang, Li-Yan Huang, Jesse Thomason et al. · 0 citations

Related blog posts

MIT News · Artificial Intelligence Sep 29, 2026

Who we become when we talk to machines

Professor Sherry Turkle’s new book, “Artificial Intimacy,” offers a withering critique of chatbots and the antisocial dynamics she believes they encourage.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.