54 / 90

第54日:失敗事例ギャラリー:生成退行ループ、ハルシネーションと総合試験

自己回帰生成の代表的な退行モード(無限ループ、高エントロピー文字化け、事実誤認)を体系化し、小モデルの統計的語感と真の論理知識の限界を弁別し、総合習熟度試験を完了する。

モデル・事前学習とLoRA 480分の集中学習(8時間)
01 120 分

定性失敗事例ギャラリー:テキスト退行ループとハルシネーション

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未満の小モデルを知識データベースとして使えない理由は何か?

独立習得基準

生成退行の数理的背景を分類し、小モデルのパラメータ容量限界を説明できること。

公式ソースリソースと権利証跡

linking arXiv non-exclusive license / Open Access

The Curious Case of Neural Text Degeneration

著者・提供機関: Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, Yejin Choi | オリジナル出所URL ↗

該当セクション・タイムスタンプ: 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.

Hugging Face Generation Strategies Guide ↗ compared_alternative [Apache 2.0]

Practical library guide; Holtzman provides the foundational mathematical reasoning.

linking MIT

nanoGPT: sample.py autoregressive generation script

著者・提供機関: Andrej Karpathy | オリジナル出所URL ↗

該当セクション・タイムスタンプ: 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)
llama.cpp sampling implementation ↗ compared_alternative [MIT]

C++ implementation with high performance; nanoGPT is readable Python matched to our curriculum.

PyTorch text generation tutorial ↗ compared_alternative [Modified BSD]

Encoder-decoder model; nanoGPT decoder-only autoregressive loop is the direct fit for modern LLMs.

02 120 分

小モデルの能力限界:表層言語パターンと真の論理的知識の境界

Agent支援工学分析

前提条件

活動01。

学習目標

小モデルが獲得できるもの(形態論、リズム)と、大規模化を要するもの(推論、事実知識)の境界を明確にする。

手順

シェイクスピアで10Mパラメータモデルを訓練すると、英語の古語や弱強五歩格(iambic pentameter)のリズムは学習できるが、基本的な算術や現代の事実に関する質問には答えられないことを実証せよ。この教材の玩具規模のモデルについて、「AGI」や創発的知識という主張は退けよ。

演習と予測記録

1. 10Mモデルが獲得に成功する言語的特徴は何か?
2. 小モデルが「2 + 2 = 5」と出力することはバグか、それとも容量限界か?
3. 生成物展示の際に明記すべき注記文を示せ。

独立習得基準

モデルの能力境界を客観的に論述し、過剰な擬人化を退けること。

公式ソースリソースと権利証跡

linking arXiv non-exclusive license / Open Access

The Curious Case of Neural Text Degeneration

著者・提供機関: Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, Yejin Choi | オリジナル出所URL ↗

該当セクション・タイムスタンプ: N/A

検証バージョンと日付: 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.

Hugging Face Generation Strategies Guide ↗ compared_alternative [Apache 2.0]

Practical library guide; Holtzman provides the foundational mathematical reasoning.

linking MIT

nanoGPT: model.py architecture implementation

著者・提供機関: Andrej Karpathy | オリジナル出所URL ↗

該当セクション・タイムスタンプ: N/A

検証バージョンと日付: 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.

ソース前提知識:

Python, PyTorch, and Day 43-45 attention fundamentals.

安全フォールバック(オフライン回復性):

Local models and classes in the curriculum mirror nanoGPT semantics directly.

比較対象候補リソースと選定評価 (2)
GPT-2 TensorFlow source (OpenAI) ↗ compared_alternative [Modified MIT License]

Original legacy TensorFlow 1.x code; nanoGPT provides clean modern PyTorch equivalent.

Llama 2 / 3 PyTorch source (Meta) ↗ compared_alternative [Llama 2 Community License]

Includes advanced production features (RoPE, GQA), but nanoGPT's simplicity is ideal for the core Days 46-48 assembly.

03 120 分

アブレーション実験設計:文脈長とサンプリングパラメータの相互作用

