Conflict-aware optimization for Keras.
NEAT (Nash-Equilibrium Adaptive Training) is a drop-in Keras 3 optimizer. It detects when the gradient fights the direction training has been moving and applies a bounded correction before each step. It runs on TensorFlow, JAX and PyTorch.
import keras
from neat_optim import NEAT
optimizer = NEAT(
learning_rate=1e-3,
alpha=0.25,
nce_mode="projection",
opponent_source="gradient_ema",
)
model.compile(
optimizer=optimizer,
loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True),
metrics=["accuracy"],
)
model.fit(x_train, y_train, epochs=5)
print(optimizer.diagnostic_snapshot())Keras drop-in
Pass NEAT to model.compile(...). Same code on TensorFlow, JAX and PyTorch, with full save and load support.
Diagnostics
See how often the correction fires and how strong it is, in History, TensorBoard or a JSON/HTML report.
Reference engine
Validate the update rule with deterministic NumPy code before moving to a framework.
Player-aware mode
Treat each example, task or objective head as its own gradient contributor.
Early benchmark results are mixed, and every one is published. See Benchmarks for setup and caveats.
Help build NEAT
There are benchmarks to run at real scale, a GPU path to build, and backends to test and break. Starter issues are open, including ones that need no GPU.