♾️ 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.
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
python
1from modeling_physics_rl import PhysicsModel
23# Initialize Flux Engine4model = PhysicsModel()5model.load_weights("final_flux_adapters.pt")67# Teach (One-Shot Update)8# 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).