Live data from Hacker News

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

adamgrant.info

11–20 of 42 posts

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

#11
post #8
post #7

Earlier quoted context omitted.

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.

That's a markov chain of the 1st order.

This is higher order Markov chain

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

#14
This is cool. I don't want a 1GB+ download and an entire LLM running on my machine (or worse, on someone else machine) to find words.

What I really want is some simple predictive text engine to make writing in English easier (because its not my first language), helping me find more complex words that I don't use because I don't know them well enough.

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

#15
Another day, another story on HN that will have me down a rabbit hole (yesterday's was a three-hour tangent into ternary bit compression after the Microsoft paper) :D

Your project is delightful -- thank you for sharing. I have explored this realm a bit before [0] [1], but in Python. The tool I made was for personal use, but streaming every keystroke through a network connection added a lot of unnecessary latency.

I used word surprisals (entropy) to calculate the most likely candidates, and gave a boost to words from my own writing (thus, the predictive engine was "fine-tuned" on my writing). The result is a dictionary of words with their probabilities of use. This can be applied to bigrams, too. Your project has me thinking: how could that be pruned, massively, to create the smallest possible structure. Your engine feels like the answer.

My use case is technical writing: you know what you want to say, including long words you have to repeat over again, but you want a quicker way of typing.

[0]: https://jamesg.blog/2023/12/15/auto-write/

[1]: https://github.com/capjamesg/autowrite

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

#20
post #14

This is cool. I don't want a 1GB+ download and an entire LLM running on my machine (or worse, on someone else machine) to find words. What I really want is some simple predictive text engine to make writing in English easier (because its not my first language), helping me find more complex words that I don't use because I don't know them well enough.

I've developed a neural network model for text correction, prediction, and autocompletion, specifically optimized for one of my iOS keyboard apps. The model is compact, at only 32MB, allowing for swift loading times. It predicts the next word based on the last four to five words, demonstrating robustness against errors, typos, and making minor grammar corrections.

The goal was to mimic the functionality of the stock iOS keyboard. This approach also opens up the possibility of training (or fine-tuning) the model with specialized vocabularies for various professional fields, such as law, medicine, and engineering, to predict, correct, and autocomplete domain-specific terms. I'm exploring whether this addresses a genuine need or is a solution in search of a problem.

Additionally, I'm considering integrating a comprehensive grammar correction feature directly into the keyboard. While there are existing apps with this capability, they rely on online APIs. My aim is to offer a self-contained, local model as an alternative.

Post reply on HN