{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/duoguard-a-two-player-rl-driven-framework-for","title":"DuoGuard: A Two-Player RL-Driven Framework for Multilingual LLM Guardrails","arxiv_id":"2502.05163","date":"2025-02-07","proceeding":null,"authors":["Yihe Deng","Yu Yang","Junkai Zhang","Wei Wang","Bo Li"],"abstract":"The rapid advancement of large language models (LLMs) has increased the need for guardrail models to ensure responsible use, particularly in detecting unsafe and illegal content. While substantial safety data exist in English, multilingual guardrail modeling remains underexplored due to the scarcity of open-source safety data in other languages. To address this gap, we propose a novel two-player Reinforcement Learning (RL) framework, where a generator and a guardrail model co-evolve adversarially to produce high-quality synthetic data for multilingual guardrail training. We theoretically formalize this interaction as a two-player game, proving convergence to a Nash equilibrium. Empirical evaluations show that our model \\ours outperforms state-of-the-art models, achieving nearly 10% improvement over LlamaGuard3 (8B) on English benchmarks while being 4.5x faster at inference with a significantly smaller model (0.5B). We achieve substantial advancements in multilingual safety tasks, particularly in addressing the imbalance for lower-resource languages in a collected real dataset. Ablation studies emphasize the critical role of synthetic data generation in bridging the imbalance in open-source data between English and other languages. These findings establish a scalable and efficient approach to synthetic data generation, paving the way for improved multilingual guardrail models to enhance LLM safety. Code, model, and data will be open-sourced at https://github.com/yihedeng9/DuoGuard.","url_abs":"https://arxiv.org/abs/2502.05163v1","url_pdf":"https://arxiv.org/pdf/2502.05163v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"duoguard-a-two-player-rl-driven-framework-for","repo_url":"https://github.com/yihedeng9/duoguard","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"},{"task_slug":"synthetic-data-generation","task_name":"Synthetic Data Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2502.05163","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2502.05163"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yihedeng9/duoguard","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":10},"by_repo_kind":{"official":{"samples":10,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"8b3f5220a8f23de1","entry":"add_class_openai","repo":"yihedeng9/duoguard","repo_kind":"official","path":"evaluation/evaluate_duoguard.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/evaluation/evaluate_duoguard.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8b3f5220a8f23de1"}},{"code_sha256_prefix":"e98856e477e4a06b","entry":"add_class_toxicchat","repo":"yihedeng9/duoguard","repo_kind":"official","path":"evaluation/evaluate_duoguard.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/evaluation/evaluate_duoguard.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e98856e477e4a06b"}},{"code_sha256_prefix":"38f46e3c8f6d6114","entry":"add_class_xstest","repo":"yihedeng9/duoguard","repo_kind":"official","path":"evaluation/evaluate_duoguard.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/evaluation/evaluate_duoguard.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"38f46e3c8f6d6114"}},{"code_sha256_prefix":"5dfca9bd14a165ad","entry":"classes_to_labels","repo":"yihedeng9/duoguard","repo_kind":"official","path":"classifier/process_dataset.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/classifier/process_dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5dfca9bd14a165ad"}},{"code_sha256_prefix":"d37af1f22b3fdd90","entry":"format_for_create","repo":"yihedeng9/duoguard","repo_kind":"official","path":"generator/datagen/Prompts.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/generator/datagen/Prompts.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d37af1f22b3fdd90"}},{"code_sha256_prefix":"53345b8aba23d955","entry":"format_for_create_safe","repo":"yihedeng9/duoguard","repo_kind":"official","path":"generator/datagen/Prompts.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/generator/datagen/Prompts.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"53345b8aba23d955"}},{"code_sha256_prefix":"34e9b7841dc1e51a","entry":"format_for_rating","repo":"yihedeng9/duoguard","repo_kind":"official","path":"generator/datagen/Prompts.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/generator/datagen/Prompts.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"34e9b7841dc1e51a"}},{"code_sha256_prefix":"6e59a73fec2ef5e7","entry":"get_all_datasets","repo":"yihedeng9/duoguard","repo_kind":"official","path":"classifier/process_dataset.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/classifier/process_dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6e59a73fec2ef5e7"}},{"code_sha256_prefix":"ed40aece6217ac56","entry":"moderate","repo":"yihedeng9/duoguard","repo_kind":"official","path":"evaluation/evaluate_llamaguard.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/evaluation/evaluate_llamaguard.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ed40aece6217ac56"}},{"code_sha256_prefix":"674b94682563ba24","entry":"read_all_datasets","repo":"yihedeng9/duoguard","repo_kind":"official","path":"classifier/process_dataset.py","file_url":"https://github.com/yihedeng9/duoguard/blob/HEAD/classifier/process_dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"674b94682563ba24"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}