Kinetic AI
A unified library for game-theoretic LLM training: Magnetic Mirror Descent, Deep Equilibrium Models, and Mechanism Design.
The Thesis
Current AI systems are trained via dictatorial optimization — a single loss function forces updates on every parameter. But real-world deployment environments are adversarial, multi-agent, and strategic. Game theory, not optimization, is the correct mathematical framework.
Kinetic AI implements the transition from static optimization to dynamic equilibrium:
| Component | What it replaces | Validated status (see research/memory/findings.md) |
|---|---|---|
| Magnetic Mirror Descent | Simultaneous gradient play | Linear last-iterate convergence to its magnetic fixed point where GDA cycles (F1); RND resets reach Nash (F3); asymmetric-game attractor gap discovered (F2) |
| Deep Equilibrium Models | Explicit transformer layers | O(1) activation memory vs O(N) measured (F4); Anderson wins on stiff fixed points (F5) |
| Token Auctions | Winner-take-all generation | Second-price empirically truthful, regret exactly 0 (F6); weighted aggregation measurably manipulable |
| Magnetic Preference Optimization | DPO drift control | H3 PARTIAL: magnet provably applied but second-order to the DPO gradient across tau in [1e-3, 10] (F21 + rider); DPO shown to damage unseen phenomena (0.74 to 0.61 held-out); EqLM 1655x more drift-resistant than explicit under identical updates |
| Auction decoding | Fixed model / uniform ensembling | H4 MET 3/3 seeds: second-price per-token auction of two 30M domain specialists beats the best single model by 23% and logit-average ensembling by 12% on mixed-domain perplexity (F22) |
| EqLM (new architecture) | Stacked GPT-class LMs | H1 honestly missed: 93.0% of explicit-baseline BLiMP at 11M params (F18), 78.7% at 121M (F20) — the fixed-solver-budget truncation penalty widens with width. Confirmed at 121M: -23% peak memory (O(1) depth), 79% cheaper warm-started decoding (F19). Open problem named: contraction that survives width |
Released 121M checkpoints: kinetic-eqlm-121m-babylm · kinetic-explicitlm-124m-babylm. Findings site: https://sharathsphd.github.io/game-llm/
Everything above traces to committed runs under results/ (config hashes + seeds).
The research process is spec-driven and adversarially reviewed — see CLAUDE.md,
research/specs/, and docs/decisions/. Paper: paper/kinetic_ai.tex. Site: site/.
Researcher app: apps/web + app/server.py (see apps/web/DEPLOY.md).
Installation
pip install -e ".[all]"
Quick Start
Strategy-Space MMD on Rock-Paper-Scissors
import torch
from kinetic_ai.games.payoff import rock_paper_scissors
from kinetic_ai.games.qre import nash_conv
from kinetic_ai.optim.bregman import NegativeEntropy
from kinetic_ai.optim.mmd import mmd_strategy_update
game = rock_paper_scissors()
bregman = NegativeEntropy()
s1 = torch.tensor([0.7, 0.2, 0.1]) # Biased initial strategy
s2 = torch.tensor([0.1, 0.7, 0.2])
ref = torch.ones(3) / 3 # Uniform reference (magnet)
for step in range(500):
# Sequential (alternating) updates with reduced learning rate
# ensure convergence. Simultaneous updates require tighter stepsizes.
g1 = game.utility_gradient(1, s1, s2)
s1 = mmd_strategy_update(s1, g1, ref, bregman, lr=0.1, tau=0.05)
g2 = game.utility_gradient(2, s2, s1)
s2 = mmd_strategy_update(s2, g2, ref, bregman, lr=0.1, tau=0.05)
print(f"NashConv: {nash_conv(game, s1, s2):.6f}") # Converges to τ-regularized QRE (≈Nash for RPS)
DEQ Layer with Anderson Acceleration
import torch
import torch.nn as nn
from kinetic_ai.config import DEQConfig, SolverType
from kinetic_ai.models.deq_layer import DEQLayer
transform = nn.Linear(32, 16)
def f(z, x):
return torch.tanh(transform(torch.cat([z, x], dim=-1)))
deq = DEQLayer(f, DEQConfig(solver=SolverType.ANDERSON, max_iter=50))
z_star = deq(torch.randn(1, 16)) # Finds equilibrium state
Token Auction
import torch
from kinetic_ai.config import AuctionConfig, AuctionType
from kinetic_ai.mechanisms.auctions import TokenAuction
auction = TokenAuction(AuctionConfig(
auction_type=AuctionType.WEIGHTED_AGGREGATION,
vocab_size=1000,
))
bids = torch.tensor([2.0, 5.0, 1.0])
dists = torch.softmax(torch.randn(3, 1000), dim=-1)
result = auction.run_auction(bids, dists)
print(f"Selected token: {result.sampled_token}")
Architecture
kinetic_ai/
├── optim/ # Magnetic Mirror Descent + Bregman divergences
├── models/ # Deep Equilibrium Layers (Anderson, Broyden, Picard)
├── mechanisms/ # Token auctions, mechanism design
├── games/ # Game definitions, QRE computation, self-play
├── eval/ # Convergence diagnostics, statistical testing
└── config.py # Config-driven experiment system
Running Tests
pytest tests/ -v # All tests
pytest tests/ -v -m "not slow" # Skip slow convergence tests
Running the Full Simulation
python simulate.py
References
- Sokota et al. "A Unified Approach to RL, QRE, and Two-Player Zero-Sum Games" (NeurIPS 2023)
- Bai et al. "Deep Equilibrium Models" (NeurIPS 2019)
- Duetting et al. "Mechanism Design for Large Language Models" (WWW 2024, Best Paper)
- Wu et al. "Self-Play Preference Optimization for Language Model Alignment" (2024)
- McKelvey & Palfrey "Quantal Response Equilibria for Normal Form Games" (1995)
License
MIT
Metadata
Release files for kinetic-ai 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kinetic_ai-1.0.0.tar.gz | 124.8 kB | Without provenance | Details for kinetic_ai-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kinetic_ai-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for kinetic_ai-1.0.0-py3-none-any.whl |
Total release size: 202.4 kB
Release files / kinetic_ai-1.0.0.tar.gz
| Download URL | kinetic_ai-1.0.0.tar.gz |
|---|---|
| Size | 124.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a54e3c62b408e328d217513f519b53133823f1cedb8ec20732fa1c4494598636
|
|
BLAKE2b-256 checksum How to use checksums |
71c2c8ec377f76423e847fc159db352d951b100eccfae1a62c1a93c52be6fc78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / kinetic_ai-1.0.0-py3-none-any.whl
| Download URL | kinetic_ai-1.0.0-py3-none-any.whl |
|---|---|
| Size | 77.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af5456c311a8a3bc8b150a423c9feb9c73611b8f6463160fc89c84935e1a5e22
|
|
BLAKE2b-256 checksum How to use checksums |
85bd09a682ae1b0019b1eae55e4d54a98958bf04cc344bf05c4615acde231509
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for kinetic-ai 1.0.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.