
2025/12/16 15:26
**Show HN:** *Autograd.c* – スクリッチから作る小型機械学習フレームワーク
RSS: https://news.ycombinator.com/rss
要約▶
Japanese Translation:
リポジトリには、Cで書かれた最小限の逆伝搬自動微分エンジンが含まれています。参照カウント付きテンソル、アリーナ割り当てされた関数ノード、明示的な依存関係カウント、および集中型勾配蓄積を使用して、スカラー損失の逆伝搬を行いながらメモリ使用量を低く抑えます。
docs/about.md はそのアーキテクチャを説明しており、ミニマリズムと効率性を強調しています。 make download コマンドは、約 2.55 MB/s の速度で CIFAR‑10 バイナリデータセット(~33 MB)を取得します。
make run-release を実行すると、50,000 のトレーニングサンプル(さらに 10,000 のテストサンプル)で簡易モデルを訓練します。初期平均損失は 2.2632、精度は 20.48 % です。訓練後のテスト精度は 23.56 % に上昇します。トレーニングログには epoch 2/15 の視覚的損失曲線が示されており、最大損失は 2.3112、最小損失は 2.2899 で、評価と訓練中のスループットは約 0.7–1.5 イテレーション/秒です。
コードベースはコマンドラインユーティリティ(
make、cat など)のみで呼び出され、カスタムCコードにのみ依存しています。外部のディープラーニングライブラリは参照していません。本文
$
toilet -f mono9 -w 100 "autograd.c"
▄ █ ▄▄▄ ▄ ▄ ▄▄█▄▄ ▄▄▄ ▄▄▄▄ ▄ ▄▄ ▄▄▄ ▄▄▄█ ▄▄▄ ▀ █ █ █ █ █▀ ▀█ █▀ ▀█ █▀ ▀ ▀ █ █▀ ▀█ █▀ ▀ ▄▀▀▀█ █ █ █ █ █ █ █ █ ▄▀▀▀█ █ █ █ ▀▄▄▀█ ▀▄▄▀█ ▀▄▄ ▀█▄█▀ ▀█▄▀█ █ ▀▄▄▀█ ▀█▄██ █ ▀█▄▄▀ ▄ █ ▀▀
$
cat docs/about.md | fold -w 75
a minimal reverse mode autograd engine in c with reference counted tensors, arena allocated function nodes, explicit dependency counting, centralized gradient accumulation, scalar loss backpropagation and a small set of core tensor ops implemented with tightly coupled forward and backward code.
$
make download
data/cifar-10-binary 40%[====> ] 33.10M 2.55MB/s eta 47s
$
make run-release
loaded data train samples: 50000 test samples: 10000 created model starting training avg loss: 2.2632, avg acc: 20.48% evaluating: 100%|█████████████████████████████████████| 79/79 [0.7it/s] test acc: 23.56% ┌─────────────────── loss (epoch 2/15) ───────────────────┐ │ • │ 2.3112 (max) │ │ │ •• │ │ • • • │ │• • │ │ •••• • • • │ │ •• • • • • │ │ •• • • │ │ • • • • • • │ │ • • • │ │ • • • • • • • • • • │ │ • • • │ │ • • • • ┤––– 2.2941 │ • │ │ • • • │ 2.2899 (min) └──────────────────────────────────────────────────────────┘ 96%|██████████████████████████████████████████████▊ | 750/782 [1.5it/s]