Reproduce “Adaptable Logical Control for Large Language Models” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Honghua Zhang, Po-Nien Kung, Masahiro Yoshida, Guy Van den Broeck, Nanyun Peng

The paper introduces Ctrl-G, an inference-time framework that couples Large Language Models with Hidden Markov Models to reliably enforce logical constraints specified as Deterministic Finite Automata. It achieves 100% constraint satisfaction while maintaining high generation quality, outperforming larger LLMs and specialized baselines in tasks like text editing and infilling.

Key insights

  • Combining an LLM's general language capabilities with the tractability of HMMs and DFAs enables robust and guaranteed logical control.
  • Probabilistic reasoning over future constraint satisfaction, rather than just simple pruning, allows for the generation of both logically compliant and natural-sounding text.
  • A distilled HMM can effectively approximate an LLM's distribution for the purpose of guiding constrained generation, without requiring fine-tuning the LLM itself for new constraints.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.