CodeSIFT Detects Malicious Code-Generation Prompts Using Influence Functions

Francesco Quinzan, Noor Munir, Yishun Lu, Stephen Roberts· August 17, 2026 View original

Key takeaways

  • LLMs are vulnerable to prompts that elicit insecure code.
  • CodeSIFT uses influence functions to detect anomalous code generation prompts.
  • It is threat-model-agnostic, effective against novel attack patterns.
  • CodeSIFT significantly outperforms static analysis in detecting malicious prompts.

Who benefits

Software DevelopmentCybersecurityAI/ML EngineeringFinTechHealthcare

Summary

CodeSIFT is a novel, threat-model-agnostic method that uses influence functions to identify batches of prompts inducing anomalous behavior in code-generating LLMs, effectively detecting prompts that lead to insecure code without prior knowledge of attack patterns. It outperforms static analysis baselines.

Large language models (LLMs) are increasingly used for generating code, but they are susceptible to malicious prompts that can lead to insecure or vulnerable implementations. Current defense mechanisms often rely on predefined threat models or known vulnerability signatures, which limits their effectiveness against novel or evolving attack strategies. Researchers have developed CodeSIFT, a new detection method that is agnostic to specific threat models. CodeSIFT leverages influence functions to identify batches of prompts that cause an LLM to exhibit anomalous behavior. Instead of looking for particular vulnerabilities, the system measures how the generated code influences the model's parameter space and then uses a statistical test to determine if a given set of prompts deviates significantly from a benign reference distribution. To evaluate CodeSIFT, two new benchmark datasets were created, encompassing a variety of vulnerabilities. The method was tested on three open-weight code LLMs (ranging from 3B to 7B parameters), achieving AUROC scores up to 0.98 at moderate-to-high injection rates. Crucially, CodeSIFT maintained well-calibrated false positive rates and substantially outperformed traditional static analysis baselines, suggesting that influence-function-based detection is a promising direction for identifying malicious code-generation prompts without requiring prior knowledge of the attack class.

Why it matters

This provides a crucial, proactive defense mechanism against the generation of insecure code by LLMs, enhancing the security posture of AI-powered development tools and reducing the risk of introducing vulnerabilities.

How to implement this in your domain

  1. 1Integrate CodeSIFT-like detection into CI/CD pipelines for LLM-generated code.
  2. 2Develop internal tools to monitor and flag anomalous code generation prompts.
  3. 3Train security teams on the principles of influence function-based detection for AI systems.
  4. 4Establish a feedback loop to refine prompt security measures based on detected anomalies.

Original post by Francesco Quinzan, Noor Munir, Yishun Lu, Stephen Roberts

"arXiv:2608.14303v1 Announce Type: new Abstract: Large language models (LLMs) are increasingly used for code generation, yet they remain vulnerable to prompts that elicit insecure implementations. Existing defenses typically rely on predefined threat models or known vulnerability…"

View on X

Originally posted by Francesco Quinzan, Noor Munir, Yishun Lu, Stephen Roberts on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses