Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- nice, a tiny webgpu model instead of a grammar is such a clean idea. how does it hold up on languages with reallyby quietraster
- I don't think it's meant as something that's useful per se because highlighting 5m lines of code at once is unusual, and doing it in a non-deterministic way probably isn't especially helpful, but to show what a browser is capable of it's awesome.by onion2k
- > highlighting 5m lines of code at once is unusual
Speak for yourself, I often accidentally open 50MB JSON files, crashing my text editor as it tries to figure out the syntax highlighting :)
by michaelt - The use case isn't highlighting a huge amount of code, but local re-entrant highlighting.
You generally never need to highlight a whole file, only the part you're looking at. Which by definition must be fuzzy since you don't have the full source, the part you see will not parse as a complete program so you need to guess. This is actually one of the nastier parts of writing a highlighter, and it must be done for every language.
The lesson is that if you're going to be fuzzy you might as well be learned too and the results are pretty good.
This is more useful than it appears at first glance. It would be just as useful running on the CPU, which I'm sure it can.
by avaer - This prompted me to make a JavaScript syntax highlighter in WebAssembly that’s 99.9% in agreement with Shiki in 12.7 kb: https://qip.dev/syntax-highlight-comparisonby burntcaramel
- The bootstrap.css example shows a lot of very random highlighting around numbers (some are blue, others black) and rule names (some are purple, others black).
While the premise is neat (syntaxes and tokenizers are pretty similar, how much diversity can humans possibly come up with??), this does not inspire much confidence in the accuracy.
by Zopieux - Seems don't work on firefox mobile on Androidby drakmail
- Firefox Android doesn't support WebGPU yetby hmry
- This is a tiny LLM doing all the heavy-lifting. Any mention of the training process? I am obsessed with tiny LLMs and the do-one-thing-really-well approach that they seem to fit very well.by brainless
- A genuinely impressive and novel use of machine learning? In this economy?
Looks really impressive, although one issue I do see is consistency. For example, it seems to highlight `null` as a value, unless it is on the left side of an `===` expression, since it probably hasn't seen that in training.
Was it ever actually tested on languages not in the training set? Would be interesting to see if a model this small can actually generalize...
by undefeated - How would it generalize? Let's say I use C, in which `class` is not a keyword, how would a model generalize such that it recognizes this?by lionkor
- On linux (tried FF and chromium), the live demo renders all the text as black (no highlighting). On iOS (my phone), this works great. No errors in the console (maybe it fails silently?)
Is this a linux issue / support issue?
- Check navigator.gpu in the console on the Linux machine. If it is undefined, that is your answer, and it explains the silence: the page has no API to fail against, so nothing throws.
WebGPU on Linux is still the exception, not the rule. Firefox ships it enabled by default in Nightly only, not Stable or Beta, with Linux expected during 2026. Chrome enables it by default on Linux only for Intel Gen12+ (from 144) and NVIDIA with driver 535.183.01+ on Wayland (from 147); everything else is behind flags, roughly --enable-unsafe-webgpu --ozone-platform=x11 --use-angle=vulkan --enable-features=Vulkan,VulkanFromANGLE. Distro Chromium builds also differ from Google Chrome here more often than people expect.
Which matches what you saw exactly: works on iOS, black text on both Linux browsers, clean console. Worth the demo printing a one-line "WebGPU unavailable" instead of rendering black on black, because right now a missing API and a broken shader look identical from the outside.
- I think, both FF and chromium on Linux disable WebGPU by default. Of course, it depends on where exactly did you get it (what kind of default settings people that packaged it for your distro used).
Just look up "<browser name> enable webgpu" in you favorite search system or ask an LLM chatbot "How to enable WebGPU in <browser name>?", follow the instructions and it should work just fine.
by vova_hn2 - If anyone can get in contact with Shu, please let them know I'd really like to speak with them. I have a deterministic rendering / colorizing system in three dimensions instead of two for arbitrary UTF8 text written that is explicitly GPU bound and currently testing the last Rust + Mojo pair port, and I'd like to share some ideas. I have about 95 million glyphs rendering (monospace, atm) in a little under a second with full multi dimensional pagination and colorizing per-glyph with full addressing capabilities. There's something to be combined with these two mechanisms I'd like to try and explore.by tikimcfee
- g@shud.in was listed as contact email on his older portfolioby tough
- 27 KB is extraordinarily impressive. Here's a deterministic suite of common language- and format-specific PHP files an LLM wrote for me in 32 KB, for comparison:
https://repo.autonoma.ca/repo/treetrek/tree/HEAD/render/rule...
by thangalin - I think what's most interesting is not that this works well for common languages, but it seems to be useful for languages that don't exist yet. If you want _some_ highlighting for your SQL variant, or your language that borrows many common idioms, or just sloppy code that's close enough to the target language, this could be useful.by netghost
- It seems to me that syntax highlighting that isn't very close to 100% accurate is anti-useful.by cwillu
- Years ago, long before the current "AI"/LLM-craze, I've heard someone saying that in the future programming will have less fixed, deterministic algorithms and more statistical/ML algorithms, because even in the case when writing a deterministic algorithm is possible, it is sometimes easier to collect training data and train a tiny model, then to write and maintain large codebase that does the same thing, but deterministically.
I wonder, if mass adoption of LLM code-generation will accelerate this process or not. On the one hand, it is now easier to "write" (LLM-generate) code then ever, so time/effort savings are not there anymore (probably, I'm not sure). On the other hand, now everyone uses LLMs so, I think, people are less deterred by non-determinism and statistical nature of ML models.
Let's imagine that you are making a CLI tool. What does a CLI tool do? Well, it accepts reads arguments, reads stdin, writes stdout and make syscalls. So, all possible inputs and outputs are very well defined. What if in the future it will be easier (and maybe even more natural) to ask an LLM to "imagine" tons of possible inputs and correct outputs for a tool that you are making and then train a tiny model, without writing or generating any code?
by vova_hn2 - yes, it's easier to build something that doesn't work. More news at 11.by vrighter
- > What if in the future it will be easier (and maybe even more natural) to ask an LLM to "imagine" tons of possible inputs and correct outputs for a tool that you are making and then train a tiny model, without writing or generating any code?
This seems to assume you're okay with whatever you're building being a black box that will break in the future and require you to re-train the model for every scenario that comes up. I can't think of a problem I've solved recently where that would pass the bar for me. Maybe for one-off problems like 'I have all this data and I want to classify it' where you could hand-classify say 5-10% of your dataset and train a model to deal with the rest of it?
by kg - "the future programming will have less fixed, deterministic algorithms and more statistical/ML algorithms"
I think the direction this will be going depends in part on how hardware prices will develop. If we continue with "hardware is cheap, don't think about it" like we did in the past decades I can see this happen. On the other hand, if we continue down the path we've recently taken, people who know when to choose which approach to their advantage will have a good and prosperous life.
by weinzierl