Skip to main content

evie-amplify-optim

Evie-Amplify: a risk-sensitive modulation of Adam-style optimizers that allows bounded amplification on low-variance gradient coordinates, on top of the noise-dependent suppression inherited from evie-optim.

The base Evie update is structurally a shrink-only reweighting of AdamW — it can only ever damp the step. Evie-Amplify re-centers the same noise-dependent gate around a target well-posedness level so that sufficiently low-noise coordinates can receive an update larger than the corresponding AdamW step, while noisy coordinates are still strongly damped.

Install

pip install evie-amplify-optim

Usage

import torch
from evie_amplify_optim import EvieAmplifyOptimizer

model = torch.nn.Linear(10, 1)
optimizer = EvieAmplifyOptimizer(
    model.parameters(), lr=1e-3, target_wp=0.85, well_pos_max=8.0
)

for step, (x, y) in enumerate(dataloader):
    optimizer.zero_grad()
    loss = torch.nn.functional.mse_loss(model(x), y)
    loss.backward()
    optimizer.step()

    # Calibrate gamma0 once, early in training (paper uses step 100-150).
    if step == 125:
        optimizer.calibrate_gamma0()

How it works

sigma_t^2 = max(m2_hat - m1_hat^2, 0)                  # gradient-variance estimate
gamma_t   = gamma0 / (1 + gamma0 * sigma_t^2)           # adaptive risk-aversion
raw_wp    = 1 / (1 + gamma_t * sigma_t^2)               # in (0, 1], Evie's shrink-only gate
well_pos  = clamp(raw_wp / target_wp, eps, well_pos_max)
update    = -lr * m1_hat * sqrt(well_pos) / sqrt(m2_hat)

Dividing by target_wp re-centers the gate: when the raw gate exceeds target_wp (i.e. the coordinate is low-noise), well_pos > 1 and the update is amplified; otherwise it is damped, same as in base Evie. Amplification is bounded above by well_pos_max / target_wp; suppression is unbounded below as gradient variance grows.

gamma0 is calibrated once, from a separate fast-EMA variance estimate, the same way as in evie-optim.

API

EvieAmplifyOptimizer(params, lr=1e-3, gamma0=1.0, target_wp=0.85, beta1=0.9, beta2=0.999, eps=1e-8, weight_decay=0.0, well_pos_max=8.0, fast_beta=0.9)

  • lr: learning rate.
  • gamma0: initial risk-aversion ceiling; overwritten by calibrate_gamma0().
  • target_wp: re-centering target for the well-posedness gate.
  • beta1, beta2: Adam moment decay rates.
  • weight_decay: decoupled weight decay (AdamW-style).
  • well_pos_max: upper clamp on the well-posedness factor, bounding maximum amplification.
  • fast_beta: decay rate for the separate fast-EMA variance estimate used only for calibration.

optimizer.calibrate_gamma0()

Call once, partway through training, to set gamma0 from the observed gradient variance. Safe to call only after at least one step().

License

MIT

Metadata

Release files for evie-amplify-optim 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evie-amplify-optim 0.1.0
File Size Uploaded Provenance Actions
evie_amplify_optim-0.1.0.tar.gz 8.9 kB Without provenance Details for evie_amplify_optim-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for evie-amplify-optim 0.1.0
File Interpreter ABI Platform Actions
evie_amplify_optim-0.1.0-py3-none-any.whl Python 3 none any Details for evie_amplify_optim-0.1.0-py3-none-any.whl

Total release size: 15.0 kB

Release files / evie_amplify_optim-0.1.0.tar.gz

Download URL evie_amplify_optim-0.1.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5e279880d0e27cc50dfc8bfe35a03a603f77c25484615c75a5f7d07c8875cf19
BLAKE2b-256 checksum
How to use checksums
62cbfea3833b9b49b4311815aaa32b22f015ce798cd2821b8323f7dd646ce197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / evie_amplify_optim-0.1.0-py3-none-any.whl

Download URL evie_amplify_optim-0.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0dcdacbaaa1f7b779c2918ffd6ad2c647de44156f01eb8ecccff9f36cf919bc
BLAKE2b-256 checksum
How to use checksums
ebefd0e9f8c58138304c649ebd15ae1c992821074dcdf65fbdba257e410c772f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for evie-amplify-optim 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page