Continuous Learning On Truffle

Continuous Learning On Truffle

The Harness & Dreaming

Matt Firth & Dylan Lanigan-Smith

Overview

Truffle ships with an always-on model. It runs 24/7, processing context from the user’s apps, deciding what is worth sharing, what it can handle on its own, and what is noise. It also handles direct requests and basic conversation. We built the harness and the dreaming system to turn that stream of experience into user-aligned changes in how the Truffle behaves.

The learning system has three layers. Context adapts as an interaction or input stream unfolds. This raw context gets distilled into summaries, memories, and behavioral insights that carry the learnings from the context into the rest of Truffle's work. Dreaming then consolidates the behavioral insights into the weights of the model. All of this, including data generation and training, runs fully on-device.

Harness

Truffle’s harness needs to process a constant flow of app context, maintain one continuous and never-ending conversation with the user, and curate Home all while feeling like one consistent entity.

To do this, the harness runs several contexts side-by-side while sharing global information across them. Each context can message any other and receives notifications about what the others have been doing. They share the user profile, memories, and behavioral insights, and a global store holds every context’s history as a universal contextual backbone, so each can search and read what happened in the others.

Layers of adaptation

The first layer is standard in-context learning. The agent adapts as new messages, app updates, and tool results arrive. We persist some of this learning across context windows via a compaction system inspired by Ehrlich and Blackman’s LCM: Lossless Context Management. It compresses the active context while maintaining the original information in the global store so that any context can search and navigate that history down to the original messages, and the compaction summary acts as a guide for what might be worth recalling.

The second layer of adaptation is the information and self-instructions Truffle saves and edits as it works. This builds on standard memory systems and Karten et al.’s Continual Harness. The user profile provides personal information about the user. Memories hold specific facts about the user’s life and work, including people, projects, and details that will matter again. Behavioral insights guide how the agent acts and are written and revised after the agent receives feedback, encounters tool errors, or learns from other interactions with its environment. These behavioral insights can be global, per-context, or even more narrowly situational. These updates produce strong behavioral changes immediately while training waits until sufficient data has been accumulated and the user is idle overnight.

Avoiding the pain of memory

One common failure mode in agents is that memories go stale. Facts that were once true keep affecting behavior long after they stop being relevant. Truffle’s system for memory and Continual Harness inspired self-instructions includes standalone workers to help mitigate this. When a user corrects a fact, a job for one of these workers is kicked off and it goes and sweeps every stored memory to make sure that it’s updated everywhere. A weekly review also reads the user profile, every memory and behavioral insight, and retires what a newer entry replaces, what no longer exists, or what is just plain stale and outdated.

From harness to training

Each behavioral insight change is recorded with what caused it, and these changes are used as the starting point for a data generation agent to navigate Truffle’s history over the day and find moments to learn from.

This transition from context-based adaptation to weight updates is critical for a number of reasons. First, tools, the user profile, memories, and behavioral insights pile up and all compete with the actual work of the Truffle for space in context. Second, as the context window fills up with work and behavioral insights multiply, the model pays less attention to any individual instruction and drifts towards its default behavior. Consolidating insights into the weights solves this.

Training

Data generation, training, and evaluation all run overnight locally on the Truffle when the user is idle.

Struggles with published methods

Most currently published methods for continual learning assume things a deployed agent never has. There is no ground truth and no verifier. Training also cannot be truly on-policy: we have to reuse the day’s recorded rollouts even after optimizer steps have changed the model, so those rollouts no longer reflect the current policy. Many of them also expect several rollouts over the same task, with clear segmentation of targets and tasks. Truffle has only one rollout of a moment. As an example, we cannot replay a user’s Tuesday exploring a number of different possible trajectories through their day. The user has already lived it. Furthermore, with infinite conversation and ephemeral cards, the concept of a “task” is not sufficiently well defined to straightforwardly use existing methods.

Method

What limits it in our setting

