Learning Natural Language Constraints for Safe Reinforcement Learning of Language Agents

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Chua, Jaymari, Wang, Chen, Yao, Lina
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866912309195046912
author Chua, Jaymari
Wang, Chen
Yao, Lina
author_facet Chua, Jaymari
Wang, Chen
Yao, Lina
contents Generalizable alignment is a core challenge for deploying Large Language Models (LLMs) safely in real-world NLP applications. Current alignment methods, including Reinforcement Learning from Human Feedback (RLHF), often fail to guarantee constraint satisfaction outside their training distribution due to their reliance on implicit, post-hoc preferences. Inspired by a paradigm shift to first curate data before tuning, we introduce a new framework for safe language alignment that learns natural language constraints from positive and negative demonstrations as a primary step. From inferring both a task-specific reward function and latent constraint functions, our approach fosters adaptation to novel safety requirements and robust generalization under domain shifts and adversarial inputs. We formalize the framework within a Constrained Markov Decision Process (CMDP) and validate it via a text-based navigation environment, demonstrating safe adaptation to changing danger zones. Our experiments show fewer violations upon domain shift when following a safe navigation path, and we achieve zero violations by applying learned constraints to a distilled BERT model as a fine-tuning technique. This work offers a promising path toward building safety-critical and more generalizable LLMs for practical NLP settings.
format Preprint
id arxiv_https___arxiv_org_abs_2504_03185
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Learning Natural Language Constraints for Safe Reinforcement Learning of Language Agents
Chua, Jaymari
Wang, Chen
Yao, Lina
Computation and Language
Artificial Intelligence
I.2.7; I.2.4; I.2.6; I.2.8
Generalizable alignment is a core challenge for deploying Large Language Models (LLMs) safely in real-world NLP applications. Current alignment methods, including Reinforcement Learning from Human Feedback (RLHF), often fail to guarantee constraint satisfaction outside their training distribution due to their reliance on implicit, post-hoc preferences. Inspired by a paradigm shift to first curate data before tuning, we introduce a new framework for safe language alignment that learns natural language constraints from positive and negative demonstrations as a primary step. From inferring both a task-specific reward function and latent constraint functions, our approach fosters adaptation to novel safety requirements and robust generalization under domain shifts and adversarial inputs. We formalize the framework within a Constrained Markov Decision Process (CMDP) and validate it via a text-based navigation environment, demonstrating safe adaptation to changing danger zones. Our experiments show fewer violations upon domain shift when following a safe navigation path, and we achieve zero violations by applying learned constraints to a distilled BERT model as a fine-tuning technique. This work offers a promising path toward building safety-critical and more generalizable LLMs for practical NLP settings.
title Learning Natural Language Constraints for Safe Reinforcement Learning of Language Agents
topic Computation and Language
Artificial Intelligence
I.2.7; I.2.4; I.2.6; I.2.8
url https://arxiv.org/abs/2504.03185