LEARN FOR AI
The Math Behind AI Search

Kishan Panpalia
Founding Team, Pepper
Updated:
Published:
28/10/2025
5
min read
TLDR
- AI answer engines retrieve source passages and then generate answers from them, a process called retrieval-augmented generation that marketers can influence.
- Cosine similarity, hybrid keyword and vector retrieval through Reciprocal Rank Fusion, and reranking decide which pages get pulled into AI answers.
- Write focused single-topic pages, cover both keywords and topics, lead with a crisp answer and use question-style headings, bullets and FAQs.

The Bottom Line
AI Search runs on measurable math: embedding similarity, hybrid retrieval and reranking. Pages that answer one question clearly, with matching keywords and scannable structure, are the ones these systems retrieve and cite.
As Pepper’s resident Generative Engine Optimization (GEO) nerd, I get asked a lot about how large language models and AI answer engines like Google’s AI Overviews work behind the scenes. That’s not surprising — just look at the rise in interest in AI Search Optimization over the last year.

Yes, there’s a ton of overlap between GEO and SEO best practices. But GEO still represents a fundamental shift in search, and its importance is growing as Google makes AI Overviews and AI Mode the default search experience.
To influence these AI tools, we need to understand them at their core.
At a high level, these LLM-powered answer engines operate in two phases: Retrieval of source information and Generation of an answer using that information.
Under the hood, that workflow unfolds something like this:
- First, the system interprets and may expand the user’s query.
- Then, it retrieves the most relevant passages from a search or vector index.
- Finally, the LLM composes an answer by combining its existing knowledge with those retrieved snippets, often surfacing citations alongside key claims.
This is often called Retrieval-Augmented Generation (RAG). Mathematically, we can view an LLM’s answer as a function Answer = f(Query, {Docs}), where the document set is chosen to maximize relevance and quality.
LLMs seem mystifying, but we can dissect how they work — and what it means for marketers — in a few key ways.
The core math that powers AI Search
1) Embedding similarity (how “close” your page is to the question)
When an AI answer engine looks for the content most relevant to a user’s query, it first converts both the query and the passages from a potential source into vectors, or long lists of numbers that represent meaning. Each vector is a point in a high-dimensional space. To decide which passages are most relevant, the system compares the angle between these vectors using a metric called cosine similarity.
Vectors that point in the same direction (a small angle) mean the texts are semantically similar; those pointing in very different directions mean they’re about different things.
In plain English, cosine similarity tells the system how close two pieces of text are in meaning, not just in matching keywords.

Marketer takeaway: Write clear, focused pages on one topic each. That creates “distinct” vectors that closely match questions. This will increase your chances of getting retrieved and cited.
2) Hybrid retrieval (merging keyword and vector results)
Most AI answer engines combine two kinds of retrieval signals: keyword-based and semantic (vector-based). The keyword side comes from traditional search ranking, i.e., where your content appears in the classic blue-link results. The vector side measures how closely your content’s meaning aligns with the user’s question.
To merge these two perspectives, systems often use a technique called Reciprocal Rank Fusion (RRF), which blends results from both methods into a single ranked list before the LLM chooses which passages to cite.

Marketer takeaway: You need both obvious keywords and strong topic coverage. Don’t rely on just one or the other.
3) Reranking (which candidates make the answer)
The LLM uses a “reranker” to assign a relevance score to each possible page it can pull, often modeled like:

Marketer takeaway: Compel AI to pull your content with this simple checklist.
- Put a crisp answer sentence first.
- Use headings that echo the questions users are asking.
- Use bullets, tables, and FAQs.
That’s enough math for this week. In our next newsletter, I’ll dive into three simple yet high-impact KPI formulas you can use to track how well you’re actually optimizing for AI Search — so be sure to stay tuned (and dust off that TI-84, for old times’ sake).
And if you really want to get an edge on AI Search, sign up to get early access to Atlas, our transformative tool for tracking and optimizing AI Search visibility.
Kishan Panpalia is a founding team member at Pepper.



SEO budgets get a boost

Turns out AI didn’t kill SEO — it gave it a raise. New research shows that more than 61% of companies are increasing their SEO budgets due to AI. About a third (35%) are staying the course with their current budgets, and just 4% plan to scale back.
Even more telling: 86% of businesses are already investing in what they’re calling “AI SEO” (what we usually call AI Search or GEO here at AI Native). In short: Everyone’s competing to stay visible in a world where “ranking” now means appearing in an LLM’s context window, and they’re willing to shell out to show up.

AI news is moving faster than cosine similarity converges to 1. Here are the top stories to know this week.
- There’s much ado about OpenAI’s Atlas browser, a search-meets-chat hybrid that cites its sources. Early verdicts are lukewarm, with some reviewers shrugging it off as underwhelming, others calling it just gussied-up Googling, and yet others calling out security risks.
- Microsoft is close on Atlas’ heels with Edge Copilot Mode, which users can’t help but note behaves a lot like OpenAI’s new toy. Nothing screams “innovation in 2025” like releasing a copycat feature 48 hours after your competitor/frenemy.
- Reddit’s taking Perplexity to court, the latest salvo in the ongoing fight over who owns the internet’s training data.
- Amazon’s rolling out a new AI shopping feature that predicts what you’ll buy before you finish scrolling. It reads reviews, compares specs, and lands you on a decision faster than your willpower can object.
- Layoffs hit Amazon and Meta AI teams. Amazon’s HR division and Meta’s AI unit both announced cuts this month as Big Tech recalibrates around generative investments.
- Wikipedia joins the “zero-click” club. The internet’s favorite homework helper says traffic is taking a hit as AI summaries and social-video platforms siphon off readers who never click through.
- Mondelez will embrace generative ads to cut creative production costs by up to50%. AI may be able to write taglines, but it will never know the sweet, sweet satisfaction of a perfectly split Oreo.
- Microsoft is channeling Clippy’s energy with Copilot’s brains. The brand’s new AI assistant, Mico, is sending nostalgic millennials over the moon.

- Head of Global Marketing, Amazon Key @ Ring (Austin, TX, $166,100 - $274,600 USD)
- Head of B2B North America Marketing, Uber for Business @ Uber (New York, NY, $186,000 - $207,000)
- Head of B2B Integrated Marketing @ Adobe (San Jose, CA, $121,500 - $265,400)


See what AI says about you.
Get a report on the answers where ChatGPT, Gemini, Perplexity and Google AI Overviews name you, and the ones where they name someone else.

Run the free check
More from this category
Continue exploring Learn for AI
250+ brands that Pepper got recommended

For businesses playing the long game, Pepper turns your earned authority visible to search & AI, making
organic growth winnable again.
Get a strategy presentation with real projections before you sign up.
i
*the long game is not about waiting.
It is about building something that keeps winning after everyone else's quick win wore off. And you will see it work within a quarter.






















