Initial-Only Weight Decay with Tail Averaging / report_super_2026-08-30T083749.md
Audited (legacy)
Супер-проверка · промт оператора:
Вот конкретный эксперимент для агента. Скопируй как есть.
Эксперимент #85: Initial-Only Weight Decay + Tail Averaging
Статья: 2608.22953
Файл: exp85_initial_only_weight_decay_tail_averaging.py
Гипотеза
Weight decay нужен только на ранней фазе обучения, чтобы задать масштаб весов. На поздней фазе он мешает сходимости. Tail averaging последних шагов снижает дисперсию финальных параметров и улучшает generalization. Вместе они дают ту же или лучшую accuracy при меньшем числе шагов.
Задача
MNIST, MLP 3 слоя: 784 → 256 → 256 → 10, активация ReLU.
Оптимизатор: AdamW, lr=1e-3, betas=(0.9,0.999), weight_decay=0.05.
Расписание: cosine annealing, T=5000 шагов.
Seeds: 5.
Варианты (4 режима)
| Код | Weight decay | Tail averaging |
|---|---|---|
| baseline | все T шагов | нет |
| initwd | только первые p*T шагов, p=0.5 | нет |
| initwd_tail | первые p*T шагов, p=0.5 | да, последние q*T шагов, q=0.2, равномерное усреднение |
| wd_tail | все T шагов | да, последние q*T шагов, q=0.2 |
wd_tail — контроль, чтобы отделить эффект tail averaging от эффекта initial-only WD.
Реализация хитростей
- Initial-only WD: модифицировать AdamW так, чтобы
weight_decayприменялся только на шагахstep < p*T. Послеp*T— обычный Adam без WD. - Tail averaging: хранить копию параметров. На каждом из последних
q*Tшагов добавлять текущие параметры в сумму. В конце разделить на число шагов хвоста. Итоговую accuracy считать по усреднённым весам.
Метрики
test_accuracy(среднее ± std по 5 seeds)best_test_accuracyза всё обучениеsteps_to_best— на каком шаге достигнут лучший результатfinal_weight_norm— L2-норма всех параметров в концеmid_gradient_norm— средняя норма градиента на шагах 2000-3000
Критерий успеха
initwd_tailпо accuracy ≥baselineпри том же T.- Или
initwd_tailдостигает accuracybaselineза меньше шагов (сравнитьsteps_to_best). initwd_tailлучшеinitwdи лучшеwd_tail— значит оба компонента работают.
Фальсификация
Если initwd без tail averaging уже хуже baseline, а tail averaging не компенсирует — гипотеза неверна. Если wd_tail ≈ initwd_tail, значит весь эффект от tail averaging, а не от initial-only WD.
Это минимальный воспроизводимый эксперимент на CPU/одной GPU. Запускается за минуты. Если агент хочет быстрее — уменьшить T до 3000 и width до 128, но тогда 5 seeds обязательны.
Ответ агента:
{ "worked": false, "confidence": 9, "verdict": "Built and ran the specified 784-128-128-10 ReLU MLP with AdamW, cosine learning-rate annealing, 3,000 steps, and five seeds on real MNIST. The operator inequality sanity check passed, but initial-only decay did not produce a distinct improvement: initwd_tail reached 0.97744 +/- 0.00110 accuracy versus 0.97720 +/- 0.00106 for constant WD, while constant-WD tail averaging also reached 0.97744 +/- 0.00109. Thus the observed small gain is attributable to tail averaging, not the proposed initial-only schedule; no faster best step was observed.", "metrics": { "baseline": "MNIST, 5 seeds: baseline constant WD test accuracy 0.97720 +/- 0.00106, best accuracy 0.97764 +/- 0.00058, steps-to-best 2700 +/- 300, weight norm 15.5723 +/- 0.1096, mid-gradient norm 0.5346 +/- 0.0108, runtime 23.06 +/- 1.37 sec/mode-seed. wd_tail: 0.97744 +/- 0.00109; paired gain over baseline +0.00024 +/- 0.00009.", "idea": "initwd_tail: test accuracy 0.97744 +/- 0.00110, best accuracy 0.97764 +/- 0.00059, steps-to-best 2700 +/- 300, weight norm 15.7558 +/- 0.1114, mid-gradient norm 0.5352 +/- 0.0105, runtime 23.62 +/- 1.25 sec/mode-seed. Paired gain over baseline +0.00024 +/- 0.00025, over initwd +0.00020 +/- 0.00032, and versus wd_tail approximately 0.00000 +/- 0.00019 (2/5 wins). Operator check passed with gaps -0.000371 and -0.000376." }, "how_to_run": "/home/maxwelhelp/main/bin/python3 exp85_initial_only_weight_decay_tail_averaging.py --runs 5 --T 3000 --width 128 --out super_results.json", "files": [ "exp85_initial_only_weight_decay_tail_averaging.py", "super_results.json", "report.md", "experiment.py", "results.json" ], "limitations": "Tested one real dataset, one MLP width, one prescribed weight-decay/horizon/window configuration, and five seeds; did not test CIFAR-10, ResNet, momentum SGD, hyperparameter sweeps, sharpness, or matched-FLOP/steps-to-target analyses. MNIST evaluation sampled every 300 steps, and the operator inequality uses finite Monte Carlo sampling. The reported final weight norm for tail modes is the non-averaged training norm." }