Building a 3D Mind Palace to Understand Vector Embeddings

I am the sort of learner who needs to see something before I really grasp it. If I can spin a thing around, poke at it, and give it a bit of colour-coding, I relax and the mechanics start to click. This weekend, I hacked together a small app to get my head properly around vector embeddings. Having recently built Retrieval Augmented Generation into Alvia, the voice interview assistant I have been working on, I wanted a better intuitive feel for what was happening beneath the surface. Abstract explanations only get me so far; I needed a practical build to ground the theory.
Spending a couple of hours vibing with GPT-5 in Cursor gave me a proper 3D map you can fly through, turning mathematical relationships between data points into neighbourhoods of ping-pong balls.
I loaded it with a suitably nerdy dataset: about a thousand short notes describing photographs I have taken, covering everything from cameras, lenses, and film stocks to locations, subjects, and exposure settings. Each note becomes a ball in space, and notes with similar meanings sit close together. Have a look at the screenshot below; it is basically a tiny galaxy of camera gear.

What the app actually does
It is a fairly small Next.js app, though it pulls together a few useful tricks:
You add short notes, which the app converts into embeddings and stores in Supabase using pgvector.
You can run semantic searches in plain English, and the app pulls out related notes while showing how close they sit in the space.
Everything renders in an interactive 3D scatter plot where you can rotate, zoom, click individual dots, and read the underlying notes.
Your search query drops into the space as a red dot, tethered by amber lines to its closest matching notes.
Clusters get quick keyword labels, and you can adjust the cluster count or tweak the transparency to keep the view readable.
A speed-versus-accuracy slider lets you trade search thoroughness against response time.
All the fiddly controls, like how many notes to render or whether to apply vector normalisation, live in a sidebar so the main view stays uncluttered.
Why this works for my brain
Working with embeddings usually means reasoning about nodes in high-dimensional vector space. For this project I configured the embeddings at 1536 dimensions, and unless you are Stephen Hawking, trying to picture that directly is a recipe for a headache. Squishing those vectors down into three dimensions makes the structure visible, even if the 3D view is only an approximation:
Portrait shots cluster neatly in one area, Brighton night photos gather in another, and my Ilford HP5 notes naturally huddle alongside other 400-speed black-and-white films.
Searching for "Ilford" lights up a specific local neighbourhood, showing both exact matches and near-misses at a glance.
Walking around your own notes like this isn't the most practical feature for a production system, at least not by itself, yet for me it makes an otherwise dry concept feel immediate and tangible.
Under the bonnet
Embeddings: OpenAI’s
text-embedding-3-largemodel generates the vectors, shortened here from its 3072 default to 1536 dimensions.Similarity search: Cosine distance in pgvector, accelerated with approximate HNSW indexing and an adjustable slider to balance speed against recall accuracy.
Dimensionality reduction: Principal Component Analysis (PCA) projects the 1536-dimensional vectors down to 3D, paired with a coverage indicator showing how much variance the 3D projection retains.
Interface: A 3D scatter plot coloured by cluster, alongside a side panel listing the top matches and their similarity scores.
API: Straightforward endpoints for ingesting notes, generating embeddings, and running queries.
Learning by building with AI
Writing code with AI tools has completely changed how I pick up technical concepts. Working inside Cursor feels conversational, closing the gap between reading about a piece of theory and seeing how it behaves in practice. Because you can prototype in a couple of hours, you spend your energy poking at the actual data rather than wrestling with boilerplate.
A digital mind palace
I often use memory palaces when preparing for talks, anchoring ideas to physical locations I know well. This 3D map taps into the same spatial instinct:
Rooms as clusters: One corner holds "400-speed black-and-white film", while another holds "night street photography with my Leica."
Doorways as connections: Those amber lines trace the links from a query out to related ideas.
Anchors as dots: Dropping a query like "Ilford" gives you a concrete starting point for a mental walk through the archive.
For the way my memory works, flying around a 3D space for a few minutes plants the relationships in my head far better than staring at a table of numbers.
Building your own
You only really need a free evening and a decent cuppa to put something similar together:
Gather 500–1000 short notes on a subject you know inside out: recipes, running logs, customer feedback, guitar pedals, whatever suits.
Spin up a small Next.js app with a view for adding notes and a canvas for the 3D map.
Set up Supabase with pgvector to store and query the embeddings.
Stick to one consistent embedding model across both your stored notes and incoming search queries.
Project the vectors into 3D using PCA, adding a normalisation toggle and a variance coverage readout.
Render the points as a 3D scatter plot, colour-coded by cluster, wired up to a simple search input.
Get it running quickly and iterate from there.
If your notes are already sitting in a CSV, just add a simple batch endpoint to ingest the lot in one go.
A few lessons from the build
Seeing embeddings laid out spatially made the intuition click much faster for me.
Three-dimensional projections inevitably lose information, so trust the broad groupings rather than reading too much into exact screen distances.
Normalising vectors before running PCA often tightens up the clusters.
Putting the speed-versus-accuracy slider directly in the UI is genuinely handy for seeing how approximate search behaves.
Building something concrete beats reading ten explainer threads; get it working first, then intellectualise it.
Where I might take it next
Trying UMAP and t-SNE projections to see how different dimensionality-reduction methods change the clustering.
Supporting blended queries so you can search for notes "like these, but not those".
Using an LLM to generate readable summary labels for each cluster.
Swapping out my photography notes for interview notes to see if the map can help guide conversations dynamically.
If you think visually too, stop reading endless explainer threads on vector embeddings and spend an evening building your own 3D mind palace.