shaduocn sidebar: shaduocn.vercel.app
37
27
905
51,313
Optimized gpu-lexer.vercel.app to be 3.8x faster: 850ms → 221ms. It's still far behind @pierrecomputer's diffs.com/highlights (incredible work!)

Also wrote down some thoughts on shud.in/thoughts/ideas…
9
14
225
12,167
Cheng Lou has 1,000 ways to build fluid gallery layouts.
My dear friends, I’d like to show you my latest toy project

Introducing Handwired: turn your regular JavaScript code into a neural net!
- no training
- exact outputs vs the JS program
- fully differentiable

All runnable in a browser, without GPU
2
3
244
17,296
Next version of Satori:

grid/block/inline/inline-block, fixed/sticky, float/clear, list-style, counter, word-spacing, overflow, aspect-ratio, order, visibility, outline, mix-blend-mode, isolation, paint-order, z-index, 3D transform, conic gradient, calc(), min/max/clamp()
18
37
770
27,403
Replying to @shuding
(every frame of this video is rendered with Satori too)
3
0
22
3,398
Replying to @shuding
((and every frame is rendered as a SVG which means this is a vector video, remember SWF?))
0
1
13
1,543
Shu retweeted
We migrated mercedesamgf1.com with as little intervention as possible, setting out to prove just how much faster @vercel is. ~70% faster builds and ~75% faster paints.

We derived two AI skills from the migration that we'll be sharing back. It was a mature workload with a lot of "$formerProvider-isms", and yet the net of the work was done in under a week.

If it's [built / rendered / shipped] fast, it's on Vercel.
If it's fast, it's on Vercel.

We just made @MercedesAMGF1 even faster.

Live at mercedesamgf1.com
66
19
609
136,391
HTML/CSS is Turing complete, so why not compile programs to plain HTML/CSS and runs with zero bytes of JavaScript?

zero-js.vercel.app
39
81
1,399
108,767
Replying to @shuding
(How to center a DIV without JS)
1
2
34
5,386
Replying to @shuding
This continues my school project from 11 years ago, just for fun: github.com/shuding/css-co…. It's like shader code on an analog computer: no persistent state, just circuits of CSS math that react live to their inputs.

Scroll-position hacks can persist state, but it's still rough.
1
2
52
8,451
I put some of my random notes into a blog post:

shud.in/thoughts/metap…
5
7
141
12,251
After one week, there are 5 more small models for specific tasks on the web:

1. gpu-time: natural language to JS date and time by @imarikchakma
2. gpu-query: natural language to structured filters by @cheatyyyy
3. neural-flexbox: model to centre a div (!) by @aaronvanston
4. gpu-cron: natural language to cron expressions by @ManuSchiller
5. tinysarf: arabic morphological analyzers by @Ahmedabdou1996
I trained a small model to do syntax highlighting in the browser with GPU.

Meet gpu-lexer from Vercel Labs: Small (27.5KB), fast (runs on WebGPU), and language-agnostic (model guesses the syntax).

gpu-lexer.vercel.app

It is experimental and built for learning!
24
34
690
53,220
Replying to @shuding
Tiny models in the browser running on WebGPU are fun!
Infer cron expressions from english language: gpu-cron.vercel.app

35k Parameters, trained with MLX, shipped as packed 6-bit weights + specialized WGSL: 31kb brotli

thanks for the idea! @shuding @imarikchakma
2
0
4
2,083
Replying to @shuding
Astra and I built Tinysarf: tiny, in-browser arabic morphological analyzers.

It can segment arabic MSA words, extract roots, and other morph features

~245KB int8 weights. Runs in your browser on CPU ir WebGPU. Experimental & opensource.

tinysarf-lab.ahmedabdouuu.chatgpt.site/mn
0
0
7
2,067
Excellent use case, excited to see more gpu-* libs!
Introducing gpu-time ⏰

I built a small browser-based model to convert from natural language text to JavaScript date and time.

It runs on web GPU. It's fast and can extract date and times from any English text.

gpu-time.arikko.dev
2
8
530
59,083
Got a lot of attention for this (thank you!), but also there're some criticisms and questions:

1) it's a stupid idea

Maybe. Again, this is experimental and not meant to be used in production or as a replacement for anything. It is to explore new possibilities.

2) it's es wrong

Existing solutions are not always more correct just because they're "algorithmic". For example pic 1 is Highlight.js and 2 is gpu-lexer, lang is JS not something rare. There are counterexamples too.

Furthermore, language-agnostic is the real reason for exploring this approach. During training, the neural network learned patterns like "[keyword] variable = value" that are not tied to any specific programming language such as:

var ... = ...
let ... = ...
const ... = ...
using ... = ...
val ... = ...
auto ... = ...
type ... = ...
def ... = ...

And that knowledge can be shared without re-implementing a grammar rule repeatedly.

Another advantage is that this approach can potentially generalize to new programming languages or dialects without requiring extensive manual rule creation. If you go to prismjs.com/test, you can't find popular Web framework languages like Vue, Svelte, Astro, and many others. Not to mention that new languages and dialects are constantly emerging, making it impractical to maintain comprehensive grammar rules for all of them.

When that's a concern, you either use more comprehensive solutions like Shiki with a cost (carefully bundle, detect and load language definitions on demand, larger size), or use an easier approach for all kinds of source code with another cost (less accurate).

That is definitely a good reason to explore this direction.
I trained a small model to do syntax highlighting in the browser with GPU.

Meet gpu-lexer from Vercel Labs: Small (27.5KB), fast (runs on WebGPU), and language-agnostic (model guesses the syntax).

gpu-lexer.vercel.app

It is experimental and built for learning!
23
6
273
29,734
Replying to @shuding
Another thought: if you see each part (a word, symbol, number, space) of the source code as a pixel, syntax highlighting is essentially image segmentation for a 1D image. And it's a well-solved problem by models.
2
1
42
3,441