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 |
| Self-Play (SPPO) | RLHF / DPO | Policy-weighted self-play loop with convergence tests; LLM-scale runs pending |
| EqLM (new architecture) | Stacked GPT-class LMs | Parity with a param-matched explicit baseline at smoke scale (F10); full BabyLM run in progress |
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kinetic_ai-0.2.0.tar.gz.
File metadata
- Download URL: kinetic_ai-0.2.0.tar.gz
- Upload date:
- Size: 103.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2515b8912ed9667c851555e5222866c5160ea1b8ef20b148bd069a6127e04b0
|
|
| MD5 |
60c653dca77c62cae09675ae204a9185
|
|
| BLAKE2b-256 |
832a90ef56cb55818abaa9b116c5b0045dad87cba32a5b706d55012325943c3a
|
File details
Details for the file kinetic_ai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: kinetic_ai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 70.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe05d3730e084cc2f9c739e8e36d1a7ab7080146244faea4a56916e1a5a664c3
|
|
| MD5 |
3645ed4c5270724891489b76ad40fb68
|
|
| BLAKE2b-256 |
5f5fa6fb34a9c74d98543c679b8a035b79a1bdd44183484da82ccb05aeaec0ef
|