Lucid
On-device computer vision for calmer feeds.
An open-source Chrome extension that blurs explicit, suggestive and graphic posts on Instagram and TikTok using a fine-tuned vision transformer running entirely in the browser. No servers, no tracking, no images leaving the machine.
- Engineering + ML
- 2026
- In progress

Overview
Lucid is a Manifest V3 extension built as an end-to-end machine-learning systems project: data collection and labelling tools, a Colab fine-tuning notebook, a 4-class image model published on Hugging Face, and a documented architecture for in-browser inference. Two signals feed one decision: a user-curated blocklist matched against the post caption, and the image classifier run locally through ONNX Runtime Web. The extension source is public on GitHub; the trained model and its model card are public on Hugging Face. Much of the recent work has been on accuracy, using an evaluation set built from real feed mistakes and hard examples mined from the feed itself.
Problem
Feed interfaces give you almost no control over what reaches your eye. Doing something about it means classifying content faster than you can scroll past it, and doing that in the cloud would mean uploading every thumbnail a person looks at, which trades one problem for a worse one.
Approach
Run the model locally and pair it with a signal that costs nothing. A blocklist match against the caption resolves in about a millisecond; the image classifier takes around 700 milliseconds. To hide that latency, Smart mode blurs a post the moment it appears and reveals it only once the model calls it clean, so nothing flashes on screen while inference catches up.
Architecture
A per-tab content script picks a platform strategy, observes the DOM, and extracts caption and thumbnail. Both signals meet in a decision combiner. Inference runs in an offscreen document rather than the content script, so a 700 ms forward pass never blocks scrolling. The service worker routes messages; the ~22 MB model is fetched once from a public Hugging Face repo and cached with the Cache API, backed by an L1/L2 verdict cache. Offline, a Python toolkit scores the model on a fixed evaluation set and mines likely mistakes from captured feed thumbnails for relabelling.
Key interactions
- Two-stage decision: blocklist ~1 ms, classifier ~700 ms
- Optimistic pre-blur hides inference latency without flashing content
- Inference in an offscreen document, off the scrolling path
- 4-class ViT-Tiny fine-tune: val macro F1 0.83, gore F1 0.93
- ~22 MB model lazy-loaded from Hugging Face, keeping the extension ~11 MB
- Evaluation set and hard-example mining built from real feed mistakes
- PlatformStrategy interface: a new platform is one file
Technical decisions
The sticky-blur invariant
Once the blocklist fires, the classifier may relabel or strengthen the blur but never remove it. Without that rule, a caption match would blur instantly and a disagreeing model would unblur 700 ms later, showing the user exactly the thing they asked not to see.
Ship the runtime, fetch the model
Bundling a 22 MB classifier into the extension package would make every install pay for it up front. Hosting it on Hugging Face with a model card and caching after first use keeps the download at ~11 MB and makes model upgrades independent of extension releases.
Offscreen document over a worker
MV3 service workers are terminated aggressively, which is fatal for a warm ~22 MB session. An offscreen document gives the model a stable home without ever touching the page's main thread.
Measure on real mistakes, not just the validation split
Validation metrics looked fine while the extension still blurred cricket reels and festival photos. A small evaluation set of real feed mistakes, scored by the same thresholds the extension ships, became the gate for any model or preprocessing change, and a mining script surfaces likely mistakes so only a few percent of captured posts need manual review.
A written label spec before more data
Red festival colours (Dashain tika, Holi powder) were being read as gore. Rather than only adding images, the gore class was redefined as real or photo-realistic injury only, with drawings, horror posters and game renders explicitly neutral, and existing labels were re-sorted against that rule.
What I took from it
- The model was the easy part. The latency budget defined every other decision.
- Most accuracy problems were data problems: hard negatives and consistent labels mattered more than another training run.
- A metric is only useful if it is measured the way the product runs; train/serve preprocessing has to match exactly.