Show HN: A linear model is an embedding table: using VW as transformer memory li...

@show

Show HN: A linear model is an embedding table: using VW as transformer memory liminalplanes.com · 2 points · 0 comments · HN thread

TL;DR The author trains a frozen lookup table with Vowpal Wabbit to act as external memory for a small 4-layer transformer, inspired by DeepSeek's Engram module. On WikiText-103 the student with memory reaches 4.82 nats cross-entropy versus 5.16 without, about 29% lower perplexity at under 0.1% extra compute per step. The post is a small-scale experiment and the code is available only on request.

  • DeepSeek's Engram (early 2026) adds a large hashed n-gram lookup table to a transformer, with a learned gate deciding how much to use the retrieved memory vector.
  • VW with cost-sensitive one-against-all classification (--csoaa d) yields d linear outputs per hashed feature, so its weights can be read directly as an EmbeddingBag-style table in PyTorch.
  • Targets are PCA-compressed (d = 64) layer-4 hidden states of Qwen2.5-0.5B, recorded per token, and VW is trained on them for two passes on CPU.
  • The frozen VW table is added after layer 1 of a 4-layer student distilled from the same teacher; the student only learns how to read the memory.
  • Training used 4,600 steps of 8 x 512 tokens on cleaned WikiText-103 (about 20M tokens); the memory student reached 4.82 nats vs 5.16 without, evaluated on a 1M-token holdout.
  • The author suggests VW's online learning could let the table be updated cheaply and separately from the model weights, for example for per-customer or domain memory, but this is untested.

Discussion No comments have been posted yet, so there is no discussion to summarize.

#linearModels #embeddingTables #vowpalWabbit #transformerMemory #llmTraining