How does AI know things?
Last week, I argued that as decision makers increasingly use AI chatbots like ChatGPT, Claude, Gemini and Copilot to discover and evaluate software, every B2B SaaS should be thinking about managing how these chatbots answer questions about their product. But this raises an important question: Is it even possible?
Well, the answer is Yes. In fact, a few companies have already started doing it. But to understand how to do it, we need to understand how AI chatbots “know” the answers that they provide to users. So in this post, I want to give a quick overview of the two ways that AI chatbots get information.
Before we get started, we need to distinguish between two different pieces that make up an AI chatbot: 1) The underlying “AI” is a machine learning model called a Large Language Model (LLM) that can answer one question at a time by predicting what words will come next after some starting text. 2) Between the user and the AI/LLM is the chatbot application that turns the user’s question into a series of prompts for the model, then packages up the final answer.
The first way that an AI chatbot can “know” things is that the underlying model (the LLM) learns relationships between words during training: It looks at a large body of text from different sources, and learns patterns that allow it to predict which words follow from which words, including how answers follow questions.
This training step takes a long time and processing power, so it isn’t done very often - maybe once a year. And while the model may learn some things about your B2B SaaS, depending on what makes it into its training set, there isn’t much you can do about it. So managing AI answers is all about the second way that chatbots “know” things.
Because of the way the underlying model (LLM) works, it also gets information from the prompt that it’s responding to. If you start your question with a description of your background, it will tailor the answer to your level of knowledge. If you tell it about your situation, it will use that information in the answer. Well, the application that sits between the user and the model can use the same trick.
Retrieval Augmented Generation (RAG) is an algorithm in which the application part of an AI chatbot looks up information from the internet and feeds it to the model via the prompt. Here's how it works:
As I hinted at above, when you type your question into the application, it turns that one question into multiple questions that it asks the model behind the scenes.
One of them is something like "Do you need more information to answer the query?"
If the model answers "yes", the application kicks off the RAG algorithm.
Step 1) The application asks the model: "What web query should I use to find the right information?"
Step 2) The application takes the query from the model and types it into Bing (if it's ChatGPT or Copilot), Google (if it's Gemini) or another search engine.
Step 3) The application downloads the websites from the search results and packages them together.
Step 4) The application asks the model its final question, with the web results inserted into the prompt: "I found these results on the web [package of information]. Based on this, what's the answer to this question: [original question]."
Step 5) The application takes the model's final answer and passes it back to the user.
Now, this is slightly simplified compared to the real algorithm, but it’s a good mental model for thinking about managing that final answer. In particular, there are two key pieces to manage: 1) Making sure the web searches from AI-generated queries lead to information that you have control over, such as your website. 2) Making sure the information on those pages can be properly interpreted by the AI/LLM.
There’s plenty to discuss about each of these. But before we can dig into that, we need to understand the kinds of queries that the AI is likely responding to (Spoiler: It’s different from web searches.) So that’s where we’ll jump in next week. Stay tuned!
Thanks for reading Viral Esoterica! If you want a free Report Card evaluating how AI chatbots answer questions about your B2B SaaS, click here.