Data Product β€’ ML Engineering β€’ Data Science

Building an Intelligent Book Recommendation System

A deep dive into the complete lifecycle of a data product: from data ingestion and embedding generation to serving real-time ML recommendations with Django, PyTorch, and FAISS.

The book catalog used in this project was built from the Best Books 10k Multi-Genre Data dataset, available on Kaggle.

15k+
Books
2688
Embedding Dimensions
2
Recommendation Approaches
πŸ€–
AI Assistant
Profile
πŸ“š

Hi, I'm Eduardo Sousa

I'm a Data & AI Engineer focused on building production-ready systems that turn machine learning into real-world applications. With a bachelor’s and a master’s degree in Mechanical Engineering, I developed a strong foundation in mathematical modeling and system dynamics, which shaped my analytical and problem-solving mindset. Today, I design data-driven solutions that help businesses solve complex problems, optimize processes, and transform data into scalable products that deliver real value.

Data Scientist Data & AI Solutions Engineer ML/AI
🎯

Beyond CRUD: Building a True Data Product

Most applications simply store and retrieve data. Smart Library was built to answer a different question: what if your application could understand the content it hosts? What if it could learn relationships between books, understand user preferences, and make intelligent recommendations - all in real-time?

This project explores the complete data product lifecycle: from raw book data to semantic embeddings, from FAISS similarity search to fine-tuned PyTorch models, and finally to a conversational AI that can discuss books naturally. Every component was built with production readiness in mind.

🧠 The ML Architecture: Dual Recommendation System

1 2688-Dimensional Embeddings

Each book is represented by concatenating 7 different 384-dimensional embeddings:

πŸ“– Title
✍️ Author
πŸ“ Description
🏷️ Main Genre
πŸ“š All Genres
πŸ‘₯ Characters
πŸ”„ Title + Author + Genre

2 Two Approaches, One Goal

Baseline: FAISS IndexFlatIP

Quick semantic similarity using raw 2688d embeddings with cosine similarity

Improved: PyTorch Fine-tuned

Contrastive learning reduces to 256d while capturing deeper patterns

2688 β†’ 1536 β†’ 1024 β†’ 512 β†’ 256

Training: Contrastive Learning

+
Positive Pairs

Books from same genre pulled closer

βˆ’
Negative Pairs

Different genres pushed apart

πŸ€– Smart Library Agent: Conversational AI

πŸ—£οΈ

Natural Language

Ask about books, authors, genres in plain English or Portuguese

πŸ’Ύ

Contextual Memory

Maintains conversation context across sessions

⚑

Real-time Streaming

Typing indicators and streaming responses for better UX

chat Try asking the agent:
"Tell me about Harry Potter" "Books like The Hobbit" "Recommend fantasy books" "Compare Dune and Foundation"
memory Backend: Flask microservice

βš™οΈ MLOps: From Data to Production

πŸ“„
CSV Export
β†’
πŸ”§
Embedding Generation
β†’
☁️
GCP Storage
β†’
🎯
FAISS Index
cloud_upload Automated CSV exports
sync Django signals auto-update
history Versioned knowledge bases

πŸ› οΈ Technology Stack

Django PyTorch FAISS Sentence Transformers Google Cloud Storage Flask Tailwind CSS PostgreSQL Redis NumPy Pandas Celery

πŸŽ“ Key Learnings & Challenges

πŸ”·

Embedding Generation Pipeline

Building a robust system to generate and store 2688-dimensional embeddings for thousands of books, with automatic GCP integration

πŸ”Ά

Dual Approach Architecture

Implementing and comparing two recommendation strategies (FAISS baseline vs PyTorch fine-tuned) to understand trade-offs

πŸ”·

Real-time Updates

Creating Django signals that automatically generate embeddings for new books and keep the FAISS index synchronized

πŸ”Ά

MLOps Fundamentals

Versioning knowledge bases, managing model files, and creating admin interfaces for ML system management

πŸš€ What's Next?

πŸ“Š A/B testing for recommendation approaches
πŸ‘₯ Collaborative filtering with user patterns
πŸš€ Model serving with TorchServe
πŸ“ˆ Real-time analytics dashboard