Sub topic 1
How AI search differs from classic search
Prerequisites
This chapter assumes you understand how classic search engines rank pages, know basic SEO terms such as keywords and backlinks, and have used an AI chat or AI search product. The code sketch is optional.
Classic search returns links. AI search returns answers.
A classic search engine returns a ranked list of pages, and the user does the reading. Many AI search systems first retrieve a set of documents, then a language model writes a response that cites some of them. Ranking still matters, but the system often works with short passages from pages rather than whole pages.
Why a language model cannot answer from memory alone
A language model is a neural network trained on a fixed snapshot of text. Its knowledge stops at training time, and it can state unsupported claims with confidence. Retrieval gives the model current sources it can check and cite.
Retrieval-augmented generation in plain terms
Retrieval-augmented generation (RAG) is a pattern where the system searches first, inserts the best passages into the model's prompt, and asks the model to answer from them. The flow is retrieve, select, generate, then cite.
From a prompt to an intent
A prompt is the text a user types. The system infers an intent, which is the goal behind the words. Two prompts with different wording can share one intent, and one prompt can contain several intents. The inferred intent shapes which searches run next.
Query fan-out: one question, many searches
Query fan-out is the step where one prompt becomes several narrower searches. The prompt "best running shoes for flat feet" might produce queries about stability shoes, arch support, and budget options. The system merges the results. A page that answers several of these sub-queries has more chances to appear in the final answer.
def fan_out(prompt):
topics = ["stability shoes", "arch support", "budget options"]
return [f"{prompt} {topic}" for topic in topics]
for query in fan_out("running shoes for flat feet"):
print(query)Exercise
The prompt is "best laptop for students." Name two sub-queries a fan-out step might generate.
Show answer
For example, "laptop battery life for students" and "budget laptops for college."