# Building a Movie Recommendation Engine with Hugging Face and Voyage AI

[MongoDB](https://yomu.fyi/company/mongodb) · Arek Borucki · Feb 17, 2026

**Type:** Tutorial

## Summary

Traditional movie search mechanisms depend on coarse filters such as genre, actor, or title, which fail to capture emotional context and narrative nuances. This guide demonstrates building a mood-based semantic recommendation system by combining the voyage-4-nano open-weights embedding model, Hugging Face datasets, and MongoDB Atlas Vector Search. The architecture uses Sentence Transformers to generate embeddings and exposes an endpoint through FastAPI to match user moods against movie plots. Truncating the Matryoshka embeddings from 2048 to 1024 dimensions balances semantic retrieval quality, storage footprint, and query latency. Testing shows that while abstract emotional queries return moderate similarity scores around 0.62 to 0.67, concrete descriptive queries exceed 0.75 without requiring exact keyword matches.

## Context

Traditional movie search relies on coarse metadata filtering like genres, actors, or titles, which cannot capture nuanced emotional states or abstract intents such as searching for an uplifting or cathartic film.

## Approach / What changed

The implementation deploys the open-weight voyage-4-nano embedding model using Sentence Transformers, indexes over 1500 movie plot summaries from Hugging Face into MongoDB Atlas Vector Search, and serves semantic search via a FastAPI application using 1024-dimension Matryoshka embeddings.

## Takeaways

- The voyage-4-nano model uses asymmetric encoding prompts to improve retrieval quality by distinguishing between query representations and document representations.
- Matryoshka embeddings allow truncating vector dimensions from 2048 to 1024 or 512, balancing storage overhead and search latency while preserving ranking stability.
- Concrete descriptive mood queries achieve higher semantic similarity scores (0.75+) compared to abstract emotional concepts (0.62 to 0.67).

**Tags:** [Machine Learning](https://yomu.fyi/topic/machine-learning), [Open Source](https://yomu.fyi/topic/open-source), [Python](https://yomu.fyi/topic/python), [Recommendation Systems](https://yomu.fyi/topic/recommendation-systems), [Search](https://yomu.fyi/topic/search)

[Read original post](https://www.mongodb.com/company/blog/technical/building-a-movie-recommendation-engine-with-hugging-face-and-voyage-ai)
