Teaching a Small Language Model to Remember
An experiment in QLoRA, model training, and evaluation with Qwen3.5-4B on a 16 GB Mac.
TL;DR. I trained two QLoRA adapters on Qwen3.5-4B (4-bit, MLX, 16 GB Mac) to test whether supervising replies that depend on earlier evidence improves roleplay continuity. On a locked 12-scenario counterfactual test, base and both adapters all scored 9/12, and in blinded comparisons I preferred the untuned model (18–2–4). The useful outcome is the local workflow: curate, preflight, train, inspect, evaluate.
The code is Qwen Storythread. The dataset is the curated PIPPA subset.
I. The Experiment: Can We Teach Continuity?
Say you’re playing a roleplaying game with an AI character. Early on, you tell the character a secret. A few exchanges later you ask about it, and the character contradicts what happened or acts as though the conversation never took place.
Language-model characters often lose track of the story this way.
I wanted to know whether fine-tuning could fix that. Could a small language model learn to weight events from earlier in a conversation over the most recent exchanges?
That question became Qwen Storythread, a local post-training experiment built around Qwen3.5-4B and QLoRA.
The hypothesis: if we train an adapter on character responses requiring information from earlier in a conversation, it should demonstrate better continuity than an adapter trained on responses relying on recent information.

One card, several turns back.
This wasn’t an experiment in persistent memory or database retrieval. Every relevant fact was already in the conversation supplied to the model. The question was whether training could improve how the model used that information.
I trained two adapters under otherwise identical conditions, developed tools for preparing and inspecting the training data, and built an evaluation pipeline to compare their behavior against the original model.
The result was not what I expected. Neither adapter improved our primary continuity metric. In blinded human comparisons, the original, untuned model was also generally preferred as a conversational partner.
This doesn’t mean fine-tuning can’t improve narrative continuity. It does leave me asking what we’re teaching a model and how we measure improvement.
The experiment also taught me the engineering around model training. Running gradient updates turned out to be a small part of it.
II. What QLoRA Actually Changes
During pretraining, a model learns parameters by predicting tokens across enormous datasets. Those parameters encode statistical relationships that let the model generate language and follow instructions.
Fine-tuning continues the learning process on a more targeted dataset. Instead of learning language from scratch, we adjust an existing model’s behavior.
The obvious approach is to update the model’s parameters directly. But even a four-billion-parameter model is expensive to train once you count gradients and optimizer states.
Low-Rank Adaptation (LoRA) is a cheaper option.
Rather than updating the original weight matrix, LoRA freezes it and introduces two smaller trainable matrices. Their product represents an additive update to the original transformation.
Conceptually:
y = Wx + s(xA)B
Here, W is the frozen weights, A and B are the trainable adapter matrices, and s is a scaling factor. The adapter rank controls the size of the trainable part.
That lets us change a model’s behavior without updating billions of original parameters.
Quantized LoRA (QLoRA) takes this further by storing the frozen base model at reduced precision.
For Storythread, I used mlx-community/Qwen3.5-4B-4bit, which stores the base weights using 4-bit quantization. The LoRA adapters are trained on top of that frozen, quantized model.

The base stays put. A small product is added on the way out.
Strictly, this is QLoRA in the broad sense, not a reproduction of the original paper’s implementation.
The experiment uses Apple’s MLX framework rather than bitsandbytes. Its quantization format and optimizer setup differ from the original paper’s NF4, double-quantization, and paged-optimizer recipe.
MLX calls the training operation lora because quantization is already part of the model representation.
For this experiment, I used rank-8 adapters with a scale of 2, applied only to the final four of Qwen3.5-4B’s 32 blocks. The remaining parameters stayed frozen.
The training configuration used Adam with a learning rate of 1e-4, a batch size of one, and gradient checkpointing to reduce memory consumption.
Training loss applied only to the assistant’s reply, not the preceding conversation. We wanted the model to learn how the character should respond to earlier evidence, not reproduce the player’s messages.
These settings made training practical on my laptop. I’m not claiming rank 8 or four adapted blocks are optimal for learning continuity.
III. Building the Tools Around Training
Model training takes far more engineering than calling a training function.
A useful experiment needs curated data, repeatable configurations, validation checks, inspection tools, and an evaluation that doesn’t undermine its own conclusions.
I built these into the Storythread package so the repository works as both an experiment and a reproducible tutorial.

Training is one step in the line.
Curating and authoring the data
The starting point was PIPPA, a dataset of contributed roleplay conversations involving Character.AI characters. The source logs were contributed with consent and redacted for personal information, although the material is not necessarily suitable for all audiences.
I built a local review interface to inspect and approve conversation windows. An optional Ollama-powered judge helps flag potential continuity examples and low-quality dialogue, but the final approval remains human-controlled.
The pilot used material drawn from a curated subset of 80 conversations.
Alongside this data, I created synthetic training scenes designed specifically for the experiment.
Each scene contains a shared conversational history and two possible supervised replies: one relying on recent evidence and another depending on evidence farther back.
This produced two training conditions:
- Recent: supervised replies depend on facts from approximately 2–4 turns earlier.
- Earlier: supervised replies depend on facts from approximately 4–9 turns earlier.
Each condition used 96 training rows: 72 shared PIPPA windows and 24 authored scenes. Only the authored replies differed between conditions.
Both adapters otherwise shared the same model revision, training settings, row order, and seed.
The authored examples were created using Claude Sonnet 5.5. That affects how to read the results, because much of the training corpus was model-generated dialogue.
I also built an authoring interface where conversational evidence can be highlighted directly. Rather than merely labeling a sample as requiring memory, the author can identify the exact earlier passage that the response should use.

The marked line is the evidence.
Validating before training
The dataset preflight checker was the most useful tool.
Model training can fail in ways that don’t produce an error message. For example, mlx-lm truncates sequences from the end when they exceed the configured token limit.
That can silently remove part of the assistant reply we’re attempting to supervise.
Worse, it may remove the evidence required to produce that reply.
The preflight checks token counts, evidence distances, truncated targets, truncated evidence, and potential misalignment between the supervised reply and its loss mask.
A successful training run means very little if the examples reaching the model are no longer the examples we intended to train on.
The dataset export process also maintains group-aware training and validation splits, preventing the same character from crossing those boundaries.
These checks aren’t glamorous, but the experiment isn’t trustworthy without them.
Inspecting what changed
After training, I wanted a way to examine the adapters beyond their loss curves.
That led to an adapter inspection tool: a standalone HTML visualization showing effective LoRA update magnitudes across blocks, projections, and checkpoints.
For each supported weight update, the visualization computes a normalized magnitude:
s‖AB‖F√(din dout)
This provides a comparable measure of how large the effective update is across differently sized projections.

Recent in blue, earlier in amber, at the last step. Blocks are numbered from zero, so 28–31 are the final four. Height is the size of the update.
Qwen3.5’s architecture combines Gated DeltaNet and attention components, so the inspection tool also documents the projections being modified.
The visualization doesn’t need to load the base model. It operates directly on adapter weights.
I extended it with an ablation tool that can zero selected LoRA matrices and save a modified adapter for reevaluation.
This makes it possible to investigate whether particular projections contribute to observable behavior. The capability was built and tested, although the published pilot does not include behavioral ablation results.
The heatmap has a limit: a large parameter update isn’t necessarily a useful behavioral update.
Inspecting weights tells us what changed numerically. Evaluation tells us whether those changes accomplished anything.
IV. Training on a 16 GB Mac
All real training and generation took place on a MacBook Air with an Apple M4, an 8-core GPU, and 16 GB of unified memory.
The frozen 4-bit base made the experiment feasible without a dedicated external GPU.
Resource use:
| Measurement | Result |
|---|---|
| Model | Qwen3.5-4B, 4-bit |
| Adapter rank | 8 |
| Adapted blocks | Final 4 |
| Maximum sequence length | 512 tokens |
| Training updates | 100 per adapter |
| Mean update time | 5.6–5.8 seconds |
| Peak memory | Approximately 10.9 GB |
Each adapter required roughly ten minutes of training.
That was encouraging. I could run a complete post-training experiment locally without renting a GPU or relying on external inference infrastructure.
But the hardware limited the experiment.
The only sequence length that fit the training configuration was 512 tokens. Longer configurations of 1,024 and 2,048 tokens had to be left for a more capable machine.
The dataset included longer authored scenes with evidence as far back as approximately 27 turns, or around 1,450 tokens. Those scenes were not used to train the pilot adapters.
The actual earlier-evidence training examples had a median evidence distance of approximately seven turns, or 250 tokens.
Although the experiment was motivated by long-range continuity, the supervised contrast was relatively short-range. Both conditions operated within a context size the base model might already handle comfortably.
The hardware handled the experiment at 512 tokens. It couldn’t test the longer-context training I originally wanted to try.
V. Evaluating Whether It Worked
Training loss tells us whether a model is fitting its supervised examples. It doesn’t establish that the model has improved at the behavior we care about.
For that, Storythread needed a separate evaluation.
The evaluation protocol was inspired by the event-triggered roleplay probes in REMP, but it is a smaller, independently designed experiment. Its results aren’t directly comparable with REMP.
Testing continuity with counterfactuals
Each evaluation scenario contains two versions of the same conversation.
In one version, an earlier fact has one value. In the other, that fact changes.
The final player message remains identical.
A successful character must respond appropriately to whichever earlier fact appears in its history.
This separates real use of conversational evidence from a plausible reply that would have worked regardless of what happened earlier.
To count a scenario as correct, both versions must receive factually appropriate replies.

One case. The evidence is underlined, and the replies are not named.
I maintained separate development and test datasets. Development scenarios could be inspected and revised. The 12 test scenarios were frozen before scoring, not edited after I saw model outputs. They were also drafted with Claude Sonnet 5.5 and reviewed by me. I was the sole rater, and the generations, ratings, and report are in results/pilot/.
The test examples also carried a canary identifier to help prevent accidental reuse in future training data.
All three model conditions were evaluated using greedy decoding, with thinking disabled and a maximum of 160 generated tokens.
Disabling thinking mattered. An initial rating pass surfaced reasoning traces instead of the intended character replies, which would have distorted the evaluation.
Continuity results
The primary metric was the number of scenarios for which both counterfactual versions were answered correctly.
| Model | Both correct | Individual replies |
|---|---|---|
| Untuned base | 9/12 (75%) | 19/24 (79%) |
| Recent adapter | 9/12 (75%) | 20/24 (83%) |
| Earlier adapter | 9/12 (75%) | 21/24 (88%) |

The dark bars are the paired score. They do not move.
The main result is a tie.
Both adapters correctly answered slightly more individual replies, but neither improved the paired continuity score.
Broken down by evidence distance:
| Model | ≤4 turns | 5–12 turns | >12 turns |
|---|---|---|---|
| Base | 4/4 | 2/4 | 3/4 |
| Recent | 4/4 | 3/4 | 2/4 |
| Earlier | 4/4 | 2/4 | 3/4 |
Every model correctly handled all four short-distance scenarios.
The later buckets vary, but with four scenarios per bucket, each scenario moves the percentages a lot.
The data can’t show that either adapter improves long-distance continuity.
Did the characters become more engaging?
Continuity isn’t the only desirable property of a roleplay character.
A character might correctly reference an earlier event while producing dialogue that’s repetitive, unnatural, or simply less enjoyable.
I therefore included a second evaluation: blinded pairwise comparisons asking which response a human reader would rather continue chatting with.
One rater evaluated 24 comparisons per model pair.
| Comparison | First wins | Second wins | Ties |
|---|---|---|---|
| Base vs. Earlier | 18 | 2 | 4 |
| Base vs. Recent | 14 | 9 | 1 |
| Recent vs. Earlier | 7 | 14 | 3 |

Violet is the untuned model. Each bar is 24 comparisons.
Here the untuned model performed considerably better, especially against the earlier-evidence adapter.
One possible explanation is the training data. Approximately 75% of each arm consisted of PIPPA windows containing Character.AI-generated character replies, while the remaining 25% consisted of synthetic scenes authored with Claude.
Fine-tuning on this mixture may have altered the model’s conversational style in undesirable ways.
But this is a hypothesis, not an established cause.
The pilot used only 12 scenarios, one human rater, and a relatively small training contrast. It cannot separate the effects of data quality, data quantity, adapter capacity, or training duration.
What it demonstrates is narrower: under these conditions, the adapters did not improve paired continuity, and the rater generally preferred the untuned model’s responses.
VI. What I Learned, and What Comes Next
I began Storythread wanting to understand whether a small adapter could teach a model to better use earlier conversational evidence.
The experiment didn’t establish that it could.
But it also didn’t establish that QLoRA was incapable of learning the behavior. The adapters saw only 24 task-specific scenes apiece, received approximately one pass over the training rows, and operated under a restrictive sequence-length budget.
The base model was already reasonably competent at the supplied task.
A stronger follow-up would use longer training contexts, more task-specific examples, and an evaluation containing enough difficult scenarios to distinguish meaningful improvements from noise. Multiple raters would also provide a more reliable picture of conversational quality.
I would also investigate the data mixture more carefully and use the adapter ablation tooling to connect parameter changes with measured behavior.
A separate direction would compare fine-tuning against retrieval-based approaches, where earlier conversational events can be stored and reintroduced explicitly. That would address a related but different question.
For now, the most useful outcome may be the infrastructure itself.
Storythread provides a complete local workflow for curating data, authoring controlled examples, checking training inputs, training quantized adapters, inspecting their updates, and evaluating the resulting behavior.
The project taught me that changing a model is not the same as improving it.
Training can complete, loss can decrease, and adapter weights can change without producing the behavior we intended. Even when a model gets more answers correct, that improvement may come at the expense of qualities people value in its responses.
Telling them apart takes careful data and evaluations designed to challenge your assumptions.
Sometimes the original model still performs better after all that work, and that is a useful result.
The training tutorial, source code, evaluation workflow, and inspection tools are in the Qwen Storythread repository. The curated PIPPA subset is the Hugging Face dataset. That subset is downloaded during setup and is not stored in Git.