Skip to content

Rose v2.0.0

Latest

Choose a tag to compare

@MatthewK78 MatthewK78 released this 04 Dec 03:45

What's new

  • Zero-inclusive ranges. Each multi-element slice is normalized using a range that includes zero. In exact arithmetic, this bounds each element of the gradient step by the effective learning rate. Weight decay and write-back rounding are separate.
  • Upward-only stabilization. With stabilize=True, divisors below the cross-slice mean are lifted toward it. Divisors at or above the mean are unchanged, so stabilization never amplifies a gradient update.
  • signSGD for single-element slices. The scalar fallback now also covers one-element vectors and shapes such as (m, 1). These slices use the gradient's sign instead of range normalization.
  • Automatic step-size compensation. For tensors of rank 2 or higher, when the leading slice count m exceeds the last-dimension width w, Rose scales the gradient step size by sqrt(m / w). Weight decay still uses the unscaled group learning rate.
  • Decoupled exponential weight decay. Rose applies exp(-lr * weight_decay) before the gradient step. With a positive reference learning rate, optional wd_schedule makes the decay exponent scale with lr.
  • One-draw BF16 stochastic rounding. bf16_sr uses a cached offset table and one random draw per updated BF16 tensor. Each element retains its exact carry probability, giving updates smaller than the local BF16 spacing a chance to reach the stored weight.

Upgrading from v1.x

  • compute_dtype now defaults to "fp32" instead of "fp64".
  • weight_decay now defaults to 1e-3 instead of 1e-4.
  • If you explicitly select "fp16" or "bf16" compute, disable stochastic rounding with bf16_sr=False.
  • If you use wd_schedule and start warmup at a learning rate of zero, supply a positive reference rate explicitly.
  • Please re-tune lr and weight_decay rather than assuming your v1 settings will produce the same updates.

Install or upgrade

python -m pip install --upgrade rose-opt==2.0.0

Requires Python 3.10+ and PyTorch 2.0+. The import is unchanged: from rose_opt import Rose