ai Client-Side Only

Vector Search & Nearest Neighbors Lab

Interactive 2D vector database search. Place points, configure a query vector, choose Cosine vs Euclidean distance, and retrieve top-K nearest neighbors.

Concept Breakdown: High-Dimensional Semantic Vector Spaces

1. The Word Constellation

Computers turn words into coordinates on a multi-dimensional map. Concepts with similar meanings (like "dog" and "puppy") float near each other, while unrelated ideas are far away.

2. How AI Searches Meaning

When you search "cute pet", an AI doesn't just match keywords. It finds the coordinate for "cute pet" and retrieves whatever word sits closest on the map (like "kitten").

3. Click the Grid Below!

Click anywhere on the 2D grid below to move the green Query pin. Watch the rankings update in real time to show which words the AI considers most semantically related!

DISTANCE METRIC:
CLICK ANYWHERE ON CANVAS TO MOVE QUERY VECTORq = (0.62, 0.45)
(0,0)QUERY (q)kingqueenmanwomandogpuppycatkittenappleorange
NEAREST NEIGHBOR RANKINGSSorted by cosine
#1queen
cos: 0.997 (100%)
#2man
cos: 0.980 (98%)
#3king
cos: 0.973 (97%)
#4woman
cos: 0.921 (92%)
#5orange
cos: 0.359 (36%)
#6apple
cos: 0.194 (19%)
#7cat
cos: -0.970 (0%)
#8kitten
cos: -0.987 (0%)
#9dog
cos: -0.999 (0%)
#10puppy
cos: -1.000 (0%)

Semantic Vector Arithmetic: King - Man + Woman = ?

In high-dimensional embedding spaces (such as Word2Vec or OpenAI text-embedding-3), semantic concepts form directional vectors:

vec("king") - vec("man") + vec("woman") ≈ vec("queen")Cosine Match: 0.94

Practice Challenge: Nearest Neighbor Search

Click on the 2D plane near the bottom-left quadrant to align your query point with "kitten" until Cosine Similarity exceeds 0.92.

Quick Reference & Instructions

Simple steps, pro tips, and execution details

1

Provide Inputs

Type, paste, or select your values in the form fields below.

2

Instant Live Analysis

Calculations and formatting happen automatically with zero delay as you type.

3

Copy or Use Output

Copy results or apply the clean output directly to your projects.

How It Works

Calculates nearest neighbors dynamically on an interactive coordinate plane and ranks matches by similarity score.

Frequently Asked Questions

Common questions about calculations, assumptions, and edge cases.

Yes, Vector Search & Nearest Neighbors Lab is 100% free with unlimited calculations and zero paywalls or subscriptions.