ニューラル言語モデルのパイプライン:インデックスからプレアクティベーションへ
Agent支援エンジニアリング確認
前提条件
第 40 日の埋め込みルックアップと文脈連結、第 34-36 日の MLP の仕組み。
学習目標
インデックス → C の行 → 連結 x → 隠れ層プレアクティベーションという全パイプラインをたどり、入力ベクトルとプレアクティベーションベクトルを手計算する。
手順
必須作業:第 40 日のテーブル C と文脈 ('a','b') を使い、x = [0.2, -0.1, -0.4, 0.5] とする。今日の重みは固定:W1 = [[0.5,-0.2,0.1],[0.3,0.4,-0.3],[-0.1,0.2,0.6],[0.2,-0.5,0.4]]、b1 = [0.1,-0.1,0.0]。各隠れプレアクティベーション pre_j = sum_i x_i * W1[i][j] + b1[j] を計算する。トレースを確認する前に予測値を記録する。任意作業:pre_1 に最も大きく影響する入力座標を 1 つ予測する。
演習と予測記録
1. 上の x と W1 で pre_0、pre_1、pre_2 を計算し、すべての積を示す。
2. プレアクティベーションのどれかがちょうど 0 になるか予測する。
3. 生のシンボルから pre までのパイプライン段階を順に挙げる。
pre_0 = 0.2*0.5 + (-0.1)*0.3 + (-0.4)*(-0.1) + 0.5*0.2 + 0.1。各積の符号を付けたまま合計する。
pre_0 = 0.10 - 0.03 + 0.04 + 0.10 + 0.10 = 0.31、pre_1 = -0.04 - 0.04 - 0.08 - 0.25 - 0.10 = -0.51、pre_2 = 0.02 + 0.03 - 0.24 + 0.20 + 0.00 = 0.01。ちょうど 0 になるものはないが、pre_2 は十分小さいので tanh がほぼ線形に振る舞う。段階:シンボル → インデックス → C の行 → 連結 → x*W1 + b1 → tanh → *W2 + b2 → softmax。
手計算のプレアクティベーションが各積を示して [0.31, -0.51, 0.01] と一致し、学習者がメモなしでパイプライン段階を順に説明できる。
公式ソースリソースと権利証跡
makemore: Character-level language models on names.txt
該当セクション・タイムスタンプ: Segment wiring the MLP forward pass: C[X] -> hidden tanh layer -> output logits
検証バージョンと日付: Repository state verified 2026-10-30; lecture published 2022
Standard beginner walkthrough of the Bengio-style MLP language model; the MIT-licensed reference implementation pairs with a stepwise derivation that matches the Days 40-42 worked numbers exactly.
Python basics, matrix multiplication, and the Day 37-39 tokenization and n-gram context
All forward-pass arithmetic, shapes, parameter counts, and loss values are reproduced as original hand-worked examples in the lesson text; no video, subtitle, or transcript is required.
比較対象候補リソースと選定評価 (3)
The original architecture paper; selected jointly as the theoretical citation while Makemore supplies the stepwise implementation walkthrough.
Strong PyTorch rigor but assumes fluent tensor programming; deferred to the Days 43-60 pretraining blocks rather than the first embedding contact.
Strong visual intuition for network mechanics but covers image classification rather than embedding tables and next-token language modeling; retained as optional supplementary viewing.
A Neural Probabilistic Language Model
該当セクション・タイムスタンプ: Section 2 (the mapping g: context feature vectors to next-word probabilities)
検証バージョンと日付: JMLR Volume 3 (2003); verified 2026-10-30
The original paper introducing jointly learned word feature vectors and the neural probabilistic language model; grounds the curriculum's embedding and MLP derivations in the primary literature.
Probability basics and linear algebra
Every worked derivation in the lessons is self-contained and offline-complete; the paper is further reading only.
比較対象候補リソースと選定評価 (3)
Selected jointly: Makemore reproduces this architecture at character scale with MIT-licensed code; the paper supplies the original formalism and the n-gram comparison framing.
Strong textbook coverage of n-grams through neural LMs; kept as secondary reading because the primary derivation follows the original paper's notation.
Foundational for embedding geometry but trains on context-prediction objectives rather than the full next-token probabilistic model studied this week; revisited in later representation blocks.