Grammar and Spelling Correction API, based on GPT

What are Grammar and Spelling Corrections and Why Use GPT?

Grammar correction and spelling correction are about removing mistakes from a piece of text.

It sounds easier than it is as there are several kind of mistakes. Sometimes it is just about a typo or a misspelled word, but it can also be a deeper sentence structure issue. Thanks to AI, it is now possible to reliably detect errors and propose a perfect correction, in most languages.

GPT-J and GPT-NeoX are the most advanced open-source NLP models as of this writing, and they are the best GPT-3 alternatives. These models are so big that they can adapt to many situations, and perfectly sound like a human. They are very good at correcting mistakes.

Why Use a Grammar/Spelling Corrector?

Writing content with mistakes is bad for reputation, and it makes it hard to understand the underlying ideas. Here are a couple of examples:

Content Creation

Marketing teams write a lot of content on a regular basis. It is hard to write fast without making mistakes. In order to keep a high productivity, the best solution is perform a text correction on the content once it's finished and use the corrected text.


Making mistakes when writing to customers is very bad for the brand. Good news is that it's easy to automatically correct every message before sending it!

Grammar and Spelling Correction with GPT

In order to make the most of GPT, it is crucial to have in mind the so-called few-shot learning technique (see here): by giving only a couple of examples to the AI, it is possible to dramatically improve the relevancy of the results, without even training a dedicated AI.

Building an inference API for grammar and spelling correction based on GPT is a necessary step as soon a you want to use correction in production. But building such an API is hard... First because you need to code the API (easy part) but also because you need to build a highly available, fast, and scalable infrastructure to serve your models behind the hood (hardest part). It is especially hard for machine learning models as they consume a lot of resources (memory, disk space, CPU, GPU...).

Such an API is interesting because it is completely decoupled from the rest of your stack (microservice architecture), so you can easily scale it independently, and you can access it using any programming language. Most machine learning frameworks are developed in Python, but it's likely that you want to access them from other languages like Javascript, Go, Ruby...

NLP Cloud's Grammar and Spelling Correction API

NLP Cloud proposes a grammar and spelling correction API based on GPT that gives you the opportunity to perform correction out of the box, with breathtaking results.

For more details, see our documentation about text generation with GPT here. Also see our few-shot learning example dedicated to grammar and spelling correction here. And easily test GPT correction on our playground.