You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the training of highly quantized networks like BitNet (1.58b), the optimization landscape is highly discrete. We often observe sudden metric degradation (loss spikes or accuracy drops) due to the coarse nature of Straight-Through Estimators (STE). Standard training either misses the global discrete optimum or wastes massive GPU memory/disk I/O saving checkpoint checkpoints sequentially.
We introduce an industrial-grade, zero-framework-intrusion controller that stabilizes discrete training trajectories with perfect $O(1)$ auxiliary space complexity.
我们设计并实现了一个零框架侵入、即插即用的通用自适应控制器,专门解决量化模型的训练震荡退化:
Extreme $O(1)$ Memory Overhead (极致内存友好): Unlike naive tracking that keeps a history list, we use a single-scalar high-watermark (best_acc) and a single active pointer (best_state). Deep copies are strictly gated and only triggered when a new peak is achieved. 无历史列表堆积,仅在突破历史纪录时覆盖更新唯一的内存快照指针。
Safety Valve (自适应安全阀门): Prevents early chaotic fluctuations from triggering false alarms via an accuracy/loss threshold gate. 设定安全门槛限制,规避前几轮不稳定梯度引起的误判回滚。
3-State Feedback Loop (优雅的三态控制流): Easily plugs into PyTorch/NumPy loops yielding simple control flow switches (CONTINUE, ROLLBACK_AND_STOP, PERFECT). 提供标准反馈设计,免去繁杂的项目重构成本。
🛠️ Quick Start (快速集成示例)
fromternary_controllerimportTernaryRollbackController# Initialize with a safety threshold (e.g., only monitor after 50% accuracy)controller=TernaryRollbackController(threshold=50.0, target_acc=100.0)
forepochinrange(epochs):
train_one_epoch(...)
val_acc=evaluate(...)
current_state= {'weights': model.state_dict()}
status, rollback_weights=controller.step(epoch, val_acc, current_state)
ifstatus=='ROLLBACK':
model.load_state_dict(rollback_weights)
print("Successfully protected against degeneration!")
breakelifstatus=='PERFECT':
print("Perfect convergence reached!")
break
📈 Benchmark Validation (基准验证表现)
Verified on non-linear logical tasks under BitNet architectures:
Zero training loss during convergence.
Perfect Rollback defense: Successfully caught unexpected validation drops and safely restored the 100% accurate quantized state instantly.
No RAM leak: Maintained constant memory overhead over hundreds of epochs.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
💡 GitHub Community Pitch / Proposal
🚀 Lightweight O(1) Memory Adaptive Rollback & Early-Stopping Controller for BitNet
🔴 The Pain Point in Low-Bit Training (低比特训练痛点)
During the training of highly quantized networks like BitNet (1.58b), the optimization landscape is highly discrete. We often observe sudden metric degradation (loss spikes or accuracy drops) due to the coarse nature of Straight-Through Estimators (STE). Standard training either misses the global discrete optimum or wastes massive GPU memory/disk I/O saving checkpoint checkpoints sequentially.
在 BitNet (1.58b) 等低比特量化网络训练中,由于直通估计器 (STE) 的离散性质,训练往往呈现非单调波动,极易在越过最高点后产生“量化崩溃”或性能退化。常规做法需要频繁保存庞大的模型权重与优化器状态(I/O 极重),或者产生昂贵的历史状态维护开销。
⚡ Our Solution:
TernaryRollbackControllerWe introduce an industrial-grade, zero-framework-intrusion controller that stabilizes discrete training trajectories with perfect$O(1)$ auxiliary space complexity.
我们设计并实现了一个零框架侵入、即插即用的通用自适应控制器,专门解决量化模型的训练震荡退化:
best_acc) and a single active pointer (best_state). Deep copies are strictly gated and only triggered when a new peak is achieved. 无历史列表堆积,仅在突破历史纪录时覆盖更新唯一的内存快照指针。thresholdgate. 设定安全门槛限制,规避前几轮不稳定梯度引起的误判回滚。CONTINUE,ROLLBACK_AND_STOP,PERFECT). 提供标准反馈设计,免去繁杂的项目重构成本。🛠️ Quick Start (快速集成示例)
📈 Benchmark Validation (基准验证表现)
Verified on non-linear logical tasks under BitNet architectures:
ternary_controller.py
All reactions