The best kept secret about OpenAI’s GPT-3

When the first demos of GPT-3 content started to circulate it showed the amazing potential for a really smart language model to generate text and do cool things. Yet despite all the attention GPT-3 has been getting there’s one other aspect of it made available by OpenAI that’s been almost completely overlooked: Semantic Search. 

The OpenAI API not only lets you use GPT-3 to generate content, you can also use a special endpoint to have it sort through and rank content by how closely it relates to a block of text you provide.

Semantic Search is now the killer demo I use to really blow minds for people who think they know everything GPT-3 can do. This is just one tiny example: Using GPT-3 to match plot structure to movies with zero-coding other than making an API call.

Using GPT-3’s best kept secret to build a plot classifier with just the Semantic Search API and zero code.

If you’re like me when I first encountered Semantic Search in the documentation your reaction is probably “So what? Search has been a thing for decades.” I almost ignored it entirely to just play with the magical experience of GPT-3 generating content. But then I got curious and realized this could be the killer feature of GPT-3.

Okay, what is it? Think about how you answer a question like when someone wants to know your favorite movie or how to solve a problem. Semantic Search is like that with text. You give it a list and a query and it comes up with the best example. You can sort through anything that’s in text: Paragraphs from a story, tweets, user documentation, plots to movies, code, etc., and use the power of GPT-3 to help you find matches, categorize it, pull the right response to a question or any number of things we do when someone asks us a question. I don’t mean keyword matches. I mean really smart, thoughtful matching. Give it the name of a movie and list of plot types and it will tell you which one it most closely matches. Just drop in all of your use documentation and send it a question (and nothing else!) and it will pull up the most relevant example.

Using OpenAI’s Semantic Search API to sort through documentation with natural language

While artificial intelligence and search has been around. GPT-3 level search is brand new. We’ve had to create new ways to test it. 

I gave it one of my books and typed in “Humorous situations” and it surfaced all the paragraphs where something funny happened – despite the word “humor” never being used. I put in all of the OpenAI documentation for using the API and discovered that it could take a natural language question like “How do I use this to finish my sentences?” and it pulled up the relevant text. In fact, out of curiosity, I got Semantic Search to perform every single classification example in the OpenAI documentation examples – without having to create a special prompt. Matching plot structure to movies was a crazy test I gave it. Semantic Search laughed in my face and aced it. You can see the result at the top of this post.

Analyzing Tweet sentiment with OpenAI’s Semantic Search API

The potential for Semantic Search is only just beginning to be uncovered. Here’s a partial list of what it can do:

  • Sentiment classification
  • General classification
  • Sort through documentation
  • Analyze narrative text
  • Rank how close something matches a target
  • Identify story structure
  • Identify similar writing patterns

The crazy part is that it does all of these out of the box! You just give it an example and list to sort through and Semantic Search does all the heavy-lifting. We’ve only just begun to get the word out. I’m excited to see what happens when others start to play with Semantic Search. I feel like we’re barely scratching the surface.

Cover image by Warren Wong via Unsplash.


Andrew Mayne is a Wall Street Journal best selling novelist, occasional Shark Week star and works at OpenAI on creative applications for artificial intelligence. He can be found on Twitter: @AndrewMayne