Configuration
Every NEAT optimizer argument, grouped by what it controls.
All research options default to off, so a plain NEAT(learning_rate=..., alpha=...) uses the original nce_spec_v2 update.
Core
| Argument | Default | Effect |
|---|---|---|
learning_rate | 1e-3 | Optimizer step size |
alpha | 0.25 | Correction strength (0 disables the correction entirely) |
beta | 0.9 | Momentum decay |
Opponent signal
What counts as the conflict opponent, set with opponent_source:
| Value | Behaviour |
|---|---|
"momentum" (default) | Uses the accumulated momentum vector |
"gradient_ema" | Uses an exponential moving average of raw gradients |
"previous_gradient" | Uses the previous raw gradient |
"blended" | Weighted mix of momentum and gradient EMA |
Correction controls
| Argument | Default | Effect |
|---|---|---|
nce_mode | "projection" | "projection", "cosine", or "off" |
nce_clip_ratio | 1.0 | Maximum correction size as a fraction of the gradient norm |
correction_warmup_steps | 0 | Steps before the correction activates |
conflict_threshold | 0.0 | Minimum conflict ratio before any correction is applied |
Adaptive features
| Argument | Default | Effect |
|---|---|---|
adaptive_alpha | False | Correction strength responds to conflict, noise, and alignment trends |
adaptive_correction | False | Scale the correction by opponent reliability and conflict EMA |
adaptive_correction_decay | 0.9 | EMA decay for adaptive correction |
adaptive_correction_min_scale | 1.0 | Lower clamp on the adaptive scale |
adaptive_correction_max_scale | 3.0 | Upper clamp on the adaptive scale |
adaptive_preconditioning | False | Adam-style diagonal second-moment preconditioner |
second_moment_beta | 0.999 | Decay for the second-moment EMA |
bias_correction | False | Bias-correct momentum and second moment |
Training stabilizers
Useful for benchmark ablations. These compose established techniques with the NEAT correction; they are not new contributions.
| Argument | Effect |
|---|---|
update_mode="lion" | Lion-style sign update after the NEAT correction |
gradient_centralization=True | Center matrix-like gradients before the update |
nesterov=True | Nesterov-style momentum |
lookahead_k > 0 | Lookahead slow-weight synchronization every k steps |
Sparsity and weight decay
| Argument | Default | Effect |
|---|---|---|
weight_decay | 0.0 | L2 weight decay coefficient |
decouple_weight_decay | True | Apply decay before the gradient step (AdamW-style) |
sparsity_l1 | 0.0 | Soft L1 shrinkage after each step |
prune_threshold | 0.0 | Hard-zero weights below this magnitude |
Spec version
| Argument | Default | Effect |
|---|---|---|
spec_version | "nce_spec_v2" | Pass "nce_spec_v3" to opt in to the additive research controls described in Algorithm |
Example
from neat_optim import NEAT
optimizer = NEAT(
learning_rate=1e-3,
alpha=0.25,
beta=0.9,
nce_mode="projection",
opponent_source="gradient_ema",
correction_warmup_steps=5,
adaptive_alpha=True,
adaptive_preconditioning=True,
)