Marksage: a Markdown editor whose in-browser 385 KB models suggest fixes without sending text anywhere
- Key gotcha
- Only 42% of the code tagged TypeScript in training had any TypeScript-only syntax, so the label problem, not the model, limited the near-twin languages.
What they built
Marksage is a local-first Markdown editor with no backend, no accounts and no analytics, so documents stay in the browser. Its Smart Assist suggests fixes as you write, such as a language for an untagged code block, a list item for -item, or a table for a pasted CSV.
The AI in it never writes text. Each model picks one answer from a fixed list, from a 385 KB file, in about 0.1 ms of plain JavaScript inside the browser, with no ML runtime, GPU or worker.
Pablo first planned to use Laya, an open-weight decision model, but its smallest checkpoint has 322 million parameters; his code-language model has 262,333 numbers in all.
Setup
- Browser-only editor, no backend
- fastText-style models trained in plain TypeScript in the repository (8 epochs in about 15 seconds), stored as 8-bit integers
- Training data: about 270,000 fenced code blocks collected from 309 public repositories, 63,751 used for training
How it works
- Every question goes through heuristic rules first, then a small model trained for that question only where rules leave too much unanswered.
- A snippet becomes a set of clues (tokens, token pairs, line starts and ends, indentation, three-letter pieces), each hashed into one of 32,768 slots holding 8 learned numbers; one linear layer scores 20 languages plus 'not code'.
- Rules and models share one confidence gate: a suggestion shows only if the top answer is at least 80% and at least 20 points ahead of the second.
- Data is split by repository, never by block, and the temperature is fitted on repositories the model never trained on so 95% of shown suggestions are right.
Results & numbers
- Calibration cut dev-set suggestions from 210 to 157 of 280 but raised precision from 87.6% to 94.9%.
- The opt-in Rules + AI mode gave 1.7 to 2.2 times the right suggestions of the rules alone at about the rules' precision across three held-out sets.
- Three trained models did not ship: a structure-hints model that beat the rules by one line in 227, a paste-type model less precise than the rules, and a v3 code model that was better overall but worse on TypeScript vs JavaScript.
Gotchas
- Only 42% of the code tagged TypeScript in training had any TypeScript-only syntax, so the label problem, not the model, limited the near-twin languages.
- Version 2 could not be reproduced exactly from its recorded sources, so the shipped file became the fixed baseline and new models carry a fingerprint of their data.
- The section model reads Portuguese poorly, one-liners get overconfident answers, and no test yet runs Rules + AI in a browser.
“A missing suggestion costs nothing. A wrong one costs trust.”— Pablo Felipe
Do it yourself
- List the possible answers up front; if you cannot, it is not a job for this kind of model.
- Write heuristic rules first and measure where they stay quiet.
- Collect free labels (such as the language tags authors type after code fences) and split train, dev and test by repository.
- Train a small hashed model, calibrate its temperature on held-out repositories, and gate suggestions on confidence and margin.
- Write the bar down before the held-out run and ship only if the model clearly beats the rules at about the same precision.
export function passesGate(probs: number[], threshold = 0.8, minMargin = 0.2): boolean {
const sorted = [...probs].sort((a, b) => b - a)
const top = sorted[0] ?? 0
const second = sorted[1] ?? 0
return top >= threshold && top - second >= minMargin
}Similar setups
BubbleFacts: source-checked song facts on stream from a local 3B model
An open-source desktop app for streaming musicians and DJs shows short facts about the song being played as OBS bubbles, written by Llama 3.2 3B on the streamer's own computer and screened against Wikipedia before anything is shown.
Keeping a WordPress AI assistant usable on small local context windows
The maintainer of the AI Assistant WordPress plugin, which talks to LM Studio or Ollama on localhost from the browser, shares the tricks he built to make local models cope with small context windows.
A local eve agent on a 4B model that keeps its pending approval through kill -9
@VarunChopr17597 ran Vercel's open-source eve 1.1 agent framework against Qwen3.5-4B on llama.cpp on a CPU-only Linux box, with no Vercel account, and tested whether a tool waiting for human approval survives the server being killed.
Private blog-post descriptions and tags from a local Gemma model in Node.js
Flavio Copes built a dependency-free Node.js script that asks a local Ollama model to suggest a meta description and tag for his blog drafts, validates every answer, and falls back to a no-AI suggestion when the model fails.