βΎοΈ Flux: The First Practical Test-Time Training (TTT) Engine
Flux represents a paradigm shift in Large Language Models: moving from Static Intelligence to Liquid Intelligence.
Standard LLMs are frozen after training. They cannot learn from their mistakes during a session. Flux changes this. It is a lightweight, modular Test-Time Training Engine that allows any LLM to learn interactively during inference, updating its neural weights in real-time to master new concepts, environments, or rulesets on the fly.
"Don't just prompt the model. Teach it."
π The TTT Paradigm Shift
| Feature | Static LLMs (LoRA/Fine-Tuning) | Flux TTT Engine |
|---|---|---|
| Weight Updates | Offline (Requires retraining) | Online (Real-Time) |
| Adaptability | Rigid (Frozen knowledge) | Liquid (Adapts to Context) |
| Memory | Context Window Only | Neural Weights + Replay Buffer |
| Use Case | General QA, Chat | Simulation, Dynamic Environments, Personalized Agents |
π§ Flux Architecture
Flux is model-agnostic. It injects a "Liquid Brain" into a frozen host LLM:
- Frozen Host: Any standard LLM (Gemma, Llama, Mistral).
- Flux Adapters: Specialized, highly-plastic layers injected into attention blocks. These act as the "synapses" that can be re-wired instantly.
- Meta-Controller: A tiny auxiliary network that observes the host's hidden states and outputs Modulation Vectors, dynamically controlling the Flux Adapters.
π Capabilities
- Instant Skill Acquisition: Teach the model a new rule (e.g., "In this simulation, gravity is reversed"), and it updates its weights to apply that rule consistently.
- Continuous Learning: Includes a Stratified Replay Buffer to prevent catastrophic forgetting, allowing the model to stack multiple new skills over a long session.
- Drift Regularization: Ensures the model remains grounded and doesn't hallucinate as it learns.
π Included
This repository contains the Flux Physics World Model, a specialized architecture designed to embed intuitive physics understanding into Large Language Models (LLMs) using Flux Adapters (Dynamic Modulation Layers) and Test-Time Training (TTT). It was trained to understand complex physical interactions like Buoyancy, Zero-G, and Vacuum Dynamics.
final_flux_adapters.pt: The trained weights for the Flux Adapters.final_physics_controller.pt: The trained weights for the Physics Controller.modeling_physics_rl.py: The core PyTorch definition of the Flux architecture.continuous_learning_cumulative.py: Script for cumulative TTT sessions.
π» Usage
1. Installation
pip install torch transformers peft accelerate
2. Start the TTT Engine (Interactive Mode)
Launch a session and start teaching the model:
python continuous_learning_cumulative.py
- User: "Drop a hammer in zero-g."
- Model: "It falls."
- User: "Wrong. It floats."
- System: π§ Adapting Weights...
- User: "Drop a wrench."
- Model: "It floats." (Generalization achieved!)
3. Integration
from modeling_physics_rl import PhysicsModel
# Initialize Flux Engine
model = PhysicsModel()
model.load_weights("final_flux_adapters.pt")
# Teach (One-Shot Update)
# See continuous_learning_cumulative.py for implementation details
οΈ Training
The engine uses a specialized PPO/GRPO-style Reinforcement Learning loop optimized for fast convergence on small datasets (physics_dataset_streaming.jsonl).
Developed by Convai Innovations