How Tab predicts your next edit
Octavo Team · 5 min read

Tab predicts the next edit you are about to make: the text that changes and the place it goes. Sometimes that is a few lines after the cursor. Sometimes it is a rewrite of the line you are on, or a call site further down the file that still uses an old signature. Tab runs on Octavo Tab, a small model we train for this one task.
This post covers what the model reads, how we train it, how it stays fast and how it decides when to show nothing.
What the model reads
Each request carries three inputs. The first is a window of the current file around the cursor. The second is your most recent edits, across the files you have touched, as small diffs with the newest last. The third is the definitions of symbols that appear in the window, looked up through the codebase index.
The recent edits carry the most signal, because a change you just made is often the first of a pattern. Here is a typical sequence in src/billing/format.ts:
// Your edit, a few seconds ago- export function formatAmount(cents: number): string {+ export function formatAmount(+ cents: number,+ currency: CurrencyCode,+ ): string { // Tab's prediction, at the next call site in the file- const label = formatAmount(invoice.totalCents);+ const label = formatAmount(invoice.totalCents, invoice.currency);The new parameter is in the edit history, so the model expects each call to change the same way. This is how Tab follows your recent edits: the edits are part of the input. The model is never fine-tuned on your code.
Predicting a region
The model’s output is a rewrite of a small region around the cursor, usually a few lines. The editor compares the rewrite with the current text. If the only difference is new text at the cursor, you see ghost text. If existing lines change, you see the change inline, with the removed text marked. One accepted suggestion can apply several separate changes in the region, such as a renamed variable on three lines.
Most of a rewritten region matches the input, and generating matching text token by token is slow. The server uses the current region as a draft. It checks the model’s predictions against the existing text in large blocks, keeps the blocks that match and generates new tokens only where the text diverges. Output time grows with the size of the change and barely with the size of the region.
Jumps and imports
After you accept an edit, Octavo Tab also predicts where the next one belongs in the file. A small marker reading “Tab to jump” appears at that line. Press Tab to move there. The suggestion for that spot usually arrives with the jump, because both come back from the same request.
When an accepted suggestion uses a symbol the file does not import, Tab proposes the import as a separate edit at the top of the file, for example import { CurrencyCode } from "./currency";. The path comes from the codebase index, so the import points at the module that exports the symbol.
Training on edit sequences
Octavo Tab learns from sequences of edits reconstructed from the commit history of permissively licensed open-source repositories. A commit records a set of changed hunks without the order a person made them in. We order the hunks so a definition changes before its uses. Then we train the model to predict the next hunk and its location from the earlier hunks and the file contents.
The ordering is a heuristic, and it is sometimes wrong. People often fix a call site first and the signature second. A model trained only on our ordering leans toward a tidier editing order than real sessions show, so we add sequences with the hunks in other valid orders.
We also include positions where the right answer is no edit. Without them, a model trained only on edits treats every pause in typing as a request for a suggestion.
The latency budget
A suggestion helps only if it appears before you type the next character. We measure latency in the editor, from the last keystroke to the moment ghost text renders, and hold the median to a fixed budget. Three practices keep it there.
Each keystroke cancels the request in flight, and the server stops generating for it, so no capacity goes to a stale suggestion.
Consecutive requests share most of their input. The file window and edit history change by a character or two between keystrokes, so the server keeps the computed state for the shared prefix and processes only the new tail.
Copying matching text from the draft, described above, keeps output time short even when the region is large.
Deciding when to stay quiet
A wrong suggestion costs attention. You read it, judge it and dismiss it, and that breaks the line you were writing. Octavo Tab scores its confidence in each prediction, and the editor shows a suggestion only above a threshold.
We set the threshold with offline replay. We take held-out edit sequences, run the model at each position and count a suggestion as correct when it matches the edit the author made next. Raising the threshold to its current value removed suggestions that were nearly all wrong, and the share of shown suggestions that matched the real next edit went up.
An exact match with one author’s next edit is a strict measure. Many unmatched suggestions are reasonable edits the author wrote another way, so we read samples of them before each threshold change.
Using it
Press Tab to accept a suggestion. Keep typing to ignore it, and the next keystroke cancels it. With Privacy Mode on, the context Tab sends is used to compute the suggestion and is never stored.
The features page shows each Tab feature in the editor.


