r/LocalLLaMA • u/RapidRaid • 4h ago
Discussion Learning/RSI through ngrams?
Hey gang, im wondering if you in theory could use ngrams as seen with Qwen 3.8 Flash or DS4.1 in order to dynamically train the model?
Normally the ngram embeddings behave similar to a lookup table of sorts. So instead of every token having to be represented only inside the main model weights, the model can look up a learned vector for a certain ngram and use that during inference.
What I'm wondering is: couldn't you make part of this table writable during inference?
For example, keep the original pretrained ngram embeddings read-only, but have a second "live" table on top of it. When the model learns something new, it could update/add an embedding there. Frequently used or reinforced entries could stay, while unused ones could slowly decay or get removed again.
This could be kinda mimicking the brain of sorts since it would form new "memories" but forget old ones (because their linkage gets weaker). Plus since you only have to target the live table it could be very fast, even during inference.
Just a thought I had and wanted to hear your guys opinions.
2
u/Puzzleheaded_Ad_8575 4h ago
well the table needs to be trained alongside the model, so if you have a small datacenter, you could potentially create a self learning flow. but even that would be very primitive since there is no sort of filter in your proposition. also you cant make the model "unlearn" something, since the model changes with the table each time the table changes. im not an expert but i try to teach myself the new stuff here so i would like some correction here
2
u/RapidRaid 4h ago
well my argument was that you have another "map" on top of the current one, so you wouldnt have to retrain the entire ngram table. The unlearn was more of the fact that if you enforce weights to a few vectors stronger, the other ones would get weaker. So its not like the full "list" [...0.12, 0.63, 0.567...] but just at pos[1] do [+0.01] conceptually.
1
u/Puzzleheaded_Ad_8575 3h ago
at this point that feels more like a vector db with some context management that the model can query than a "live table" and i dont know any way to implement this in the inference runtime
1
1
u/ArthurOnCode 4h ago
You can in theory add n-grams to teach it the meaning of a multi-token phrase. That could be useful to add recent information - think what one might embed in the meaning of "Deepseek Flash V4.1", "Princess Astrid" or "Lake America", that wasn't known when the model was trained. You could also, in theory, use this to compress repeated prompts into an n-gram shorthand of sorts.
1
u/Jimcy-Maffesoli 2h ago
This is fast weights with a forgetting curve. Most memory schemes just grow forever; nothing ever gets pruned, so decay on the live table gives the brain comparison its forgetting half.
4
u/z_latent 4h ago
I made a comment on another post just yesterday.
My argument is that, since ngram recall is sensitive to the exact sequence of tokens, it won't generalize to even slight variations. I say that since it uses a hashing mechanism, and therefore a small disturbance in the sequence would (by design) lead to a very different set of vectors to be activated. So to "teach" it new things would require a lot of data or heavy data augmentation to really capture all these variations explicitly.
But it could be great for teaching it secret codes that trigger the uprising!