# Summary: 2026-08-26_07-21-56Z_MACGen_TowardFunctionallyCorrectandSecureCodeGener.md Saved: 2026-08-26 20:53 Source: 2026-08-26_07-21-56Z_MACGen_TowardFunctionallyCorrectandSecureCodeGener.md Model: None --- ## Summary The paper introduces MACGen, a multi‑agent framework that jointly optimizes functional correctness and security in code generation. It addresses limitations of single‑agent LLMs by separating planning, security analysis, code synthesis, and review into specialized agents. By exchanging only structured artifacts, the system avoids context bloat and role ambiguity. Experiments show significant gains over direct prompting on benchmark suites. ## Key Contributions - [Finding 1] MACGen separates the generation pipeline into four distinct roles (planner, security advisor, coder, reviewer) to enforce functional correctness and security constraints. - [Finding 2] The framework reduces uncontrolled dialogue history by passing only structured artifacts between agents, mitigating context bloat and role confusion. - [Finding 3] MACGen achieves a 19.61‑pp increase in F&S@1 on CWEval and a 10.57‑pp improvement on BaxBench compared with single‑prompt baselines. ## Methodology The authors designed a multi‑agent pipeline where a planner first constructs a step‑by‑step plan aligned to functional requirements; the security advisor then identifies probable Common Weakness Enumerations (CWEs) and synthesizes task‑specific guidelines; the coder generates code using these artifacts; finally, a reviewer provides perspective‑separated feedback. Each agent receives only the relevant artifact from its predecessor, preventing full dialogue history exchange and preserving role specialization. ## Results On CWEval, MACGen’s functional‑security score (F&S@1) is 19.61 percentage points higher than direct prompting; on BaxBench, it gains 10.57 pp. These improvements are consistent across multiple tasks, indicating robust joint optimization of correctness and security. ## Significance By decoupling the generation process into specialized agents that communicate via structured artifacts, MACGen tackles the multi‑objective nature of secure code synthesis more effectively than prior methods. The approach reduces hallucinated vulnerabilities while preserving functionality, offering a scalable template for future AI‑assisted development tools. ## Related Concepts - Large Language Models (LLMs) - Common Weakness Enumerations (CWEs) - Multi‑agent systems - Structured artifact exchange - Functional correctness - Security analysis