Skip to content

Model Evaluation

Query Distance

In shortHow far apart two search queries are, measured by spelling (fuzzy matching), by meaning (embeddings) or by the results they share.

Updated 24 Oct 2026· 2 min read

Query distance describes how far apart two search queries are. A small distance means the queries are closely related, such as two phrasings of the same need or a query and its refinement. Measuring it across a keyword set helps you find near-duplicates, group related searches and trace the sequences people follow as they refine what they are looking for.

How it works

There are three main ways to measure it, and each answers a slightly different question:

  • By spelling. Fuzzy matching scores, such as Levenshtein-based ratios or Jaccard similarity on words, measure how similar the strings look.
  • By meaning. Turn each query into an embedding with a model such as Sentence-BERT and measure cosine distance, so “cheap flights” and “budget airfare” come out close.
  • By results. Compare the URLs that rank for each query. Queries with heavily overlapping results are treated as the same topic by the search engine.

How it’s used in SEO and marketing

  • Keyword clean-up. Merge near-duplicate keywords before prioritising.
  • Content briefs. For each main keyword, list its closest neighbours as subheadings or FAQs.
  • Query paths. Order related queries to see how people move from broad to specific searches.
  • Cannibalisation checks. Find pages targeting queries that are too close to need separate pages.

Example

In the Semantic Keyword Research course, a Colab notebook takes a list of keywords and returns, for each one, the most similar keywords and a similarity percentage. For “home gym all in one equipment”, it surfaces terms such as “home gym beginner equipment” and “home gym cardio equipment”, which together outline a cluster and the sections a guide on the topic should cover.

Limitations and things to watch

  • Spelling-based distance is lexical. It catches typos and word-order changes but misses synonyms, so check the meaning-based or results-based view before merging keywords.
  • Embedding distance can group queries with different intents, such as “buy running shoes” and “running shoe reviews”.
  • Results-based distance needs SERP data and changes over time.
  • Every method needs a threshold, so calibrate it on a sample you have checked by hand.

Learn it on MLforSEO

Where Query Distance shows up on MLforSEO

Sources and further reading

Other terms from Model Evaluation

See all 19 Model Evaluation terms →