← All posts

Contextual Corrections: How Typlx Uses LLMs for Better Grammar Checking

For decades, grammar checkers have worked the same way: match a pattern, flag a violation, suggest a replacement. This rule-based approach got us surprisingly far, but it has a hard ceiling. Language is not a set of rules — it is a living, shifting, context-dependent system. And that is exactly where large language models change the game.

The Problem with Rules

Rule-based grammar checkers work by encoding linguistic patterns into static rules. “If a sentence starts with X and contains Y, flag it.” This approach has two fundamental problems:

False positives. Languages are fluid. Slang evolves, technical jargon proliferates, and context changes meaning. A rule that flags “less” when it should be “fewer” might be correct in a formal essay but wrong in a casual Slack message. A rule that flags passive voice might catch perfectly appropriate scientific writing. The more rules you add, the noisier the output becomes.

False negatives. Rules can only catch what they are written to catch. If a sentence is grammatically correct but semantically confusing, a rule-based system will wave it through. “The manager said the engineer was responsible for the delay” — who was responsible? A rule engine does not know. A language model does.

The result is a frustrating experience: too many wrong flags on things that are fine, and silence on things that genuinely need fixing.

The Typlx Advantage: Contextual Intelligence

Typlx takes a fundamentally different approach. Instead of pattern matching, it sends your text to a large language model that reads and understands the full context of what you are writing. This enables three capabilities that rule-based systems simply cannot replicate.

Developer-First Context

Developers write in a unique dialect. Terms like “kubectl,” “refactor,” “middleware,” and “sharding” are not in any standard dictionary. A rule-based checker underlines them in red. Typlx understands that these are valid technical terms and leaves them alone — while still catching the actual typo two words later.

More importantly, Typlx understands technical context. It knows that “the pod was evicted” is not passive voice worth flagging in a Kubernetes incident report. It knows that “nullable” is a real word when you are writing about TypeScript. This context-awareness dramatically reduces noise for technical writers.

Tone and Clarity

Grammar is only half the battle. The other half is clarity. Typlx does not just fix broken sentences — it suggests concise rewrites that make your meaning sharper. If your sentence is grammatically correct but unnecessarily wordy, Typlx will offer a tighter alternative. If your tone shifts awkwardly between formal and casual, it will flag the inconsistency.

This is the kind of feedback that previously required a human editor. LLMs make it available in real time, inline, as you type.

Privacy-Preserving Inference

The obvious concern with sending text to an LLM is privacy. Typlx addresses this head-on with a local-first architecture. By default, your text is processed by a model running on your own machine via Ollama or LocalAI. Nothing leaves your device. Nothing is logged. Nothing is trained on.

If you prefer a cloud model for higher accuracy, Typlx supports that too — but the choice is always yours, and the connection is always direct to the provider you choose. Typlx never proxies your text through its own servers.

How It Works

Under the hood, Typlx follows a three-step pipeline:

  1. Context Extraction. When you type in a text field, the Typlx extension captures the surrounding text and metadata — what website you are on, what kind of field it is (email body, code comment, chat message), and any relevant surrounding content. This context is bundled into a structured prompt.
  2. LLM Analysis. The prompt is sent to your configured LLM backend (local or cloud). The model analyzes the text holistically — grammar, spelling, punctuation, tone, clarity, and technical accuracy — and returns a set of suggested corrections with explanations.
  3. Surgical Replacement. Typlx applies corrections inline, replacing only the specific text that needs fixing. You see a clean diff of what changed and can accept or dismiss each suggestion individually. The original text is never modified without your approval.

The entire round-trip typically takes under two seconds with a local model, and under one second with a cloud provider.

Conclusion

Rule-based grammar checkers were the best we had for a long time, and they still have their place. But for anyone who writes technical content, values privacy, and wants corrections that actually understand what they are saying, LLM-powered checking is a generational leap forward.

Typlx is our attempt to make that leap accessible: open source, local-first, and designed for the way developers and technical writers actually work. We think once you try contextual corrections, you will not want to go back to red squiggly lines that do not understand your code.

Ready to try Typlx?

Install Free View on GitHub