Hybrid Recommendation System


“This project wasn’t just about building a recommender. It was about making user engagement meaningful — blending machine learning, scalable architecture, and real-time analytics to surface what truly matters.”

This case study walks through my approach to designing, developing, and deploying a production-grade Hybrid Recommendation System that powers personalized content delivery using text, image, and interaction signals.


Backstory

Ever since I realized how hooked I was to platforms like Instagram, Pinterest, and Reddit, I started asking myself why. What was it that kept pulling me back? The answer: relevance. The posts that showed up were eerily well-aligned with my preferences. Sometimes they looked like the ones I liked, sometimes they were liked by people I follow — and sometimes, both.

That’s when I dove into the world of recommendation engines.

There are three core types:

  1. Content-Based Filtering
  2. Collaborative Filtering
  3. Hybrid Systems

Most tutorials on the internet walk through movie or music recommendations. But I wanted to go deeper — to simulate a social media recommendation system.

So, I curated and cleaned datasets mimicking real-world post interactions. Posts, users, likes — all injected into MongoDB with realistic object IDs. My goal was to replicate how Instagram or Pinterest might structure their backend — just at a smaller scale.


Architecture Overview

ML Pipeline Components

🔍 1. Content-Based Recommendations

This strategy focuses on the content itself — posts that are textually and visually similar to what a user has already liked.

Why is this important? Because human attention is drawn to familiarity — we gravitate toward content that matches our interests and past behavior.

🔧 Implementation Details:

This allowed us to recommend posts that looked and read like what the user already enjoyed — even if no one else had liked them.


🤝 2. Collaborative Filtering

This approach leverages implicit interactions — likes — to map behavioral similarity between users and posts.

Psychologically, it taps into social proof — what others like you enjoy.

🔧 Implementation Details:

We use joblib to persist model (cf_model.pkl) and MLflow to track metrics, parameters, and artifacts.


🔀 3. Hybrid Recommendation System

This combines the semantic richness of content-based embeddings with the behavioral accuracy of collaborative filtering.

🔧 Fusion Formula:
📉 Why Weighted Fusion?

Production-Ready API with FastAPI

Initially, I used Flask — but as the project grew, I migrated to FastAPI for:

I built endpoints like:

Performance Bottlenecks & Fixes

When I tested the system, the initial API responses were 30–40 seconds. Not acceptable.

Here’s what I did:

Current average response time? Under 5 seconds — even with image and text embeddings running in-memory.

Total dataset: 132 users, 481 posts, 1.5K likes

This is still a small dataset. The next version will focus on large-scale, distributed computation, perhaps with Faiss, Redis caching, and batch inference pipelines.


Frontend: Designed for Clarity

Built using:

UX Flow:

  1. User List Page → All users shown (paginated)

  2. Click a user → Navigate to UserDetail

  3. Tabs show:

    • Liked Posts
    • Content-Based
    • Collaborative
    • Hybrid

Each tab shows paginated results and uses loading states with MUI CircularProgress.

View the Frontend Code → src/pages/UserDetail.jsx


Final Summary Table

Recommendation TypeMethodModel UsedSource DataPaginationExplainability
Liked PostsQuery by user_idMongo AggregatesLikes Collection
Content-BasedCosine + EmbeddingsMiniLM + ResNetPosts Collection
CollaborativeSVDSurpriseinteractions.csv❌ (cached)
HybridWeighted ScoringFusionMerged from above

What I Learned

This project made me fall in love with ML engineering — not just the models, but the plumbing:

It taught me the math behind relevance — and how good engineering makes AI actually usable.


What’s Next?


GitHub Repo → hybrid-recommendation-system

Want a system like this built for your team? Reach out → rishwanth.perumandla@hotmail.com

RIPE

© 2025 Rishwanth Perumandla

LinkedIn Twitter GitHub YouTube Instagram