定性失敗事例ギャラリー:テキスト退行ループとハルシネーション
Agent支援工学分析
前提条件
第52日サンプリングと第53日評価プロトコル。
学習目標
自己回帰生成における3大定性失敗(ループ、文字化け、ハルシネーション)を分類・解説する。
手順
以下を生成して分析せよ:(1) 貪欲ループ(Greedy loop):'The president said that the president said that...';(2) 高温度(T=3.0)による崩壊:一貫性のない文字化け;(3) 確信に満ちたハルシネーション(hallucination):文法的には流暢だが、完全に捏造された歴史的主張をモデルが出力する。
演習と予測記録
1. 貪欲デコードを無限ループに引き込む正帰還ループは何か?
2. 温度を2.0以上に上げると文法構造が崩壊する理由は何か?
3. 50M未満の小モデルを知識データベースとして使えない理由は何か?
生成されたフレーズが自己文脈となり、そのフレーズの次トークン確率を増大させます。
貪欲ループは自己回帰の正帰還により、一度出力されたパターンの遷移確率が自己強化されることで生じる。過度な高温は全トークンの選択確率を一様に近づけ、文法遷移規則を無力化する。小規模モデルは事実知識を蓄積するパラメータ容量を欠き、表層的な統計語感を模倣しているに過ぎない。
生成退行の数理的背景を分類し、小モデルのパラメータ容量限界を説明できること。
公式ソースリソースと権利証跡
The Curious Case of Neural Text Degeneration
該当セクション・タイムスタンプ: Section 5.3 Repetition and Appendix B Example Generations
検証バージョンと日付: ICLR 2020 / arXiv:1904.09751v2 (Verified: 2026-10-30)
Primary source introducing Nucleus (Top-p) sampling and analyzing the failure of greedy decoding (loops, repetition).
Softmax probabilities, cumulative probability distributions from Days 25-27 and 41-42.
Top-p truncation algorithms and worked probability cutoffs are completely explained in the lesson.
比較対象候補リソースと選定評価 (2)
Introduces top-k sampling; Holtzman et al. dynamic nucleus threshold is compared directly against top-k.
Practical library guide; Holtzman provides the foundational mathematical reasoning.
nanoGPT: sample.py autoregressive generation script
該当セクション・タイムスタンプ: sample.py: temperature and top_k settings passed to model.generate (model.py: GPT.generate)
検証バージョンと日付: Git master (Verified: 2026-10-30)
Compact historical code reference for the named implementation functions; CS336 spring2025 provides the lead component exercises. Do not infer top-p, atomic persistence or cloud budget enforcement from nanoGPT.
PyTorch inference, torch.multinomial, and Day 48 decoder-only forward pass.
The generation loop is implemented in runnable local scripts.
比較対象候補リソースと選定評価 (2)
C++ implementation with high performance; nanoGPT is readable Python matched to our curriculum.
Encoder-decoder model; nanoGPT decoder-only autoregressive loop is the direct fit for modern LLMs.