GRPO / RL with verifiable rewards
Shao et al. (2024)

Compares rewards across multiple attempts at the same prompt, using a verifier in the RLVR setting. We have one recorded trajectory through each situation and no general verifier for the user’s conversations and work.

SDPO
Hübotter et al. (2026)

Uses environment feedback and, when available, verified alternative solutions to construct the teacher’s supervision. We tested it with and without those solutions; without them, it performed poorly in our setting.

RESD
Zhang et al. (2026)

Builds reflections and a persistent playbook from environment feedback, with its published training loop using explicit outcome scores to distinguish failures from successful attempts. Our recorded interactions do not come with a general success/failure score.

OPCD
Ye et al. (2026)

Transfers knowledge from extra context into model weights by having a context-conditioned teacher score fresh responses from the current student. Our training must work from recorded interactions whose actions and subsequent feedback are already fixed.

SDPO from User Interactions
Kleine Buening et al. (2026)

Learns directly from recorded conversations by using the user’s subsequent message as privileged context for the teacher. This matches our setting, but it was unstable in our testing.

Any method that is going to be used for a personal, deployed agent must operate on only raw experience: what the agent did, what the user said or how they reacted to the agent, and what happened next. Starting from self-distillation, we began probing what worked, what failed, and where signal lived in this setting. We found a number of recurring failure modes and designed our objective around mitigating them.

Learning the wrong lessons

In self-distillation, the teacher is a version of the model given privileged information about the recorded interaction. The student is trained to match the teacher’s predictions without seeing that privileged context. What goes into that privileged context determines what the teacher corrects and what it reinforces.

  • Including the original completion in the privileged context made the teacher’s per-token supervision signal correlate inversely with correctness. The teacher reinforced the previous attempt even when it was wrong because a causal model’s tendency to copy what came before is too strong.
  • Including the original completion in the privileged context allows the teacher to know when a sequence is finishing and begin anticipating the end-of-text token ahead of time. This results in “stop” being the strongest lesson and replies collapse to just the end-of-text token. Removing the original completion from the privileged context can sometimes cause the opposite problem to arise where the teacher suppresses the end token and responses grow until they never finish.
  • Signal from the teacher when verified solutions are not used as part of the privileged context is incredibly sparse. Around 1% of the tokens carry 36.5% of the signal, 5% carry 63.8%, and 10% carry 78.4%. Most of the rest of the per-token advantages are noise. On failed rollouts, word-shuffling the privileged context preserves 94% of the absolute change in the recorded tokens’ log-probabilities.
Copying the original completion

Building our methodology

Each night the agent reviews new history across all contexts and selects moments worth learning from. It starts with the current set of behavioral insights and the changes to the set of insights from the last day. It finds the moments that caused each change, then tracks down other moments where the same lesson applies.

It also looks for successes and failures in the standard things Truffle needs to do well: understand the user’s intent, match their preferences and voice, use tools effectively, recover from errors, and ground claims in evidence. These are used to produce additional training examples, even when no behavioral insights were written or changed.

For each moment, it writes guidance for a better decision at that point. The rules for how it structures that guidance are designed to avoid the identified failure modes:

  • No replacement answer or verbatim wording from the original completion.
  • No usage of facts that were only available after the recorded moment. Only generalized behavioral insights derived from hindsight are allowed.

Additionally, users can reject any recorded lesson if it does not match how they want their Truffle to behave or if the data generation agent misunderstood something. Some moments are then held out and are transformed into part of the personalization evaluation dataset used to judge adapters.

At the core our objective is self-distillation. The student and teacher score the same recorded completion. The student sees the set of behavioral insights that were already in place prior to the recorded moment, while the teacher sees the behavioral insights updated after that moment and the lesson for it written by the data generation agent. Our tweaks are small and focused on the failure modes.

