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

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Le, Hung, Zhou, Yingbo, Xiong, Caiming, Savarese, Silvio, Sahoo, Doyen
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866929566194335744
author Le, Hung
Zhou, Yingbo
Xiong, Caiming
Savarese, Silvio
Sahoo, Doyen
author_facet Le, Hung
Zhou, Yingbo
Xiong, Caiming
Savarese, Silvio
Sahoo, Doyen
contents Large language models (LLMs) for code are typically trained to align with natural language instructions to closely follow their intentions and requirements. However, in many practical scenarios, it becomes increasingly challenging for these models to navigate the intricate boundary between helpfulness and safety, especially against highly complex yet potentially malicious instructions. In this work, we introduce INDICT: a new framework that empowers LLMs with Internal Dialogues of Critiques for both safety and helpfulness guidance. The internal dialogue is a dual cooperative system between a safety-driven critic and a helpfulness-driven critic. Each critic provides analysis against the given task and corresponding generated response, equipped with external knowledge queried through relevant code snippets and tools like web search and code interpreter. We engage the dual critic system in both code generation stage as well as code execution stage, providing preemptive and post-hoc guidance respectively to LLMs. We evaluated INDICT on 8 diverse tasks across 8 programming languages from 5 benchmarks, using LLMs from 7B to 70B parameters. We observed that our approach can provide an advanced level of critiques of both safety and helpfulness analysis, significantly improving the quality of output codes ($+10\%$ absolute improvements in all models).
format Preprint
id arxiv_https___arxiv_org_abs_2407_02518
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulness
Le, Hung
Zhou, Yingbo
Xiong, Caiming
Savarese, Silvio
Sahoo, Doyen
Software Engineering
Artificial Intelligence
Computation and Language
Cryptography and Security
Multiagent Systems
Programming Languages
Large language models (LLMs) for code are typically trained to align with natural language instructions to closely follow their intentions and requirements. However, in many practical scenarios, it becomes increasingly challenging for these models to navigate the intricate boundary between helpfulness and safety, especially against highly complex yet potentially malicious instructions. In this work, we introduce INDICT: a new framework that empowers LLMs with Internal Dialogues of Critiques for both safety and helpfulness guidance. The internal dialogue is a dual cooperative system between a safety-driven critic and a helpfulness-driven critic. Each critic provides analysis against the given task and corresponding generated response, equipped with external knowledge queried through relevant code snippets and tools like web search and code interpreter. We engage the dual critic system in both code generation stage as well as code execution stage, providing preemptive and post-hoc guidance respectively to LLMs. We evaluated INDICT on 8 diverse tasks across 8 programming languages from 5 benchmarks, using LLMs from 7B to 70B parameters. We observed that our approach can provide an advanced level of critiques of both safety and helpfulness analysis, significantly improving the quality of output codes ($+10\%$ absolute improvements in all models).
title INDICT: Code Generation with Internal Dialogues of Critiques for Both Security and Helpfulness
topic Software Engineering
Artificial Intelligence
Computation and Language
Cryptography and Security
Multiagent Systems
Programming Languages
url https://arxiv.org/abs/2407.02518