Workflow ·

Grammarly engineering: how editor suggestions are represented and applied using operational transformation and the Delta format

The problem

Grammarly needed to keep editor suggestions correct and relevant as users edited text in real time, and to support accepting multiple suggestions at once without causing the editor to freeze or produce garbled text.

First attempt

Applying individual suggestion deltas sequentially caused the editor to freeze for a noticeable period, and composing multiple suggestion deltas without rebasing caused the resulting text to appear broken with mixed-up characters.

Workflow diagram · grounded in source
1
User edit sent to backend
trigger
“This text change is then communicated to our back-end, which scans for mistakes and sends suggestions to the client.”
2
Suggestion card displayed
output
“When a suggestion is received from the back-end, a suggestion card appears in the Grammarly Editor UI”
3
Suggestions stored in repository
integration
“All the suggestions received from the back-end are stored in the Suggestions Repository.”
4
Delta Manager rebases on edits
validation
“the Delta Manager has an important job: It rebases suggestion Deltas according to new changes coming in”
5
User accepts suggestion
trigger
“Every time a user accepts a suggestion, we change its state in our Suggestion Repository from registered, which means it is relevant and correct, to applied”
6
Delta compose applies fix
output
“we take the suggestion Delta and compose it with the text Delta to generate a new text Delta with the user's mistake fixed”
7
Bulk rebase for multi-accept
validation
“every time we join a new suggestion Delta onto the composed Delta, we need to rebase this suggestion as if all the previous suggestions in the composed Delta had already been applied to our text”
Reported outcome

By composing all suggestion deltas together and rebasing each against prior ones before composition, Grammarly achieved a feature that applies multiple suggestions at once correctly and instantly, eliminating the UI freeze.

Reported metrics
Users impacted daily30 million people
Professional teams served daily30,000 professional teams
Reported stack
Delta formatQuill
Source
https://www.grammarly.com/blog/engineering/how-suggestions-work-grammarly-editor/
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

By composing all suggestion deltas together and rebasing each against prior ones before composition, Grammarly achieved a feature that applies multiple suggestions at once correctly and instantly, eliminating the UI f…

What tools did this team use?

Delta format, Quill.

What results were reported?

Users impacted daily: 30 million people; Professional teams served daily: 30,000 professional teams (source-reported, not independently verified).

What failed first in this deployment?

Applying individual suggestion deltas sequentially caused the editor to freeze for a noticeable period, and composing multiple suggestion deltas without rebasing caused the resulting text to appear broken with mixed-u…

How is this workflow AI workflow structured?

User edit sent to backend → Suggestion card displayed → Suggestions stored in repository → Delta Manager rebases on edits → User accepts suggestion → Delta compose applies fix → Bulk rebase for multi-accept.