mlsanityData to 14 Oct 2026

MACGen: Toward Functionally Correct and Secure Code Generation via Multi-Agent Collaboration

arXiv 2608.25457 ↗First posted 26 Aug 2026cs.CR cs.AI cs.MAcited by 0

On the map: LLM agents and tool use → Agent threats, guardrails and governance

Abstract (arXiv)

Despite their strong ability to generate code, large language models often fail to produce secure code, as their outputs frequently contain security vulnerabilities. Secure code generation is inherently challenging because it requires solving a multi-objective problem: functional correctness and security. Existing approaches address this challenge by injecting external security knowledge or by using agentic feedback and iterative refinement. However, guideline retrieval often leaves the generator to translate generic advice into task-specific secure implementations, while shared-dialogue multi-agent feedback can blur role boundaries and suffer from context bloat. We present MACGen, a multi-agent framework that integrates planning, security analysis, code synthesis and refinement to jointly optimize security and functionality. A planner constructs a step-by-step plan to satisfy functional requirements. A security advisor identifies likely CWEs and synthesizes task-specific guidelines, a coder then generates code grounded in these artifacts, and a reviewer issues perspective-separated feedback. Rather than sharing full dialogue histories, each agent receives only structured artifacts from upstream stages, enforcing role specialization and reducing uncontrolled context growth. On CWEval and BaxBench, MACGen improves F&S@1 over direct prompting by 19.61 and 10.57 percentage points (pp) on average, respectively.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 26 of its 46 references that are in the map. First posted on arXiv 26 Aug 2026.

Builds on

26 of 46 references.

Closest ancestors · 1

Same direction, newest first

  1. 2024AutoSafeCoder: A Multi-Agent Framework for Securing LLM Code Generation through Static Analysis and Fuzz Testing16 Sep

Other references · 25

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  2. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
  3. 2017Billion-scale similarity search with GPUscited by 2,497
  4. 2023CAMEL: Communicative Agents for "Mind" Exploration of Large Language Model Societycited by 1,395
  5. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
  6. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  7. 2024MapCoder: Multi-Agent Code Generation for Competitive Problem Solvingcited by 177
  8. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
  9. 2024jina-embeddings-v3: Multilingual Embeddings With Task LoRAcited by 141
  10. 2023Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Modelscited by 138
  11. 2023How Secure is Code Generated by ChatGPT?cited by 81
  12. 2024Instruction Tuning for Secure Code Generationcited by 68
13 more
  1. 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 62
  2. 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 59
  3. 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 41
  4. 2024ReposVul: A Repository-Level High-Quality Vulnerability Datasetcited by 36
  5. 2024Prompting Techniques for Secure Code Generation: A Systematic Investigationcited by 34
  6. 2025CODESIM: Multi-Agent Code Generation and Problem Solving through Simulation-Driven Planning and Debuggingcited by 32
  7. 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injectioncited by 16
  8. 2024SecCoder: Towards Generalizable and Robust Secure Code Generationcited by 14
  9. 2025Benchmarking Prompt Engineering Techniques for Secure Code Generation with GPT Modelscited by 12
  10. 2025Teaching an Old LLM Secure Coding: Localized Preference Optimization on Distilled Preferencescited by 10
  11. 2024INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulnesscited by 8
  12. 2025RESCUE: Retrieval Augmented Secure Code Generationcited by 7
  13. 2026DeepGuard: Secure Code Generation via Multi-Layer Semantic Aggregationcited by 2

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward
  2. 2025SCGAgent: Recreating the Benefits of Reasoning Models for Secure Code Generation with Agentic Workflows
  3. 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agents
  4. 2026SEEK: Agentic Knowledge Graph Retrieval for Secure Code Generation
  5. 2025RA-Gen: A Controllable Code Generation Framework Using ReAct for Multi-Agent Task Execution
  6. 2026Twin Agent: Context Residual Compression for Privilege Separated Agents
  7. 2026Security-by-Design for LLM-Based Code Generation: Leveraging Internal Representations for Concept-Driven Steering Mechanisms
  8. 2025Multi-Agent Code-Orchestrated Generation for Reliable Infrastructure-as-Code