Are Sparse Autoencoders Useful for Java Function Bug Detection?
On the map: Mechanistic interpretability → Steering and probing for LLM safety
Abstract (arXiv)
Software vulnerabilities such as buffer overflows and SQL injections are a major source of security breaches. Traditional methods for vulnerability detection remain essential but are limited by high false positive rates, scalability issues, and reliance on manual effort. These constraints have driven interest in AI-based approaches to automated vulnerability detection and secure code generation. While Large Language Models (LLMs) have opened new avenues for classification tasks, their complexity and opacity pose challenges for interpretability and deployment. Sparse Autoencoder offer a promising solution to this problem. We explore whether SAEs can serve as a lightweight, interpretable alternative for bug detection in Java functions. We evaluate the effectiveness of SAEs when applied to representations from GPT-2 Small and Gemma 2B, examining their capacity to highlight buggy behaviour without fine-tuning the underlying LLMs. We found that SAE-derived features enable bug detection with an F1 score of up to 89%, consistently outperforming fine-tuned transformer encoder baselines. Our work provides the first empirical evidence that SAEs can be used to detect software bugs directly from the internal representations of pretrained LLMs, without any fine-tuning or task-specific supervision. Code available at https://github.com/rufimelo99/SAE-Java-Bug-Detection
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in Steering and probing for LLM safety, one of 13 directions in Mechanistic interpretability. Builds on 25 of its 38 references that are in the map. First posted on arXiv 15 May 2025.
Builds on
25 of 38 references.
References · 25
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021On the Opportunities and Risks of Foundation Modelscited by 4,033
- 2023Sparse Autoencoders Find Highly Interpretable Features in Language Modelscited by 1,420
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2024Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inferencecited by 554
- 2024Scaling and evaluating sparse autoencoderscited by 553
- 2024Gemma Scope: Open Sparse Autoencoders Everywhere All At Once on Gemma 2cited by 394
- 2024Jumping Ahead: Improving Reconstruction Fidelity with JumpReLU Sparse Autoencoderscited by 300
- 2025Open Problems in Mechanistic Interpretabilitycited by 179
- 2016Linear Algebraic Structure of Word Senses, with Applications to Polysemycited by 165
- 2024A is for Absorption: Studying Feature Splitting and Absorption in Sparse Autoencoderscited by 160
- 2024BatchTopK Sparse Autoencoderscited by 130
13 more
- 2025Are Sparse Autoencoders Useful? A Case Study in Sparse Probingcited by 115
- 2021Transformer visualization via dictionary learning: contextualized embedding as a linear superposition of transformer factorscited by 108
- 2021CURE: Code-Aware Neural Machine Translation for Automatic Program Repaircited by 86
- 2023Impact of Code Language Models on Automated Program Repaircited by 85
- 2024RAVEL: Evaluating Interpretability Methods on Disentangling Language Model Representationscited by 79
- 2024Applying sparse autoencoders to unlearn knowledge in language modelscited by 59
- 2023RepairLLaMA: Efficient Representations and Fine-Tuned Adapters for Program Repaircited by 50
- 2024Efficient Dictionary Learning with Switch Sparse Autoencoderscited by 39
- 2024Evaluating Open-Source Sparse Autoencoders on Disentangling Factual Knowledge in GPT-2 Smallcited by 34
- 2025Automated Interpretability Metrics Do Not Distinguish Trained and Random Transformerscited by 30
- 2024A Philosophical Introduction to Language Models - Part II: The Way Forwardcited by 18
- 2024GitBug-Java: A Reproducible Benchmark of Recent Java Bugscited by 14
- 2025Propositional Interpretability in Artificial Intelligencecited by 12
Built on by
Citing papers per year: 2025: 1; 2026: 1.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2026An Empirical Evaluation of LLM-Based Approaches for Code Vulnerability Detection: RAG, SFT, and Dual-Agent Systems
- 2024Direction for Detection: A Survey of Automated Vulnerability Detection and all of its Pain Points
- 2026Exploring Automated Vulnerability Identification in JavaScript Code Using Large Language Models
- 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMs
- 2026Revisiting Vul-RAG: Reproducibility and Replicability of RAG-based Vulnerability Detection with Open-Weight Models
- 2025Automated Vulnerability Validation and Verification: A Large Language Model Approach
- 2026ConceptCoder: Improve Code Reasoning via Concept Learning
- 2024Towards Explainable Vulnerability Detection with Large Language Models