Emergent Mind

DeAL: Decoding-time Alignment for Large Language Models

Published Feb 5, 2024 in cs.AI and cs.CL


Large Language Models (LLMs) are nowadays expected to generate content aligned with human preferences. Current work focuses on alignment at model training time, through techniques such as Reinforcement Learning with Human Feedback (RLHF). However, it is unclear if such methods are an effective choice to teach alignment objectives to the model. First, the inability to incorporate multiple, custom rewards and reliance on a model developer's view of universal and static principles are key limitations. Second, the residual gaps in model training and the reliability of such approaches are also questionable (e.g. susceptibility to jail-breaking even after safety training). To address these, we propose DeAL, a framework that allows the user to customize reward functions and enables Decoding-time Alignment of LLMs (DeAL). At its core, we view decoding as a heuristic-guided search process and facilitate the use of a wide variety of alignment objectives. Our experiments with programmatic constraints such as keyword and length constraints (studied widely in the pre-LLM era) and abstract objectives such as harmlessness and helpfulness (proposed in the post-LLM era) show that we can DeAL with fine-grained trade-offs, improve adherence to alignment objectives, and address residual gaps in LLMs. Lastly, while DeAL can be effectively paired with RLHF and prompting techniques, its generality makes decoding slower, an optimization we leave for future work.


  • DeAL introduces a novel method for aligning LLMs outputs with user-defined objectives dynamically at decoding time, offering greater customization and addressing gaps left by traditional training methods.

  • By treating text generation as a search problem and employing heuristic-guided search, DeAL efficiently aligns generated content with a wide array of predefined objectives without degrading the performance of the underlying model.

  • Experimental validation of DeAL highlighted its effectiveness in meeting various alignment goals, including keyword and length constraints as well as more subjective objectives like harmlessness and helpfulness in generated content.

  • DeAL's flexibility and dynamically adjustable nature at decoding time present significant theoretical and practical advancements for improving LLMs' alignment with human values and preferences, suggesting insights for future research directions.

Introduction to Decoding-time Alignment

The current landscape of Auto-regressive LLMs like GPT and PaLM has shown exceptional capabilities in generating human-like text across various natural language processing tasks. As the application of LLMs broadens, aligning their outputs with specific user-defined objectives becomes increasingly crucial. Traditional methods primarily focus on incorporating alignment during the training phase, employing techniques such as Reinforcement Learning from Human Feedback (RLHF). These methods, however, face limitations such as the inability to customize alignment objectives dynamically and a potential misalignment with end-user intentions.

The DeAL Framework

Introducing DeAL, a framework designed for Decoding-time ALignment of LLMs, offers a novel approach to addressing the challenges of aligning LLM outputs with user-defined objectives. DeAL views decoding as a heuristic-guided search process, allowing for a wide variety of alignment objectives to be applied dynamically at decoding time. This framework not only supports fine-grained control over the alignment process but also enables addressing residual gaps inherent in LLMs. Experimentation with DeAL has shown its capability to handle both programmatically verifiable constraints and more abstract alignment objectives effectively, suggesting a substantial improvement in LLM output alignment without compromising the underlying model's performance.

Methodology and Experiments

DeAL's methodological underpinning lies in framing text generation as a search problem, utilizing LLMs as search agents. By incorporating custom alignment prompts and constructing heuristic functions to guide the search process, DeAL enables dynamic alignment of generated content with predefined objectives. This alignment is showcased through various experiments, addressing both keyword and length constraints and abstract objectives like harmlessness and helpfulness. The experiments demonstrate DeAL's effectiveness in improving LLM alignment, showcasing the versatility and utility of decoding-time alignment strategies.

Implications and Future Directions

The development and application of DeAL raise important theoretical and practical implications for the future development of LLMs and generative AI. Theoretically, it provides a novel framework for understanding and implementing alignment objectives in LLMs, emphasizing the flexibility and dynamic nature of decoding-time alignment. Practically, DeAL offers a pathway to more reliable, user-aligned generative outputs, crucial for the safe and effective deployment of LLMs across diverse application areas. While the optimization for decoding speed remains an area for future work, the potential for DeAL to complement existing alignment techniques, like RLHF, sets a promising direction for enhancing the alignment capabilities of LLMs further.


Decoding-time alignment, as facilitated by the DeAL framework, represents a significant advancement in tailoring LLM outputs to specific alignment objectives. By addressing the limitations of traditional alignment methods and providing a flexible, dynamic means of enforcing alignment at decoding time, DeAL paves the way for more nuanced, user-aligned content generation across various LLM applications. As research in this area progresses, the continual refinement and application of decoding-time alignment strategies like DeAL will be crucial for harnessing the full potential of LLMs in generating content that is not only high-quality but also closely aligned with human values and preferences.

Get summaries of trending AI/ML papers delivered straight to your inbox

Unsubscribe anytime.