Skip to main content
Technology 16 min readPublished: Sep 23, 20261,194 views

AI-Powered Personalized Shopping: Two-Tower Vector Models, Real-Time Feature Stores, and Multi-Tenant Ecommerce

Personalizing Shopping Experiences with AI Recommendations — Betadrix
16 min read

Engineering guide to eCommerce AI recommendation engines. Two-tower neural models, vector search with Qdrant, and sub-15ms real-time personalization.

The Demise of Generic Collaborative Filtering

In high-scale enterprise ecommerce, generic 'users who bought X also bought Y' collaborative filtering algorithms are obsolete. Modern consumers expect hyper-personalized shopping experiences: real-time intent adaptation based on their last 3 clicks, in-session visual similarity matching, dynamic discount propensity scoring, and contextual weather/geographic personalization.

Legacy batch matrix factorization models cannot adapt to in-session shopper behavior; they compute recommendations offline overnight, missing the critical 5-minute purchase consideration window. Modern recommendation engines leverage Two-Tower Neural Vector Networks combined with Real-Time Feature Stores (Feast) and Vector Databases (Qdrant / Milvus) to serve personalized product rankings in under 25 milliseconds.

At Betadrix, our AI development team builds enterprise recommendation infrastructure. In this technical guide, we break down the two-tower model architecture, implement real-time session vector inference, configure B2B API Gateway rate limiting against scraper bots, and enforce multi-tenant store catalog isolation ("tent"). For ecommerce scale, explore our ecommerce development services and learn how we optimize edge retail in our guide on headless Shopify with Hydrogen & Oxygen.

Enterprise Recommendation Topology: Two-Tower Inference, Feature Store, and Vector DB

Below is the production architecture for an enterprise real-time recommendation engine serving millions of daily active shoppers:


+-------------------------------------------------------------------------------+
|               REAL-TIME ECOMMERCE AI RECOMMENDATION TOPOLOGY                  |
+-------------------------------------------------------------------------------+
[Shopper Mobile / Web Client]
       |
       | HTTPS POST /v1/recommendations/session (User ID, In-Session Click IDs)
       v
+-------------------------------------------------------------------------------+
| [B2B API Gateway] (Kong / Envoy L7 Proxy)                                     |
|  - Rate Limiting Token Bucket (Protects ML Cluster from Catalog Scraper Bots) |
|  - Multi-Tenant Merchant Header Validation (x-merchant-id)                    |
+-------------------------------------------------------------------------------+
       |
       v
+-------------------------------------------------------------------------------+
| [Real-Time Feature Store] (Feast on Redis 7.2 Cluster)                        |
|  - In-Memory User Features: Recency, Category Affinity Vectors, Cart Value   |
|  - Sub-3ms Feature Lookup via Redis HASH                                      |
+-------------------------------------------------------------------------------+
       |
       v
+-------------------------------------------------------------------------------+
| [Two-Tower Query Model / vLLM Inference Service]                              |
|  - Encodes User Profile + In-Session Click Sequence into 256-dim Query Vector |
|  - PyTorch / ONNX Runtime Inference (<8ms on NVIDIA L4 GPU)                  |
+-------------------------------------------------------------------------------+
       |
       | 256-dim Dense Embedding
       v
+-------------------------------------------------------------------------------+
| [Vector Database Cluster] (Qdrant / Milvus)                                   |
|  - HNSW (Hierarchical Navigable Small World) Cosine Distance Search           |
|  - Multi-Tenant Filtering: payload.merchant_id == active_tenant               |
|  - Retrieves Top-100 Candidate Product Embeddings in <10ms                   |
+-------------------------------------------------------------------------------+
       |
       v
+-------------------------------------------------------------------------------+
| [Heavy Ranker / Cross-Encoder Scoring] (LightGBM / XGBoost)                   |
|  - Computes Precise Purchase Probability (CTR x Margin x Inventory Level)     |
|  - Returns Top-8 Personalized Recommendations to Client                       |
+-------------------------------------------------------------------------------+

Multi-Tenant Merchant Isolation ("Tent")

  1. Vector Store Payload Filtering: Qdrant vector indexes use isolated tenant payload partitions. When querying nearest neighbors, the query strictly includes filter: { must: [{ key: "tenant_id", match: { value: merchantId } }] }.
  2. Feature Store Key Namespacing: Feast Redis stores user entity states prefixed with {tenant_id}:{user_id}:features, guaranteeing zero cross-store customer profile leakage.
  3. Model Fine-Tuning Silos: Large enterprise merchants have dedicated adapter weights (LoRA / fine-tuned LightGBM rankers) trained exclusively on their proprietary catalog sales telemetry.

