← All writing

Vector Space and Azure AI Search

(AI Generated)

🚀 Vector Space and Azure AI Search

Imagine a galaxy where each star is a thought, a rule, or a query—floating in a high-dimensional space. Welcome to the world of vector search, where understanding meaning isn’t about matching keywords but measuring semantic closeness.


🌌 A Visual Analogy: The Vector Galaxy

Think of documents, rules, and queries as stars spread across a vast, multidimensional galaxy. The position of each star is determined by the semantic meaning of its content. When you search, you’re not looking for exact words—you’re navigating through this space to find the stars (documents) closest to your question.

The closer two stars are, the more similar they are in meaning. This is the core of vector search.


📐 Measuring Similarity: Metrics That Matter

Azure AI Search uses vector-based similarity, relying on mathematical metrics to compare embedded texts:

Metric What It Measures Use Case
Cosine Similarity Angle between vectors Best for semantic text matching
Euclidean Distance Direct spatial distance Great for clustering or spatial data
Dot Product Magnitude and alignment Helpful for ranking relevance

Cosine similarity is the go-to for text embeddings. It compares how aligned two vectors are—perfect for judging semantic meaning rather than raw word overlap.


⚙️ How Azure AI Search Works Under the Hood

Here’s the journey a query takes in Azure AI Search:

1. Embedding

Text (documents, queries, policies) is transformed into vector form using embedding models available through Azure OpenAI (such as text-embedding-ada-002).

2. Indexing

The vector representation is stored in Azure AI Search, alongside metadata like tags, filters, and document IDs.

3. Vector Matching

When a user submits a query, it’s embedded into a vector. The system then finds vectors with the highest similarity using algorithms like cosine distance or HNSW (Hierarchical Navigable Small Worlds).

Vector similarity is combined with traditional keyword filtering—so you can search for underwriting rules that are both semantically relevant and scoped to specific metadata like region = "NG15".

5. Ranking and Response

Results are scored and returned based on semantic closeness and filters. A modern language model hosted in Azure OpenAI uses those chunks to generate grounded, context-aware responses.


🧪 Practical Example: Insurance Rules in Action

Let’s say an agent asks:

“Can I offer a 10% discount for motor policy in NG15?”

Here’s what happens:

  • The query is embedded into a vector.
  • Azure AI Search scans indexed underwriting rules in vector space.
  • The closest matches (e.g. NG15-specific discount rules) are retrieved.
  • The language model uses these chunks to generate a relevant, compliant answer.
  • The agent receives an accurate, traceable decision within seconds.

🎯 Why It Matters

Traditional keyword search fails when terminology varies. Vector search lets you capture the intent of a question and find semantically related answers—even if phrasing doesn’t match exactly. This unlocks smarter, faster, more human-like responses.