mlsanityData to 26 Nov 2026

Many Repairs, One Direction: Steering Code Models Toward Safer Cryptographic API Use

arXiv 2610.25133 ↗Submitted 18 Oct 2026cs.CR cs.LG cs.SEcited by 0

Not on the map. Why?

Abstract (arXiv)

Cryptographic API misuse in large language model-generated code can compromise software security. While many existing approaches improve code security by modifying model parameters or inputs, how representation changes associated with different cryptographic API repairs can support a shared intervention for safer code generation remains underexplored. To investigate this, we construct 48,000 matched program pairs across four programming languages and ten cryptographic API misuse categories. Each pair changes a specified API decision while preserving the programming task. Subtracting the misuse program's internal representation from its secure counterpart's gives a repair vector. Across five models, comparisons of mean repair vectors reveal stronger organization by misuse category than by language. These category-specific patterns also support a shared intervention. We introduce CrypSteer, which extracts a shared direction by normalizing repair differences and selecting a principal component aligned with repairs across misuse categories. With model weights fixed, adding one shared direction per model to its internal activations during generation improves aggregate target security rates by 5.28--15.00 percentage points over unsteered generation across languages and misuse categories. These findings connect the shared structure of cryptographic repair representations to a reusable intervention for safer code generation.

Key facts. No citing papers in the map yet (data through 26 Nov 2026). Builds on 33 of its 56 references that are in the map. Submitted 18 Oct 2026.

Builds on

33 of 56 references.

References · 33

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,938
  2. 2023Inference-Time Intervention: Eliciting Truthful Answers from a Language Modelcited by 1,427
  3. 2023Steering Llama 2 via Contrastive Activation Additioncited by 1,270
  4. 2023Steering Language Models With Activation Engineeringcited by 1,130
  5. 2021Probing Classifiers: Promises, Shortcomings, and Advancescited by 971
  6. 2019How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddingscited by 832
  7. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 446
  8. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 371
  9. 2025AxBench: Steering LLMs? Even Simple Baselines Outperform Sparse Autoencoderscited by 263
  10. 2022Do Users Write More Insecure Code with AI Assistants?cited by 202
  11. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 165
  12. 2023Inspecting and Editing Knowledge Representations in Language Modelscited by 155
21 more
  1. 2020Contrastive Code Representation Learningcited by 77
  2. 2024Instruction Tuning for Secure Code Generationcited by 75
  3. 2024Prompting Techniques for Secure Code Generation: A Systematic Investigationcited by 37
  4. 2025Steering off Course: Reliability Challenges in Steering Language Modelscited by 37
  5. 2024ProSec: Fortifying Code LLMs with Proactive Security Alignmentcited by 29
  6. 2024A Case Study of LLM for Automated Vulnerability Repair: Assessing Impact of Reasoning and Patch Validation Feedbackcited by 25
  7. 2024PromSec: Prompt Optimization for Secure Generation of Functional Source Code with Large Language Models (LLMs)cited by 22
  8. 2024SecCoder: Towards Generalizable and Robust Secure Code Generationcited by 18
  9. 2026PERSONA: Dynamic and Compositional Inference-Time Personality Control via Activation Vector Algebracited by 17
  10. 2023Efficient Avoidance of Vulnerabilities in Auto-completed Smart Contract Code Using Vulnerability-constrained Decodingcited by 15
  11. 2024An Investigation into Misuse of Java Security APIs by Large Language Modelscited by 12
  12. 2026Why Steering Works: Toward a Unified View of Language Model Parameter Dynamicscited by 12
  13. 2025Denoising Concept Vectors with Sparse Autoencoders for Improved Language Model Steeringcited by 11
  14. 2025A Mixture of Linear Corrections Generates Secure Codecited by 10
  15. 2024INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulnesscited by 9
  16. 2026Surgical Repair of Insecure Code Generation in LLMscited by 4
  17. 2026Exploring Diverse Generation Paths via Inference-time Stiefel Activation Steeringcited by 3
  18. 2026Interpreting and Steering for Safe and Correct Code Generationcited by 3
  19. 2026Steering Code LLMs with Activation Directions for Language and Library Controlcited by 2
  20. 2026Security-by-Design for LLM-Based Code Generation: Leveraging Internal Representations for Concept-Driven Steering Mechanismscited by 1
  21. 2026R+R: Reassessing Java Security API Misuse in Current LLMs: A Replication on JCA and JSSE APIs with External Security Knowledgecited by 1

Built on by

Not cited yet.