Two years after the release of GPT3, new capabilities were announced this year on March 15. Besides customising it for your application, the new capabilities of GPT-3 and Codex can insert content into an already existing text instead of just completing the text. This new addition in the language model helps revise existing content like rewriting a paragraph or refactoring a code. It has also helped unlock many new cases and has improvised existing ones. GitHub Copilot has already piloted these additions and has seen good results.
Commenting on the new capabilities of GPT-3, Aransentin, a Reddit user, said, “Is it just my bias speaking, or is the quality improved as well? GPT3 used to be pretty bad at poetry, but now it actually does a decent job with it. The new capabilities remember what words rhyme, as it only has access to token-level information and not what the words actually look like.”
Below is the demo on how the new capabilities of GPT-3 work:
Based on the already available text, GPT-3 and Codex just added text at the end of existing content. It can also edit and add text in the middle of the content.
Inserting into the middle of text
The new insert capability adds the contextually relevant text in the middle of existing content by providing future context to the model. This will help improve the quality of completions of the content for applications that include writing long-form text, transitioning between paragraphs, following an outline, or guiding the model towards an ending.
In the example above, the aim is to fill in the text between two section headers. Without referring to the context of future sections, the model generates a completion that is not relevant to the second section. However, the model generates a completion that ties the two sections together when the context of future sections is accounted for.
In the above example, the model successfully completes the missing function ‘prune’ while connecting to already written code. In new capabilities, there is a provision to add docstring and missing imports, which can be added only after knowing the code that completes it.
Inserting content is particularly useful for writing code. Codex was motivated to develop these capabilities as codes are typically added in the middle of an existing file in software development. The insert capability is currently being piloted in GitHub Copilot, with some good results. It is available in the API today in beta, as part of the completion endpoint and through a new interface in Playground. These capabilities can be used with GPT-3 and Codex, text-DaVinci-002 and code-DaVinci-002.
Editing existing text
A new endpoint in beta called edits is also part of the new capabilities that can change existing text via instruction instead of completing the text. Editing the existing content is a meaningful part of writing text and codes. Here, editing is mainly done by prompting or providing instructions, wherein the edits endpoints are used to change the tone or structure of the text or even make targeted changes like correcting the spelling of a text. We have also found that edits work fine on empty prompts, enabling text generation similar to completion endpoints.
In the above example, the user can use edits to:
- Add a poem.
- Change the poem to be in first-person.
- Transform a poem into a letter with the appropriate salutation and signature.
JSON file into YAML
The above example starts with JSON input containing cities ranked by population. Codex can remove the rank field from JSON with our first edit and can change the state abbreviations into full names of the cities. The second edit has converted the JSON file into YAML returning from a function.
The edits endpoint is very useful for writing code; it works well in refactoring or adding any documentation or translation between programming languages or changing coding style. These edits are available as a specialised endpoint in the API and through a new interface in Playground. It is supported by models text-DaVinci-edit-001 and code-DaVinci-edit-001. The edits endpoint is free to use currently and publicly available as a beta.