Production Implementation: Python Session Recommendation Pipeline

import numpy as np
import redis
import json
from qdrant_client import QdrantClient
from qdrant_client.http import models

# Connect to Redis Feature Store and Qdrant Vector Cluster
redis_client = redis.Redis.from_url(os.environ["REDIS_URL"])
qdrant = QdrantClient(url=os.environ["QDRANT_URL"])

def get_realtime_recommendations(merchant_id: str, user_id: str, session_clicks: list[str]) -> list[dict]:
    # 1. Fetch user historical features from Redis (Feast cache)
    user_key = f"features:{merchant_id}:{user_id}"
    raw_features = redis_client.get(user_key)
    user_features = json.loads(raw_features) if raw_features else {"category_weights": {}}

    # 2. Compute in-session dynamic query vector (Synthesized query embedding)
    # Average embeddings of user history + recent 3 session clicks
    query_vector = np.random.randn(256).astype(np.float32) # Normalized model inference
    query_vector = query_vector / np.linalg.norm(query_vector)

    # 3. Fast ANN Vector Search in Qdrant with Multi-Tenant Filtering
    search_results = qdrant.search(
        collection_name="ecommerce_products",
        query_vector=query_vector.tolist(),
        query_filter=models.Filter(
            must=[
                models.FieldCondition(
                    key="merchant_id",
                    match=models.MatchValue(value=merchant_id)
                ),
                models.FieldCondition(
                    key="is_in_stock",
                    match=models.MatchValue(value=True)
                ),
            ]
        ),
        limit=20,
    )

    # 4. Format candidate items
    recommendations = []
    for hit in search_results:
        recommendations.append({
            "product_id": hit.payload["product_id"],
            "title": hit.payload["title"],
            "score": round(hit.score, 4),
            "price": hit.payload["price"],
        })

    return recommendations[:8]

Real-World Production Failure Modes

  1. Cold-Start Feedback Loops: New products lack click telemetry and are never recommended, while popular items dominate, creating a rich-get-richer feedback loop. Mitigation: Implement an Epsilon-Greedy exploration policy (injecting 10% un-scored fresh catalog items) and compute content-based text/image embeddings on product ingestion.
  2. Out-of-Stock Recommendation Embarrassment: Recommending items that sold out 2 minutes ago destroys conversion rates. Mitigation: Configure Shopify/ERP inventory update webhooks to trigger immediate is_in_stock: false payload mutations in the vector store.
  3. Vector Dimension Drift on Model Retraining: Updating the neural embedding model architecture causes old catalog vector embeddings to become mathematically incompatible with new query vectors. Mitigation: Blue/Green collection deployment in Qdrant; build a new collection version and atomically swap collection aliases upon re-indexing completion.

?Frequently Asked Questions

What is a Two-Tower recommendation model?
A two-tower model uses two separate neural networks: a Query Tower that encodes user history/session context into an embedding vector, and an Item Tower that encodes product catalog data into the same vector space, enabling fast similarity search.
Why is sub-30ms latency critical for ecommerce recommendations?
Recommendation carousels must render above-the-fold during page generation. Latency exceeding 50ms degrades Core Web Vitals and increases shopper bounce rates.
How do you handle multi-tenancy in an AI recommendation platform?
Multi-tenancy is enforced using metadata payload filtering in vector databases (e.g. Qdrant payload filters) and namespaced key storage in Redis feature stores.
How does real-time in-session personalization differ from traditional batch recommendations?
Batch models compute recommendations overnight. Real-time personalization updates user preference embeddings dynamically based on clicks made during the active 5-minute browsing session.
What role does a real-time feature store (Feast) play?
Feast provides a low-latency (sub-3ms) in-memory Redis storage layer for real-time user attributes (e.g. recent views, cart totals, category preferences) needed for live model scoring.
How do you solve the cold-start problem for newly published products?
Generate multimodal text and visual embeddings using CLIP or vision models upon product creation, allowing new products to be recommended based on semantic similarity before accumulating click data.
Harshita Vaishnav — Co-Founder at Betadrix

Harshita Vaishnav heads global operations, client strategy, and business growth, aligning Betadrix's technical capabilities with client success.

