Short answer
Edit mode takes a piece of existing text plus an instruction, such as "make this friendlier," and returns a revised version; insert mode takes the text before and after a gap and writes what belongs in between. Both arrived in beta on March 15, 2022, so GPT-3 and Codex can now revise and fill in content instead of only adding to the end.
Follow-up question When is editing better than generating from scratch?
Until last week, GPT-3 could do one thing with your text: continue it. You gave it the beginning, and it wrote what came next. That suits drafting, but most real writing is revision, and most real coding happens in the middle of a file. On March 15, OpenAI shipped updated GPT-3 and Codex models with two new abilities that address exactly this: edit and insert.
Both are in beta, both can be tried in the Playground (OpenAI's web interface for testing prompts), and both can be used through the API. They work differently, so it helps to look at them one at a time.
Edit: existing text plus an instruction
The edit mode has its own endpoint, a separate address in the API for this kind of request. You send two things: the text you already have and a short instruction describing the change. The model returns the changed text rather than a continuation of it.
OpenAI lists the kinds of changes it handles well: adjusting tone, reorganizing structure, and small targeted fixes such as spelling. For code, it suggests refactoring (restructuring code without changing what it does), adding documentation, translating from one programming language to another and changing coding style. Two dedicated models power it, text-davinci-edit-001 for prose and code-davinci-edit-001 for code, and during the beta the edits endpoint costs nothing to use.
Here is a worked example. The text:
Due to unforeseen circumstances, the community garden meeting scheduled for Thursday is hereby postponed. Members are advised that a new date will be communicated in due course. Failure to check email may result in missing the rescheduled meeting.The instruction:
Rewrite this in a warm, friendly tone for neighbors. Keep it under 50 words.Here is the kind of rewrite to look for: "Hi neighbors! We've had to postpone Thursday's community garden meeting. We'll send the new date by email soon, so keep an eye on your inbox. Thanks for understanding!" The facts stay the same; only the tone and length change.
You can chain edits. OpenAI's own demonstration starts with an empty text box, asks for a poem, then asks for the poem in the first person, then asks for it as a letter with a greeting and signature. Each step works on the previous result. An empty starting text also means edit mode can generate new content, much as a normal completion does.
Insert: filling a gap
Insert works inside the ordinary completions endpoint. Alongside the usual prompt, you can now supply a suffix: the text that should come after the generated part. The model writes something that connects the two. It is available with the latest models, text-davinci-002 and code-davinci-002, and costs the same as earlier Davinci models.
Knowing what comes next changes the result. OpenAI's example is an outline: asked to fill the space between two section headings, a normal completion writes something unrelated to the second section, while insert produces a passage that leads into it.
Code is where insert shines, and OpenAI says Codex was the original reason for building it. Programmers rarely write at the end of a file; they add functions between code that already exists. Here is a small worked example in Python. The prompt (the code before the gap):
import csv
def load_scores(path):
"""Read a CSV file with columns name,score and return a list of (name, score) tuples."""The suffix (the code after the gap):
scores = load_scores("class.csv")
best = max(scores, key=lambda row: row[1])
print(f"Top student: {best[0]} with {best[1]}")Because the model sees how load_scores is used afterward, it knows the function must return pairs whose second item can be compared as a number. A good insertion opens the file, skips the header, converts each score to a number and returns the list. Without the suffix, it would have to guess. OpenAI notes that insert can even add missing imports or documentation that only make sense once you know what follows, and that GitHub Copilot is already piloting the feature.
Try it: In the Playground, paste a paragraph you wrote recently into edit mode and give three different instructions in turn: "fix the grammar only," "make it half as long" and "rewrite for a ten-year-old." Then switch to insert mode, write an opening sentence and a closing sentence for a short story, and let the model write the middle.
When is editing better than generating from scratch?
Editing is better when you already have the substance right and want to change the form. If your notes contain the correct facts, dates and names, asking the model to revise them keeps those details anchored in your text. Generating from scratch invites the model to fill gaps with plausible inventions, while an edit gives it far less room to wander.
It also suits work that must fit something that already exists: a paragraph in the middle of a report, a function in a working program, a transition between two sections you are happy with. Insert mode is built for these cases, because it reads both sides of the gap.
Generating fresh text still makes sense when you have nothing yet, or when you want options you had not thought of. A practical workflow uses both: generate a rough draft, edit it in small instructed steps, and use insert to bridge any section that does not connect. After each step, read the result, since an edit can still drop a detail or change a meaning you cared about.
Sources
- New GPT-3 Capabilities: Edit & Insert — OpenAI, March 15, 2022
- Introducing Insert and Edits Capabilities — OpenAI Community (OpenAI staff announcement), March 15, 2022