STORY · VERKTOY_

WebGPU-based syntax highlighting with machine learning

Shu Ding at Vercel Labs has developed gpu-lexer, a 27.5KB syntax highlighter that uses a small machine learning model to classify code tokens language-agnostically. The model was trained on 4.7 million tokens and achieves 87.43% agreement with the Shiki highlighter on held-out test data, while running 60× faster than Shiki when loading large code files.

WHY IT MATTERS

The tool demonstrates how neural models can replace rule-based systems for code-specific syntax highlighting, and showcases a practical AI solution where a compact model performs competitively while crossing language boundaries.

SOURCES

MACHINE-GENERATED SUMMARY This summary is written by machine from the sources below. We sort and explain — but we are a way into the field, not the final word. Check the source when something matters to you.