Constraining Large Language Model for Generating Computer-Parsable Content

要約

私たちは、微調整を行わずに特定の規則に準拠した構造化コンテンツを生成する際に大規模言語モデル (LLM) をガイドする方法を提案します。
事前に合意されたコンテキストフリー文法 (CFG) によるコルーチンベースのコンテンツ生成制約を利用することで、LLM はデコード中に形式言語に準拠した出力を生成するように指示されます。
これにより、ターゲットのデータ構造、タイプ、または命令を生成する際の安定性と一貫性が強化され、アプリケーション開発の複雑さが軽減されます。
実験的には、GPT-2 と Gemma のエラー率は、それぞれ 36 トークンと 282 トークンより長い DSL で 95% を超えました。
コルーチンベースの DSL 生成フレームワークである YieldLang を紹介し、JSON や Mermaid フローチャートの生成などのさまざまなタスクで LLM を使用して評価します。
ベンチマークと比較して、私たちのアプローチは精度を 1.09 ~ 11.6 倍向上させ、LLM が JSON を効果的に生成するために必要なサンプルはサンプルの約 16.5% のみです。
これにより、LLM で生成されたコンテンツのコンピュータ プログラムの使いやすさが向上します。

要約(オリジナル)

We propose a method to guide Large Language Models (LLMs) in generating structured content adhering to specific conventions without fine-tuning. By utilizing coroutine-based content generation constraints through a pre-agreed context-free grammar (CFG), LLMs are directed during decoding to produce formal language compliant outputs. This enhances stability and consistency in generating target data structures, types, or instructions, reducing application development complexities. Experimentally, error rates of GPT-2 and Gemma exceed 95% for DSLs longer than 36 and 282 tokens, respectively. We introduce YieldLang, a coroutine-based DSL generation framework, and evaluate it with LLMs on various tasks including JSON and Mermaid flowchart generation. Compared to benchmarks, our approach improves accuracy by 1.09 to 11.6 times, with LLMs requiring only about 16.5% of the samples to generate JSON effectively. This enhances usability of LLM-generated content for computer programs.

arxiv情報

著者 Jiaye Wang
発行日 2024-04-08 13:22:24+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.SE パーマリンク