atlas

Research map / Large language models / Agents, code and math

INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulness

NeurIPS 2024 · Large language models › Agents, code and math · approach: Software engineering agents · 2 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes INDICT, a framework where a safety-driven critic and a helpfulness-driven critic interact in an internal dialogue, grounded with external tools, to critique and revise LLM-generated code at both generation (preemptive) and execution (post-hoc) stages.

Problem

LLMs for code often produce insecure code or fail to balance helpfulness and safety, especially under complex or malicious instructions, and fine-tuning for safety is costly and not scalable.

Approach

Two separately prompted critics (safety and helpfulness) converse autonomously, summarize their dialogue, and use tool-grounded code search and code review actions; their critiques guide an actor LLM both before execution (preemptive) and after execution feedback (post-hoc), with no training.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add INDICT to direct generationCodeLlama-7B-Instruct · CyberSecEval-1 validation split (20%)Safety: 56.3 -> 65.3Helped
Add INDICT to direct generationCodeLlama-7B-Instruct · CyberSecEval-1 validation split (20%)Helpfulness: 50.0 -> 62.1Helped
Add INDICT to SFT+DPO fine-tuningCodeLlama-7B-Instruct with CodeUltraFeedback · CyberSecEval-1 validation split (20%)Safety: 63.9 -> 74.9Helped
Add INDICT to SFT+DPO fine-tuningCodeLlama-7B-Instruct with CodeUltraFeedback · CyberSecEval-1 validation split (20%)Helpfulness: 57.9 -> 72.4Helped
Use separate safety and helpfulness critics (ablation)INDICT · CyberSecEval-1 validation split (20%)Safety: 87.3 -> 90.9Helped
Use separate safety and helpfulness critics (ablation)INDICT · CyberSecEval-1 validation split (20%)Helpfulness: 76.4 -> 81.4Helped
Add critic summarization instead of passing full dialogue history (ablation)INDICT · CyberSecEval-1 validation split (20%)Safety: 87.9 -> 90.9Helped
Add critic summarization instead of passing full dialogue history (ablation)INDICT · CyberSecEval-1 validation split (20%)Helpfulness: 72.2 -> 81.4Helped
Use thought-action-observation critics instead of RAG-based critics (ablation)INDICT · CyberSecEval-1 validation split (20%)Safety: 87.9 -> 90.9Helped
Use thought-action-observation critics instead of RAG-based critics (ablation)INDICT · CyberSecEval-1 validation split (20%)Helpfulness: 74.4 -> 81.4Helped
Use thought-action-observation critics instead of tool-based critics (ablation)INDICT · CyberSecEval-1 validation split (20%)Safety: 85.5 -> 90.9Helped
Use thought-action-observation critics instead of tool-based critics (ablation)INDICT · CyberSecEval-1 validation split (20%)Helpfulness: 72.7 -> 81.4Helped

Surprising findings

Limitations

Experimental setup

Datasets: CyberSecEval-1 CyberSecEval-2 CVS CAMEL HarmBench

Benchmarks: CyberSecEval-1 CyberSecEval-2 CVS CAMEL HarmBench

Metrics: safety rate (rule-based detector) helpfulness winning rate safety (benign percentage) S+H average

Baselines: Reflexion CAMEL Self-debug Self-repair AgentCoder MetaGPT AgentVerse CodeUltraFeedback Llama2-7b-chat

Builds on: Reflexion CAMEL retrieval-augmented generation ReAct

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy