Engram adapter
Learn conditional n-gram memory over a frozen Qwen model.
SFT → Engram adapter uses the existing supervised Engram operation. It is not a LoRA option inside the ordinary SFT recipe. Select the exact base or saved parent module; manual continuation starts a fresh optimizer and does not enable a standard recurring policy.
Engram adds learned token-history memory inside a frozen language model. It can
specialize recurring terminology without replacing the base checkpoint. The
current OpenPond implementation is openpond_qwen_engram_paper_v1 on the pinned
dense BF16 Qwen3-8B only. A selectable draft does not establish runtime or
serving qualification. The bounded training check below establishes execution and
retained learned state; it does not qualify live serving or answer quality.
Where the memory enters the model
At layers 1, 3, 7 and 15, the adapter changes the input to self-attention; the attention, MLP and output-head weights stay frozen. The expanded view is one such hook. The twelve shared tables serve all four layers, while each layer has its own projection and gates.
Each table has 90,007 buckets and width 256; the residual scale is 0.2. Tables, projections and gates total 326,861,824 learned FP32 parameters, so plan memory and artifact limits accordingly. A group contributes only when its history is complete and all four occupancy flags are present. Occupancy is recorded during training. Off returns the original attention input. Tokenization, positions and KV history belong to one request; reusing another request's history is invalid. This implementation has no DeepSeek-style compression map or convolution and makes no DeepSeek throughput claim.
The memory computation
For token position t, each history group g is hashed into four tables.
The occupancy mask requires a complete history pattern and a previously seen
bucket in every head:
E contains the learned memory vectors; O contains saved occupancy flags,
recorded before lookups during training. With three groups, four heads and
256 values per head, c_t has 3,072 values. At injection layer l, the
projection and contextual gate produce a residual:
Here sigma is the sigmoid and the elementwise product conditions the gate on
both memory and the current hidden state. Zero-initialized projections make the
initial residual zero. Supervised training changes the memory, projections and
gates while keeping the base parameters fixed:
The occupancy flags are retained state, not gradient-trained parameters. This is a conditional residual, not a constant low-rank weight matrix that can be merged into the base. The equations describe the mechanism; they do not imply held-out quality or qualified serving.
Measured four-step check
A short GSM8K check completed four optimizer steps on four reviewed examples and 68 target tokens, with a learning rate of 0.001 and a 1,024-token sequence limit. The trainer reported 84.206 seconds; cold download/startup took additional time. The learned module changed while the frozen base hashes stayed identical.

Mean training loss was 2.502762 and final loss was 1.285656. These are training summaries, not a baseline/candidate quality comparison. The producer reloaded the written learned state into a fresh CPU adapter and verified its state before publication. One saved Model version then reopened through the API and Web. The settled training debit was $0.883725 and the original GPU was deleted.
Independent GPU inference, held-out answer quality and memory On/Off serving remain unqualified. The product-terminology workflow below is illustrative.
Worked example: product terminology
Create a reviewed supervised Dataset with separate training and held-out tasks. One illustrative task is:
{
"input": { "question": "What is a Luma Dock used for?" },
"expectedOutput": { "text": "A Luma Dock charges Luma inspection sensors." }
}These are task fields, not a complete Dataset import. Approve one matching assistant demonstration containing the exact JSON answer, then seal the batch. Dataset instructions supply system context; the task input supplies the user payload. Grader scores and unreviewed answers cannot replace demonstrations.
- Open New Model, choose SFT and the Engram adapter, then Save.
- In Model, select the exact compatible base or supported saved Engram parent. In Dataset, select or create the Dataset and prepare its sealed supervised batch. Review attached checks in Graders.
- In Run settings, set steps, sequence bound and optional spending limit. Architecture is runtime-owned, not an arbitrary table editor.
- Save configuration retains the draft. Choose Train, inspect the preparation and explicitly approve Start to allocate training compute.
Reuse the saved draft through the SDK
Use an authenticated training client and a typed compileInput containing the
saved draft's exact teamId, projectId, method: "engram_adapter", base-model
query and form. Persist prepareOperationId before dispatch. This compiles
and prepares the inputs for review; it does not start training.
import { canonicalComputeSpendCap } from "openpond-sdk/training";
const { form, ...scope } = compileInput;
const compiled = await client.compileEngramExecution(compileInput);
const { execution } = await client.prepareEngramExecution({
...scope,
operationId: prepareOperationId,
name: form.name.trim(),
sourceForm: form,
request: compiled.request,
maximumSpendUsd: canonicalComputeSpendCap(form.maximumSpendUsd),
});Inspect the preparation's exact inputs, price, spending limit and expiry before
approving Start. A start command must retain this execution ID, revision,
plan hash and approved price/spend; use the typed SDK or
openpond training hosted-start-engram --help for that contract. Preparation
alone supplies no approval. Reuse the original operation and request after a
lost response, and follow cancellation through verified cleanup.
Read the same execution through the official CLI with your configured account
and workspace; EXECUTION_ID is execution.id:
openpond training hosted-engram-execution "$EXECUTION_ID" --team-id "$TEAM_ID" --jsonInspect the output and use the Model
The execution read returns result only after genuine completion and artifact
custody. Inspect these actual fields, rather than treating the target answer
above as a measured output:
| Field | What to establish |
|---|---|
optimizerSteps, meanLoss, finalLoss | Actual finite supervised optimization. |
baseWeightsHashBefore, baseWeightsHashAfter | The frozen base is unchanged. |
baseOptimizerParameterCount, baseGradientParameterCount | Both are zero. |
artifact.manifest, artifact.files | Exact learned tables/projections/gates, occupancy and two-file custody. |
The execution's result is absent until completion. Read its actual artifact
and unchanged-base evidence; the product answer above is an illustrative target,
not an execution result.
After completion, choose Save Model; the CLI equivalent is
hosted-save-engram-model with an EngramResultSaveRequest. Activate compatible
serving separately, then compare the same held-out request with memory On and
Off. “A Luma Dock charges Luma inspection sensors” is an illustrative desired
answer, not a recorded response. Also test unseen product combinations and
unrelated text. Exact compatible parent continuation starts fresh optimizer
state; arbitrary LoRA/steering/Engram composition and interrupted optimizer
resume are not implied. Stop serving and inspect released capacity when done.
Sources and implementation boundary
- When to Adapt: Conditional Memory Adapters for Retention-Preserving Domain Specialization: the post-hoc adapter equations followed by this independent Qwen port; the paper's results are not OpenPond qualification.
- DeepSeek's official Engram repository and paper: the original conditional-memory architecture and demo. It is architectural background, not the OpenPond runtime or a promise to reproduce its models.
Compatibility
A bounded native training check passes on the pinned Qwen base. Serving requires independent runtime and billing qualification.