Agent支援工学分析

前提条件

活動54-01および54-02。

学習目標

文脈窓長(T=32 vs 128)と温度パラメータが長文の整合性に与える影響を比較する実験を設計する。

手順

6通りの実験マトリクスを設計し、定量的な反復度指標(Distinct-2)を定義せよ。

演習と予測記録

1. 文脈窓が32のモデルが長文生成で必ず脱線する理由は何か?
2. 経験的に最もバランスの取れた創造的生成パラメータは何か?
3. 生成テキストの語彙多様性を測定する定量的指標の式を示せ。

独立習得基準

実験マトリクスを設計し、客観的な反復度指標を定義できること。

公式ソースリソースと権利証跡

linking arXiv.org perpetual non-exclusive license / Open Access

Attention Is All You Need

著者・提供機関: Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, Illia Polosukhin | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section 6.2 Model Variations (Table 3)

検証バージョンと日付: arXiv:1706.03762v7 (Verified: 2026-10-30)

選定理由:

Foundational primary literature defining the Transformer architecture, multi-head attention, and scaled dot-product attention.

ソース前提知識:

Matrix multiplication and basic neural network concepts from Days 22-24 and 34-36.

安全フォールバック(オフライン回復性):

All mathematical formulas and structural definitions are self-contained in the lesson text.

比較対象候補リソースと選定評価 (2)
Illustrated Transformer (Jay Alammar) ↗ compared_alternative [CC BY-NC-SA 4.0]

High-level visual intuition, but Vaswani et al. provides the primary mathematical specifications needed for implementation.

Annotated Transformer (Harvard NLP) ↗ compared_selected_for_day46_48 [MIT]

Co-primary: PyTorch line-by-line implementation alongside the paper equations.

linking arXiv non-exclusive license / Open Access

The Curious Case of Neural Text Degeneration

著者・提供機関: Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, Yejin Choi | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section 3.1 Nucleus Sampling (with Section 2.1 Text Generation Decoding Strategies)

検証バージョンと日付: 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.

Hugging Face Generation Strategies Guide ↗ compared_alternative [Apache 2.0]

Practical library guide; Holtzman provides the foundational mathematical reasoning.

04 120 分

テキスト生成・過学習・評価トラック総合習熟度試験

完全自立閉本テスト

前提条件

活動01-03の完了。

学習目標

閉本総合試験:サンプリング式、PPL換算、データ分割規律、訓練損失の罠の4大領域を完答する。

手順

サンプリングの定式化、パープレキシティの計算、リーク防止、モデルの限界を扱う4つの多段設問に解答せよ。

演習と予測記録

1. Top-p 核サンプリングの累積確率方程式を示せ。
2. 検証損失 1.7918 nats を正確なPPLに換算せよ。
3. データリークを防ぐ3大黄金則を挙げよ。
4. 低い訓練損失が生成の品質を保証しない理由は何か?

独立習得基準

4大設問を完璧に回答し、生成と評価トラックの完全な自立習得を証明すること。

公式ソースリソースと権利証跡

linking MIT

nanoGPT: sample.py autoregressive generation script

著者・提供機関: Andrej Karpathy | オリジナル出所URL ↗

該当セクション・タイムスタンプ: 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)
llama.cpp sampling implementation ↗ compared_alternative [MIT]

C++ implementation with high performance; nanoGPT is readable Python matched to our curriculum.

PyTorch text generation tutorial ↗ compared_alternative [Modified BSD]

Encoder-decoder model; nanoGPT decoder-only autoregressive loop is the direct fit for modern LLMs.

linking arXiv non-exclusive license / Open Access

The Curious Case of Neural Text Degeneration

著者・提供機関: Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, Yejin Choi | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Section 3.1 Nucleus Sampling (with Section 2.1 Text Generation Decoding Strategies)

検証バージョンと日付: 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.

Hugging Face Generation Strategies Guide ↗ compared_alternative [Apache 2.0]

Practical library guide; Holtzman provides the foundational mathematical reasoning.