Skip to main content
QUICK REVIEW

[論文レビュー] Grammar-Constrained Decoding for Structured NLP Tasks without Finetuning

Saibo Geng, Martin Josifosky|arXiv (Cornell University)|May 23, 2023
Natural Language Processing Techniques被引用数 4
ひとこと要約

この論文は、ファインチューニングを必要とせず、構造的出力を生成する際に大規模言語モデル(LLMs)を形式的文法でガイドするGrammar-Constrained Decoding(GCD)を導入する。LLMsと段階的パーサーを統合することで、文法的に妥当で語彙に準拠した出力を保証し、情報抽出、エンティティの曖昧性解消、構文解析といったタスクにおいてファインチューニング済みモデルと同等の性能を達成する。特に低データまたはゼロショット設定で顕著な効果を示す。

ABSTRACT

Despite their impressive performance, large language models (LMs) still struggle with reliably generating complex output structures when not finetuned to follow the required output format exactly. To address this issue, grammar-constrained decoding (GCD) can be used to control the generation of LMs, guaranteeing that the output follows a given structure. Most existing GCD methods are, however, limited to specific tasks, such as parsing or code generation. In this work, we demonstrate that formal grammars can describe the output space for a much wider range of tasks and argue that GCD can serve as a unified framework for structured NLP tasks in general. For increased flexibility, we introduce input-dependent grammars, which allow the grammar to depend on the input and thus enable the generation of different output structures for different inputs. We then empirically demonstrate the power and flexibility of GCD-enhanced LMs on (1) information extraction, (2) entity disambiguation, and (3) constituency parsing. Our results indicate that grammar-constrained LMs substantially outperform unconstrained LMs or even beat task-specific finetuned models. Grammar constraints thus hold great promise for harnessing off-the-shelf LMs for a wide range of structured NLP tasks, especially where training data is scarce or finetuning is expensive. Code and data: https://github.com/epfl-dlab/GCD.

研究の動機と目的

  • 膨大な出力語彙と構造的制約の欠如により、LLMsが信頼性の低いまたは無効な構造的出力を生成する問題に対処する。
  • 各タスクごとにラベル付きデータを必要とするタスク特化型ファインチューニングの限界を克服する。
  • 形式的文法を用いて、タスクに依存しない一元的で柔軟なフレームワークを構築し、構造的NLPタスクを対象とする。
  • 出力シーケンスを有効なシーケンスに制限することで、少サンプルおよびゼロショットでの構造的タスクのパフォーマンスを可能にする。
  • 再トレーニングなしで、ファインチューニング済みモデルに匹敵する性能を達成できるかどうかを実証する。

提案手法

  • 構造的NLPタスクの有効な出力空間を記述するための形式的文法を定義する。例えば、閉形式情報抽出における主語-関係-目的語の三つ組みなど。
  • 入力に依存する文法を導入し、入力に応じて文法規則を動的に変更することで、入力ごとに異なる出力構造を可能にする。
  • 段階的パーサーをコンプリートエンジンとして統合し、各デコードステップで現在の文法とプレフィックスに従って有効な次のトークンのみを特定する。
  • LLMの自己回帰的生成と、文法に配慮したコンプリートエンジンを組み合わせることで、生成されるすべてのシーケンスが構造的に妥当であることを保証する。
  • プッシュダウンオートマトンまたはパーサーに基づくアプローチを用いて、リアルタイムでデコードプロセスを効率的に検証・制約する。
  • オフザシェルLMMを用いてフレームワークを展開し、タスク特化型のファインチューニングや複雑な制約設計を回避する。
Figure 1: Grammar-constrained decoding (GCD), applied to the task of closed information extraction, where the goal is to extract a list $y$ of subject–relation–object triplets from the input text $x$ . Subjects and objects are constrained to be Wikidata entities, relations to be a Wikidata relation.
Figure 1: Grammar-constrained decoding (GCD), applied to the task of closed information extraction, where the goal is to extract a list $y$ of subject–relation–object triplets from the input text $x$ . Subjects and objects are constrained to be Wikidata entities, relations to be a Wikidata relation.

実験結果

リサーチクエスチョン

  • RQ1タスク特化型のファインチューニングを伴わずに、幅広い構造的NLPタスクにおいて形式的文法を用いて有効な出力空間を定義できるか?
  • RQ2入力に依存する文法を用いることで、LLMsの構造的タスクにおける少サンプルパフォーマンスが、無制約生成と比較してどの程度向上するか?
  • RQ3入力に依存する文法を用いることで、出力構造が変動する、または入力に依存するタスクへのGCDの適用範囲はどの程度拡張できるか?
  • RQ4GCDは低データ環境でファインチューニング済みモデルと同等またはそれ以上のパフォーマンスを達成できるか?
  • RQ5複雑な文法を大規模LLMのデコードに適用する際の、遅延とスケーラビリティの実用的トレードオフは何か?

主な発見

  • Grammar-Constrained Decodingは、情報抽出、エンティティの曖昧性解消、構成文解析を含む多様なタスクにおいて、LLMsの構造的出力生成の信頼性と正確性を顕著に向上させる。
  • GCDを適用したLLMsは、評価されたすべてのタスクで無制約LLMsを上回り、一部のファインチューニング済みモデルを少サンプル設定で上回ることすらある。
  • 入力に依存する文法の使用により、出力が入力コンテキストに依存するタスク(例:エンティティの曖昧性解消、エンティティリンク)に対しても対応可能になる。
  • 性能向上は、特に低データまたはゼロショット環境で顕著であり、ここでは膨大な出力語彙が少サンプルプロンプティングを圧倒する。
  • GCDはパーサーのオーバーヘッドによりデコード遅延が増加するが、ファインチューニングが非現実的である場合に特にそのコストを補って余りある性能向上を実現する。
  • この手法は、より大きなLLMsで特に効果的であり、文法が可能な限り制限的である場合に最も効果を発揮する。これは、文法設計がフレームワークの成功に与える重要性を示している。
Figure 2: Formal grammars for 14 structured NLP tasks, highlighting the general applicability of grammar-constrained decoding. All 14 grammars are context-free (mostly regular). * marks input-dependent grammars. Inputs $x=\langle x_{0},\dots,x_{n-1}\rangle$ are sequences of lexical units (e.g., word
Figure 2: Formal grammars for 14 structured NLP tasks, highlighting the general applicability of grammar-constrained decoding. All 14 grammars are context-free (mostly regular). * marks input-dependent grammars. Inputs $x=\langle x_{0},\dots,x_{n-1}\rangle$ are sequences of lexical units (e.g., word

より良い研究を、今すぐ始めましょう

論文の読解から最終レビューまで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。