Blog

Technical articles about on-device AI, browser-based chatbots, NLP, reinforcement learning, and privacy-first machine learning.

23 articles
55 min total
Topics
30JUN
1 min

Progressive Loading: BOW to MLP to Transformer in 3 Stages

The three-stage loading strategy that gives usable answers instantly while the 22MB transformer model streams in.

ReLU.chat
30JUN
1 min

Dense-Sparse Ensemble Ranking: Combining BM25 and Embeddings

How fusing dense cosine similarity with BM25 sparse scores at 70/30 weights produces better retrieval than either alone.

ReLU.chat
30JUN
1 min

Topic Correction: When Users Say 'No, I Meant X'

How explicit topic correction detection prevents chatbot topic drift when users redirect the conversation mid-turn.

ReLU.chat
30JUN
1 min

Follow-Up Detection: 20 Patterns That Make Chatbots Conversational

How regex pattern matching and heuristic detection handle 20+ follow-up types from 'how?' to 'tell me more' to emoji-only responses.

ReLU.chat
30JUN
1 min

BM25 in the Browser: Field-Weighted Sparse Retrieval Without a Server

Implementing field-weighted BM25 with bigram phrase matching entirely in JavaScript for real-time knowledge retrieval.

ReLU.chat
30JUN
1 min

Service Worker Model Pre-Caching: Zero-Wait Chatbot Loading

How service workers pre-cache the 22MB transformer model and policy weights for instant chatbot startup.

ReLU.chat
30JUN
2 min

Session Memory Architecture: 30 Turns of Context Without a Server

How importance-based eviction, response compression, and EMA summary vectors maintain long conversation context entirely in the browser.

ReLU.chat
30JUN
2 min

Progressive Streaming Rendering: Making Chatbots Feel Native

How progressive response rendering with requestAnimationFrame creates a natural typing effect in browser chatbots.

ReLU.chat
30JUN
2 min

Int8 Quantization in the Browser: How We Made MLP Inference 4x Faster

How symmetric int8 quantization reduces memory and speeds up policy network inference in pure JavaScript.

ReLU.chat
Pastel illustration of an ONNX model graph with quantization nodes highlighted
3 min

ONNX Runtime Web and INT8 Quantization: How 90MB Models Become 22MB

A practical look at how ONNX Runtime Web plus INT8 post-training quantization shrinks a 90MB sentence transformer to roughly 22MB, with only a small accuracy loss, and why that tradeoff is exactly right for in-browser NLP.

ReLU.chat
Pastel diagram comparing BM25 sparse retrieval and dense vector retrieval side by side
3 min

BM25 vs Dense Retrieval: Why We Use Both for Browser Chatbots

BM25 is fast and exact; dense embeddings are semantic and forgiving. For real user queries — many of them short, typo-prone, or relying on jargon — neither wins alone. Here is why hybrid retrieval is the right default.

ReLU.chat
Pastel diagram of a service worker pre-caching a model and knowledge base for offline use
3 min

Service Workers and PWA Caching for Offline AI Chatbots

A service worker can pre-cache the 22MB ONNX model, the embedding index, and the chatbot shell so the entire experience keeps working after the first load — even on a plane.

ReLU.chat
Pastel illustration of a WebGPU compute shader running a matrix multiplication on browser
3 min

WebGPU and the Future of In-Browser AI Inference

WebGPU has shipped in stable Chrome, Edge, Firefox, and Safari. For in-browser ML, it is the unlock that makes 7B-parameter models possible without a server. Here is what it actually changes — and what it does not.

ReLU.chat
Pastel diagram showing knowledge fragments being retrieved, selected, and composed with connectors
4 min

Knowledge Fragment Composition: Why We Ditched Generation for Retrieval

Generation is flexible and dangerous; retrieval is rigid and safe. For domain-specific chatbots where accuracy matters more than creativity, retrieval + fragment composition wins. Here is the design and the tradeoffs.

ReLU.chat
Pastel illustration of a 384-dimensional vector space with semantically related sentences clustered together
3 min

Sentence Embeddings Explained: Why 384 Dimensions and What They Mean

384 is a specific number with a specific history. It is the output dimension of MiniLM-L6-v2, a distilled sentence transformer. Here is what those dimensions actually encode, why the number is what it is, and why it is the right size for browser NLP.

ReLU.chat
Pastel illustration of a PPO policy network with reward signals flowing in from multiple sources
4 min

PPO and Reward Design: Training a Chatbot Policy Network That Actually Works

The hardest part of training a chatbot policy network is not the algorithm — it is the reward function. A bad reward produces a model that optimizes for the wrong thing. Here is the function we use, what we tried that did not work, and what we learned about the dark art of reward shaping.

ReLU.chat
Pastel diagram showing a two-stage AI pipeline: heuristic first, then hot-swap to transformer
5 min

Heuristic Fallback for Cold Start: Graceful Degradation in Browser AI

A 22MB model takes seconds to load, and users will not wait. A heuristic fallback gives a working chatbot on first paint and hot-swaps to the full transformer when the model finishes downloading. Here is how the pattern works and what it costs.

ReLU.chat
Pastel illustration of knowledge fragments joined by linguistic connectors forming a coherent response
4 min

Linguistic Connectors: The Small Detail That Makes Retrieval Bots Sound Human

A retrieval chatbot that just concatenates fragments sounds robotic. Connectors — small transitional phrases — turn a list of facts into a coherent response. Here is the small but important design decision that affects how a knowledge-grounded bot feels to talk to.

ReLU.chat
Pastel comparison of word-level vector averaging versus whole-sentence transformer embedding
4 min

Sentence Embeddings vs Word Embeddings: Why We Embed Whole Questions

Word embeddings (Word2Vec, GloVe) capture the meaning of individual words. Sentence transformers (MiniLM, SBERT) capture the meaning of a whole phrase. For Q&A retrieval, only the second is useful. Here is why averaging word vectors fails, and what sentence-level embeddings do differently.

ReLU.chat
Abstract geometric shield representing privacy-first AI
2 min

Privacy-First AI: Why Browser-Based Machine Learning Matters

An argument for why browser-based machine learning is the future of privacy-first AI, and how ReLU.chat achieves zero data collection.

ReLU.chat
Abstract layered waves representing neural network reinforcement learning
2 min

Training Chatbots with Reinforcement Learning: The ReLU.chat Approach

An exploration of how reinforcement learning trains a lightweight MLP policy network to compose chatbot responses from knowledge fragments, without any LLM dependency.

ReLU.chat
Abstract connected nodes representing browser-based NLP processing
2 min

How Browser-Based Chatbots Work: A Deep Dive into On-Device NLP

A technical deep dive into how modern browser-based chatbots run full NLP pipelines client-side using quantized ONNX models, BM25 retrieval, and RL-trained policy networks.

ReLU.chat