Live data from Hacker News

Show HN: Predictive text using only 13kb of JavaScript. no LLM

adamgrant.info

1–10 of 42 posts

Re: Show HN: Predictive text using only 13kb of JavaScript. no LLM

#8
post #7

Earlier quoted context omitted.

I don't think so. It's basically just traversing nested arrays and picking a random member on each level.

Yep. Sounds like a Markov chain to me.

Markov process is a stochastic model describing a sequence of possible events in which the probability of each event depends only on the state attained in the previous event.

Re: Show HN: Predictive text using only 13kb of JavaScript. no LLM

#9
Pretty cool, a js implementation of n-grams!

What is amazing to me is this: imagine that English only had 10,000 words. For each of those 10,000 words there’s 100 valid subsequent words. So there’s 1 million valid bigrams. Now if you want trigrams that takes you to 100 million, and for 4-grams it’ll be 10 billion. Just for that, you’d need 14 bytes per word and gigabytes of storage.

LLMs typically have context windows in the hundreds if not thousands. (Back in my day GPT2 had a context window of 1024 and we called that an LLM. And we liked it.) So it’s kind of amazing that a model that can fit on a flash drive can make reasonable next token prediction on the whole internet and with a context size that can fit a whole book.

Post reply on HN