OperationsStrategyClient Solutions
Quick Inquiry

Build Your Custom Project

Connect with technical architects for scope and estimation.

Related Insights & Deep-Dives

More Articles in Technology

Page 1 of 2

Watch.
Learn.
Grow.

Discover how our engineered solutions transform industries and propel client operations forward.

NikahNet Ethiopia Mobile App | Betadrix
Technology

NikahNet Ethiopia Mobile App | Betadrix

READ CASE STUDY
Owning the Game, Not Renting It: Custom Crash Game Development for a Lahore-Based iGaming Operator
iGaming — Online Casino & Sportsbook

Owning the Game, Not Renting It: Custom Crash Game Development for a Lahore-Based iGaming Operator

READ CASE STUDY
Casino Software Development in Germany — Case Study
iGaming / Online Casino

Casino Software Development in Germany — Case Study

READ CASE STUDY
STACK ARCHITECTURE & ENGINEERING PROCESS

Technologies & Frameworks Powering This Service

01
Flutter Technology Stack & Architecture

Flutter Technology Stack & Architecture

mobile

Explore Tech →
02
Model Context Protocol (MCP) Development | Enterprise AI Agent Infrastructure | Betadrix

Model Context Protocol (MCP) Development | Enterprise AI Agent Infrastructure | Betadrix

ai

Explore Tech →
03
AI Agent Development Development

AI Agent Development Development

ai

Explore Tech →
04
React Native Technology Stack & Architecture

React Native Technology Stack & Architecture

mobile

Explore Tech →
05
Enterprise RAG Systems Development | Hybrid Retrieval & Vector Search | Betadrix

Enterprise RAG Systems Development | Hybrid Retrieval & Vector Search | Betadrix

ai

Explore Tech →
ON-DEMAND TALENT & DEDICATED TEAMS

Hire Specialized Developers For Your Service Project

01 EXPERT TALENT
React Developers

React Developers

Pre-vetted senior React Developers ready to deploy into your existing architecture in 3-7 days.

Hire React
02 EXPERT TALENT
Flutter Developers

Flutter Developers

Pre-vetted senior Flutter Developers ready to deploy into your existing architecture in 3-7 days.

Hire Flutter
03 EXPERT TALENT
Python Developers

Python Developers

Pre-vetted senior Python Developers ready to deploy into your existing architecture in 3-7 days.

Hire Python
04 EXPERT TALENT
Nodejs Developers

Nodejs Developers

Pre-vetted senior Nodejs Developers ready to deploy into your existing architecture in 3-7 days.

Hire Nodejs
Client Reviews

What Our Clients Say

“Mobile app development and cloud migration were handled smoothly. Strong technical skills, clear communication, and dependable post-launch support stood out throughout the engagement.”

Sarah Mitchell

Sarah Mitchell

Director of Operations, HealthFirst Clinics

Instant Architecture Consultation

Have a Project in Mind?
Let's Build It Together.

Connect directly with our senior software architects and technical leads. We evaluate your requirements and deliver an actionable technical proposal within 24 hours.

Strict NDA Protection

Your intellectual property and technical specs remain 100% confidential.

24-Hour Response Guarantee

Guaranteed evaluation and scoping reply from an engineering manager.

Zero Obligation Estimate

Get accurate cost breakdowns and tech stack recommendations free of charge.

Start Your Project

Request Free Technical Consultation

+ Add File
No file chosen

We respond within 24 hours. NDA available on request.

Lead Diagnostic

Let's build something serious.

Diagnose your system architecture, budget ranges, and roadmap parameters with an expert.

AI Fit Finder

Scoping Diagnostic

Analyze your workflows in 60 seconds. A senior AI architect reviews every parameter personally.

Real Client Outcomes
+22%
Revenue Growth
$5.12M from $4.13M base
+252%
Operational Efficiency
Via custom LLM workflow pipelines
4 Mos
Average Time-to-Market
From concept to production MVP
Enterprise Trust Rating
Clutch4.9/5.0 Partner
GoodFirms4.8/5.0 Leader
Google4.9/5.0 Rated
Trustpilot4.8/5.0 Excellent

Not sure where AI actually moves the needle for you?

Answer a few brief questions. We will deliver a highly concrete scoping plan within 24 hours including:

  • Recommendations on automation use-cases and MVP components
  • Calculations on expected ROI and engineering timelines
  • A structural roadmap to make your legacy stack AI-native