To avoid the end-of-text collapse, we mask out the first and last few tokens from the loss. This is sufficient to fully mitigate the issues when paired with privileged context that does not leak too much information about the completion. To improve the signal transfer we modulate between reverse and forward KL depending on the disagreement between the student and the teacher. Additionally, more weight is directed to tokens that are followed by sustained disagreement on subsequent tokens by the student and teacher, which helps concentrate the update where the decision matters. This idea draws on Ma et al.’s FIPO: Eliciting Deep Reasoning with Future-KL Influenced Policy Optimization.

We are also experimenting with attention masking to allow the teacher to use the original completion in the privileged context without providing a direct route to copy it. The lesson in the privileged context can attend to the original completion, while the completion tokens being scored cannot. Information can still flow through the KV of the lesson and, in hybrid models, through linear attention state, but blocking the direct route reduces copying and strengthens corrective signal.

Evaluations and Adapter Promotion

Each training run produces a candidate adapter which must pass a series of checks before being made active. Robust evaluation on a device this size is expensive. Running a full suite of generation-based benchmarks at useful sample counts every night would take longer than the training itself.

We work around this by making 15 of the 17 evaluations likelihood-based. They score a fixed reference text or answer choices without generating a new response for every example, allowing us to score a sample with a single forward pass. This panel covers language modeling, general knowledge, code and math, and pre-recorded tool-use trajectories.

We save generation for the two places where it is absolutely critical: instruction following (IFEval) and tool calling (Hermes Function Calling, actually producing the calls). These catch cases where the candidate adapter appears healthy on likelihood checks but its ability to generate answers or construct tool calls has collapsed.

Those checks measure degradation of general capabilities and are designed to catch catastrophic forgetting. To evaluate personalization, the data generation agent builds evaluations from the cases we reserved previously. For a gold-response evaluation (gold-standard perplexity or preference margin), it keeps an exemplary original response or writes the response the agent should have given, using the lesson and applicable behavioral insights to guide the re-generation. We measure three things:

  • Gold-standard perplexity: We score each gold response given its saved conversation before and after training. Lower perplexity means the tokens in those examples of desired behavior have become more likely.
  • Preference margin: For cases where the original response was incorrect, we score both that response and the corrected one and measure how much more likely the corrected one is relative to the original under the candidate adapter. The margin measures how strongly the model favors the correction over its original mistake.
  • Authorship margin: How much the adapted model prefers the user’s real messages over intentionally generic rewrites of the same message, which captures how in-distribution the user’s communication style and desires are becoming.

Each candidate adapter is compared against the best adapter so far. This comparison takes into account measured evaluation noise, so a fluke result on a small panel does not determine whether an adapter is promoted or rejected. If any evaluation regresses meaningfully, the candidate is discarded and the Truffle keeps running the current adapter. Otherwise the candidate is promoted and becomes the active adapted model.

In a test run, a single night of training dropped gold-standard perplexity by 19% and moved the preference margin for corrected responses from 0.010 to 0.177 nats/token. The following run flipped the authorship margin from negative to 0.158 nats/token. Across 13 successive adapters, the general capability measurements stayed in a similar range to the base model indicating minimal forgetting.

Measurement

Adapted model

Base model

MMLU-Pro

58.6% to 60.0%

58.3% to 59.8%

FineWeb perplexity

8.53 to 8.86

8.55

Personalization and forgetting: relative gold-response perplexity and preference margin across nightly runs, with general capabilities across 13 adapters.

Every adapter is tracked and stored and the user can roll back or reset to no adapter at any time if they don’t like the results of a dreaming run.

Conclusion

Truffle learns at three speeds. Context adapts it within a conversation. The harness turns experience into memories and behavioral insights that take immediate effect, and cleans them up when they go stale. Dreaming then consolidates these behavioral lessons into the weights overnight. Facts and general knowledge stay in memory. Only behavioral policy makes it into the weights with a robust evaluation system deciding which updates become active.

And of course, it’s all local.