CoolFace
Modelpublic

convaiinnovations/flux-test-time-training-new

sourceHugging Facemitupdated 8mo agoView on Hugging Face
0likes
Model Card

♾️ 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

FeatureStatic LLMs (LoRA/Fine-Tuning)Flux TTT Engine
Weight UpdatesOffline (Requires retraining)Online (Real-Time)
AdaptabilityRigid (Frozen knowledge)Liquid (Adapts to Context)
MemoryContext Window OnlyNeural Weights + Replay Buffer
Use CaseGeneral QA, ChatSimulation, Dynamic Environments, Personalized Agents

🧠 Flux Architecture

Flux is model-agnostic. It injects a "Liquid Brain" into a frozen host LLM:

  1. 1.Frozen Host: Any standard LLM (Gemma, Llama, Mistral).
  2. 2.Flux Adapters: Specialized, highly-plastic layers injected into attention blocks. These act as the "synapses" that can be re-wired instantly.
  3. 3.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

bash
pip install torch transformers peft accelerate

2. Start the TTT Engine (Interactive Mode)

Launch a session and start teaching the model:

bash
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
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