---
title: "Search and Personalization with Vision Embeddings"
description: "Understand vision embeddings, similarity search, and MongoDB Atlas Vector Search with practical patterns for search, filters, and recommendations."
url: https://lidvizion.ai/blog/search-and-personalization-with-vision-embeddings/
site: Lid Vizion
index: https://lidvizion.ai/llms.txt
---

[Insights](https://lidvizion.ai/blogs/) Product Updates & Releases 7 min read 2025-09-22

# Search and Personalization with Vision Embeddings

Understand vision embeddings, similarity search, and MongoDB Atlas Vector Search with practical patterns for search, filters, and recommendations.

By [Lamar Giggetts](https://lidvizion.ai/author/lamar-giggetts/) [Product Updates & Releases](https://lidvizion.ai/blog-categories/product-updates-releases/)

Tags: [AWS S3](https://lidvizion.ai/tags/aws-s3/), [MongoDB](https://lidvizion.ai/tags/mongodb/)

![Search and Personalization with Vision Embeddings](https://rcicvvtcawdbfiuzwexb.supabase.co/storage/v1/object/public/webflow-media/webflow/media/cms/68cdf75087ed8697654fc18a/search-and-personalization-with-vision-embeddings.png)

## Understanding Vision Embeddings for Search

Vision embeddings are dense numerical vectors that encode the content and semantics of an image. They allow image content to be represented in a way that a computer can compare for similarity. In an embedding space, images with similar content will have vectors that are close together (by cosine or Euclidean distance), enabling content-based image retrieval. For example, [**OpenAI’s CLIP**](https://www.pinecone.io/learn/series/image-search/clip/) encodes images (and text) into 512-dimensional vectors, placing semantically similar images near each other in the vector space. Other popular vision models yield embeddings in the range of ~128 to 2048 dimensions; a [**ResNet-50**](https://keras.io/api/applications/resnet/) backbone typically produces a 2048-length feature vector (after global average pooling). Many transformer-based models like ViT use hidden sizes of [**768 (ViT-Base)**](https://huggingface.co/docs/transformers/model_doc/vit) or [**1024 (ViT-Large)**](https://huggingface.co/google/vit-large-patch16-224), and OpenCLIP families include even larger variants [**with 1024-d embeddings**](https://arxiv.org/pdf/2212.07143).

Computing image embeddings is usually done by feeding images through a pre-trained model and taking the output of a latent layer. For example, with [**CLIP**](https://openai.com/index/clip/) you’d load the model, preprocess the image to 224×224, encode with the image encoder, and (optionally) L2-normalize the vector for cosine similarity. Because CLIP maps **images and text into the same space**, you can also search images using text queries by encoding the text to a vector with CLIP’s text encoder. ([OpenAI](https://openai.com/index/clip/), [Pinecone](https://www.pinecone.io/learn/series/image-search/clip/))

Typical similarity metrics include cosine similarity, Euclidean (L2) distance, or dot product. The best choice depends on the model and whether you normalize vectors. MongoDB’s index configuration explicitly supports [**cosine, euclidean, and dotProduct**](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/), with guidance on when cosine and dotProduct behave equivalently after normalization. ([MongoDB](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/))

## Storing Embeddings in MongoDB Atlas for Similarity Search

[**MongoDB Atlas Vector Search**](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/) lets you keep image metadata and embedding vectors together. You define an Atlas Vector Search index on your embedding field (array of numbers), specify the **dimensions (up to 4096)** and the similarity metric, and query with the [**$vectorSearch**](https://www.mongodb.com/docs/manual/reference/operator/aggregation/vectorSearch/) stage. Atlas supports both **approximate (HNSW) and exact** nearest-neighbor modes and returns a normalized relevance score. ([MongoDB](https://www.mongodb.com/docs/manual/reference/operator/aggregation/vectorSearch/))

Filtering and hybrid search are first-class: you can **pre-filter** by fields like category, user_id, or dates within the [**$vectorSearch filter**](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/), and you can **combine text + vector** results with [**$rankFusion (hybrid search)**](https://www.mongodb.com/docs/atlas/atlas-vector-search/hybrid-search/) to produce a single ranked list. ([MongoDB](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/))

Note: Atlas’ current dimension limit is [**4096**](https://www.mongodb.com/products/platform/atlas-vector-search); size your vectors and index settings accordingly. ([MongoDB](https://www.mongodb.com/products/platform/atlas-vector-search))

## Alternatives and a Quick Comparison

- **MongoDB Atlas Vector Search** – integrated document DB + vector search in one place; hybrid queries and filters alongside vector similarity. Good fit if you already run MongoDB or need multi-modal/hybrid search. [**Overview**](https://www.mongodb.com/products/platform/atlas-vector-search). ([MongoDB](https://www.mongodb.com/products/platform/atlas-vector-search))
- **Pinecone** – fully managed, serverless vector database focused on high-performance similarity search; simple API and easy scaling for large vector sets. [**Product**](https://www.pinecone.io/) · [**What is a vector DB?**](https://www.pinecone.io/learn/vector-database/). ([Pinecone](https://www.pinecone.io/))
- **pgvector (Postgres)** – open-source [**extension for Postgres**](https://github.com/pgvector/pgvector) that adds vector types and indexes (supports cosine, L2, dot/inner product, etc.). Great if you prefer SQL/ACID and already use Postgres. ([GitHub](https://github.com/pgvector/pgvector))

## Building a React Front-End for “Search by Image”

On the client, let users supply a file via `<input type="file">` or drag-and-drop. Show a preview, upload to your API, and do the heavy lifting server-side: generate the embedding, run **$vectorSearch** in Atlas, and return the top-K results with thumbnails and metadata. Keep UX tight with progress indicators and guardrails (file type/size checks, clear errors, fallbacks for mobile). The UI is backend-agnostic as long as your API contract stays “send image → receive similar items”.

## Combining Embeddings and Metadata for Contextual Recommendations

Boost relevance by blending **vector similarity + metadata filters** (e.g., category, in_stock, price range) directly in Atlas via [**$vectorSearch filter**](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/). For personalization, incorporate user signals in two ways:

- **Profile/history filters or boosts** (e.g., prefer “outdoor” images for an outdoor-heavy user).
- **Re-ranking with a user embedding** (weighted combination of query-to-item and user-to-item similarity). Industry teams report strong wins using embedding-based retrieval and personalization; see [**Walmart’s write-up on personalized search**](https://medium.com/walmartglobaltech/personalization-for-search-cd4ecc68db8c) and their more recent [**embedding-based retrieval work**](https://arxiv.org/html/2408.04884v1). ([Medium](https://medium.com/walmartglobaltech/personalization-for-search-cd4ecc68db8c), [arXiv](https://arxiv.org/html/2408.04884v1))

You can also fuse signals with **hybrid search**—for example, combine vector similarity with keyword match using [**$rankFusion**](https://www.mongodb.com/docs/atlas/atlas-vector-search/hybrid-search/vector-search-with-full-text-search/) so items that score well on both rise to the top. Tools like [**FiftyOne’s MongoDB integration**](https://docs.voxel51.com/integrations/mongodb.html) make it easy to inspect results and iterate on dataset slices before production. ([MongoDB](https://www.mongodb.com/docs/atlas/atlas-vector-search/hybrid-search/vector-search-with-full-text-search/), [docs.voxel51.com](https://docs.voxel51.com/integrations/mongodb.html))

[PreviousAWS Textract vs Open Source OCR for Production Doc AI (Accuracy, Cost, and Architecture)](https://lidvizion.ai/blog/aws-textract-vs-open-source-ocr-for-production-doc-ai/) · [NextMonitoring, Logging, and Analytics for Vision Systems](https://lidvizion.ai/blog/monitoring-logging-and-analytics-for-vision-systems/)

Keep reading

## Related insights.

- [Monitoring, Logging, and Analytics for Vision Systems](https://lidvizion.ai/blog/monitoring-logging-and-analytics-for-vision-systems/): Modern computer-vision workflows often involve multiple specialized agents (image classifiers, annotation tools, QA reviewers, billing trackers) working together. An LLM-based orchestrator can plan and route tasks across these agents (think cognitive orchestration) where the “master agent” uses…
- [Your Best AI Prompt Shouldn’t Live in One Employee’s Chat History](https://lidvizion.ai/blog/your-best-ai-prompt-shouldnt-live-in-one-employees-chat-history/): The next stage of AI adoption is turning individual prompts and workarounds into shared, governed workflows the whole company can use.

## Where does your workflow get stuck?

[Discuss the workflow](https://lidvizion.ai/contact/) · [Book a call](https://lidvizion.ai/contact/#write)
