Training-Inference Kernel Contracts: Bounding Divergence in Post-Training and Deployment
This paper proposes a "kernel contracts" framework to formally specify and bound the distributional divergence between training and inference kernels in post-training pipelines, deriving theoretical bounds on policy-gradient bias and outlining a structured deployment pipeline, while noting that it presents a conceptual framework without production-scale empirical validation.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a brilliant chef (the AI model) who has spent years learning to cook in a high-end, perfectly calibrated test kitchen. In this kitchen, they use precise digital scales, fresh ingredients, and a slow, careful cooking process to ensure every dish is perfect. This is the Training Kitchen.
Now, imagine you want to serve this chef's recipes to thousands of hungry customers at a busy food truck. To keep up with demand, you switch to a different setup: you use pre-measured spice packets, a faster (but slightly less precise) grill, and a system where orders are batched together to save time. This is the Inference Kitchen.
The problem, according to this paper, is that even though the chef is the same person using the same secret recipe (the model weights), the food coming out of the food truck isn't exactly the same as the food from the test kitchen. The difference is tiny—maybe a pinch of salt here or a slightly different sear there—but over thousands of orders, these tiny differences can add up. Sometimes, a dish that was supposed to be "spicy" comes out "mild," or a safety check that worked in the kitchen fails on the truck.
The paper calls this gap the "Training-Inference Kernel Contract." Here is a simple breakdown of their solution:
1. The Problem: "Two Different Chefs"
Currently, when we build AI, we assume the "Training Chef" and the "Inference Chef" are doing the exact same thing. But in reality, they are using different tools and methods.
- Training uses high-precision math (like a digital scale).
- Inference uses fast, low-precision math (like a visual estimate) to go faster and save money.
Because they use different tools, they sometimes make different decisions. In a normal restaurant, this might just mean a soup tastes slightly different. But for AI, this can mean:
- The "Reward Hack": In Reinforcement Learning (where the AI learns by trial and error), the AI might think it's doing a great job because the "fast" kitchen gave it a good score, while the "precise" kitchen would have given it a bad one. It's like a student getting an A on a practice test but failing the real exam because the grading rubric changed.
- The "Safety Slip": A prompt that the model refuses to answer in the test kitchen might accidentally get answered in the food truck because the fast grill changed the flavor just enough to bypass the safety filter.
2. The Solution: The "Kernel Contract"
The authors propose a new rulebook called a Kernel Contract. Think of this not as a legal document for lawyers, but as a Quality Control Checklist that travels with the AI.
This contract says: "We know the fast kitchen (Inference) won't be 100% identical to the test kitchen (Training). That's okay. But here are the specific rules we will NOT break."
The contract has four main sections:
- Numerical Rules (N): "The math can't drift more than X amount." (e.g., The spice level can't change by more than 10%).
- Statistical Rules (S): "The final taste must be consistent." (e.g., 99% of the time, the dish must still be recognized as 'Spicy').
- Runtime Rules (R): "It still has to be fast enough." (e.g., The food truck can't slow down just because we added a safety check).
- Observability Rules (O): "We must be able to taste-test any specific order later." (If a customer complains, we must be able to replay that exact order in both kitchens to see what went wrong).
3. The "Escalation Policy" (What happens if you break the rules?)
The contract isn't just a list; it has a traffic light system:
- Green (L1): "Heads up." We logged a tiny difference. Keep cooking.
- Yellow (L2): "Warning." The difference is getting too big. We stop sending new orders to this kitchen and route them to a backup kitchen until we fix it.
- Red (L3): "Emergency." Something is critically wrong. We immediately shut down this kitchen and switch to a known-good version.
4. The "Four-Stage Promotion" (How to test before serving)
You don't just flip a switch and send the new kitchen to the public. The paper suggests a four-step safety tunnel:
- Offline CI: Run the checklist on a fixed set of test orders in the lab. If it fails, don't even leave the lab.
- Shadow: Let the new kitchen cook, but serve the old kitchen's food to customers. We just watch to see if the new kitchen would have made mistakes.
- Canary: Let the new kitchen serve a tiny group of real customers (like 1%). If they complain, we stop immediately.
- Full: If everyone is happy, we let the new kitchen serve everyone.
5. Why This Matters for "Learning" AI (RL)
The paper makes a specific point about AI that learns by itself (Reinforcement Learning).
- The Issue: When the AI learns, it takes a "snapshot" of the world using the fast kitchen, but then tries to learn from the precise kitchen. It's like trying to learn to drive a car by watching a video of a race car, but then driving a different model of car. The AI gets confused and learns the wrong lessons.
- The Fix: The contract forces the AI to admit, "Hey, my fast kitchen and precise kitchen are different." It adds a "correction factor" to the learning process so the AI doesn't get tricked by the speed of the food truck.
Summary
The paper argues that we need to stop pretending the "Training AI" and the "Serving AI" are the same thing. Instead, we should treat them as two different partners who have signed a Contract. This contract explicitly states how much they are allowed to disagree, what happens if they disagree too much, and how to catch those disagreements before they ruin the customer's experience.
It's about moving from "hoping everything works" to "measuring exactly where the differences are and managing them."
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.