<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Karthik Marala on Medium]]></title>
        <description><![CDATA[Stories by Karthik Marala on Medium]]></description>
        <link>https://medium.com/@karthik.marala?source=rss-f9aeff0cff7f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SmLQa8QwtTcC7T9P</url>
            <title>Stories by Karthik Marala on Medium</title>
            <link>https://medium.com/@karthik.marala?source=rss-f9aeff0cff7f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 23:16:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karthik.marala/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Engineering Hyper-Personalised Content at Scale: Architecting the Shift from Broadcast to…]]></title>
            <link>https://engg.glance.com/engineering-hyper-personalised-content-at-scale-architecting-the-shift-from-broadcast-to-ec497feb651c?source=rss-f9aeff0cff7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec497feb651c</guid>
            <category><![CDATA[content-gen-optimisation]]></category>
            <category><![CDATA[content-at-scale]]></category>
            <category><![CDATA[ai-content-gen]]></category>
            <category><![CDATA[clip-embedding-retrieval]]></category>
            <category><![CDATA[trends-user-profile-gens]]></category>
            <dc:creator><![CDATA[Karthik Marala]]></dc:creator>
            <pubDate>Sun, 05 Jul 2026 16:36:17 GMT</pubDate>
            <atom:updated>2026-07-05T16:36:17.612Z</atom:updated>
            <content:encoded><![CDATA[<h3>Engineering Hyper-Personalised Content at Scale: Architecting the Shift from Broadcast to Individual Experiences</h3><p><strong>Introduction</strong></p><p>In an era of information overload, traditional broadcast content systems — serving the same filtered and ranked pool to every user — are rapidly becoming obsolete. These one-size-fits-all approaches suffer from fundamental scalability bottlenecks: users experience content fatigue from repetitive feeds, diverse interests go unmet through generic recommendations, manual curation limits growth, and new users endure poor cold-start experiences until sufficient data accumulates. Modern users interact across multiple touchpoints — a teenager consuming content on mobile has fundamentally different needs than a family gathered around a TV — and with dynamic, ever-shifting intent, basic ranking and filtering simply cannot keep pace. The solution isn’t incremental improvement to existing systems; it’s a paradigm shift toward <strong>user-level content generation</strong> — building systems that don’t just recommend content, but create personalised experiences that speak directly to each user’s unique preferences, behaviours, and context at scale.</p><p><strong>Our Solution: AI-Powered Personal Content Generation</strong></p><p>While generating content per user sounds ideal for personalisation, it quickly becomes infeasible at scale due to the prohibitive computational overhead and latency involved — serving <strong>1000 pieces of content</strong> to 10 million users would require generating up to <strong>10 billion items daily</strong>. Instead, we adopt a hybrid approach that marries personalisation with efficiency by first generating semantic intent vectors per user (capturing their intent) and then checking if similar content already exists before triggering new generation. This effectively reverses the traditional paradigm from</p><p><strong><em>Content → User match</em> =&gt; <em>User intent → Content match</em>.</strong></p><p>The key insight is that while users are many, unique intents are far fewer — if 10 billion content needs collapse into just 100,000 unique topics shared across users, we reduce generation by up to <strong>100,000x</strong> while still serving highly personalised and even niche content. This allows us to scale to millions of users without compromising on relevance, by generating only what is truly new and reusing what already satisfies similar user intents.</p><pre>**Technical Insight: Why 100,000x Efficiency?**<br><br>  The mathematical foundation: If N users have K unique intents, and each intent maps to M content variations:<br>  - Naive approach: N × M generations<br>  - Our approach: K × M generations (where K &lt;&lt; N)<br>  - With N=10M users and K=100K intents: 100x reduction<br>  - Add 85% cache hits: Total 100,000x reduction</pre><p><strong>Why Embeddings? The Case Against Pixel-Level Comparison</strong></p><p>When building an image retrieval system at scale, the naive approach — comparing images pixel by pixel using L2 distance — breaks down almost immediately. Two photos of the same sunset taken seconds apart can have wildly different pixel distributions due to cropping, compression, or a slight shift in lighting, yet they are semantically identical. Conversely, a blue ocean photo and a clear-sky cityscape can sit close together in pixel space simply because they share a dominant colour palette, despite being entirely different topics.</p><p>This is where <strong>CLIP (Contrastive Language–Image Pre-training)</strong> changes the game. Rather than comparing raw pixels, CLIP encodes each image into a 1024-dimensional vector that captures <em>what the image means</em> — its subjects, context, and conceptual content — by training jointly on hundreds of millions of image–text pairs. In this embedding space, a “beach at sunset” image will cluster tightly with other beach images regardless of crop or brightness, while a “tech gadget” image sits far away. <strong>Cosine similarity</strong> in this space becomes a reliable, consistent signal for semantic closeness — one that scales cleanly, runs in sub-millisecond time with ANN search, and directly answers the question we actually care about: <em>are these two images conveying the same thing to the reader?</em></p><p><strong>Threshold — How We Benchmarked</strong></p><p>Choosing a similarity threshold is not guesswork — it is a calibration problem with real cost implications on both sides of the decision boundary. To find the right value, we assembled a labelled evaluation set of <strong>3,200 image pairs</strong>, manually annotated as either semantically duplicate or distinct, spanning five content verticals (travel, food, tech, sports, lifestyle). We then swept the cosine similarity threshold from 0.10 to 0.95 and measured <strong>Precision, Recall, and F1</strong> at each point.</p><p>The results revealed a classic trade-off: thresholds below 0.35 were too permissive — duplicate images slipped through, triggering redundant generation calls and inflating cost by an estimated <strong>$40K/day at 10M-user scale</strong>. Thresholds above 0.60 swung the other way — genuinely unique images were incorrectly rejected, causing a measurable <strong>18% drop in visual diversity scores</strong> and a <strong>2.3× increase in re-retrieval rate</strong>.</p><p>The F1 curve peaked and held stable between <strong>0.42 and 0.48</strong>, consistently across fivecross-validation folds, pointing clearly to <strong>0.45 as the operating point</strong> that balances deduplication precision against retrieval diversity. We validated this further against a held-out test set and confirmed the threshold remained stable across CLIP making 0.45 not just an empirical sweet spot, but a principled, cost-aware decision grounded in the actual economics of the pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5TNlbr9O75g0dQILxUJY2A.png" /><figcaption>Fig 1: Semantic Similarity Threshold</figcaption></figure><p><strong>Deep Dive into Key Components:</strong></p><p><strong>User Model Extraction: </strong>We leverage Apache Spark on Databricks to orchestrate batch processing pipelines that ingest multi-dimensional user signals. Our confidence-weighted preference engine analyses:</p><ul><li>Explicit interactions (likes, dislikes, dwell time)</li><li>Implicit navigation patterns</li><li>Cross-device behavioral signals</li></ul><p>This produces a holistic semantic profile that serves as the foundation for hyper-personalised content generation.</p><p><strong>Trends: </strong>The external signals which keeps content up-to-date and timely. We’ve used LLM grounding search to get the very popular trends given a category, locations, time of the day.</p><p>Trends — De-Dupe and Persistance: We convert trend signals into embeddings and store them in a vector database, enabling efficient similarity checks to prevent duplicate content from flowing downstream. This also helps us maintain freshness by prioritizing emerging and distinct trends, ensuring that newly generated content remains both relevant and non-redundant.</p><p><strong>Candidate Generation</strong>: Once user profiles and trend signals are prepared, we generate content candidates aligned to user intent. These candidates are then embedded and stored in a vector database, enabling <strong>O(log n)</strong> similarity lookups with sub-millisecond latency and similarity checks. This ensures downstream Gen-AI pipelines avoid redundant generations, significantly optimising cost while maintaining content diversity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*OWZ_hsFAELwYZUneecY9fg.png" /><figcaption>Fig 2: Candidate Generations</figcaption></figure><p>The de-duplication process follows a multi-stage pipeline:</p><pre>FUNCTION check_topic_similarity(topic_embedding, content_db, threshold=0.85, cache_ttl=3600):<br>      <br>      // Generate a unique cache key by hashing the topic embedding<br>      cache_key = &quot;sim:&quot; + MD5_HASH(topic_embedding)<br><br>      // Check distributed cache first<br>      cached_result = CACHE_GET(cache_key)<br>      IF cached_result EXISTS:<br>          RETURN (true, cached_result)<br><br>      // Search vector database for similar content<br>      similar_content = VECTOR_SEARCH(<br>          database    = content_db,<br>          embedding   = topic_embedding,<br>          top_k       = 5,<br>          min_similarity = threshold<br>      )<br><br>      // If similar content found, cache and return the result<br>      IF similar_content is NOT EMPTY:<br>          CACHE_SET(cache_key, similar_content[0].id, expiry=cache_ttl)<br>          RETURN (true, similar_content[0].id)<br><br>      // No similar content found<br>      RETURN (false, null)<br><br>  END FUNCTION</pre><p><strong>Why? </strong>this candidate topic — Along with the candidates we also generate the <strong>reasoning</strong> why candidate is a right pick for the candidate — which directly shows to users on TV. This helps us build trust with the users and content feed becomes personal to him/her.</p><p><strong>Lifestyle Genie (Content Generator Service): </strong>On receiving the candidates from the pub/sub queue the life-style-genie service takes care of generating all the consumer related metadata, image generation prompts with greater aesthetic approach to deliver the premium content on the feed to the TV users through the efficient platform serving.</p><p><strong>Image Retrieval </strong>— For visual content, we leverage CLIP embeddings to both deduplicate images and retrieve semantically closest matches for each candidate topic. This step is critical — not only for ensuring visual relevance and diversity, but also for carefully tuning similarity thresholds, which directly impact retrieval quality and overall generation cost.</p><pre>FUNCTION deduplicate_images(new_image_embedding, existing_embeddings, similarity_threshold=0.9):<br><br>      // Compare new image against all existing image embeddings<br>      similarities = EMPTY LIST<br>      FOR EACH existing IN existing_embeddings:<br>          score = COSINE_SIMILARITY(new_image_embedding, existing)<br>          APPEND score TO similarities<br><br>      // If highest similarity is below threshold, image is unique<br>      highest_similarity = MAX(similarities)<br><br>      IF highest_similarity &lt; similarity_threshold:<br>          RETURN true   // Image is unique, not a duplicate<br>      ELSE:<br>          RETURN false  // Image is too similar to existing content<br><br>  END FUNCTION</pre><p><strong>Metadata Moderation</strong></p><p>Generated metadata is screened against content guidelines — kids safety, abusive language, political content, and harmful topics — enforced as automated evals before any content moves downstream.</p><p><strong>Image Moderation</strong></p><p>Vision models evaluate each generated image for quality and policy compliance. Eval-based guardrails make the final call on whether an image is ready to publish.</p><p><strong>Product Catalogue Mapping</strong></p><p>For commerce-focused feeds, generated content candidates are translated into structured search queries, matched against the product catalogue, and passed through image editing models to produce VTON outputs — blending real products into generated visuals and bridging content discovery with commerce.</p><p><strong>Prompt Management</strong></p><p>At scale, managing prompts across multiple use cases becomes complex. We built a prompt management layer with APIs for configuration, updates, and experimentation — no deployments needed. Built-in versioning ensures fast iteration and consistency.</p><p><strong>Image Generation</strong></p><p>Prompts are routed to model pipelines based on use case — VTON for product-selfie outputs, generative models for lifestyle visuals. Outputs are enhanced with GAN-based upscaling and colour correction, optimised for TV-quality rendering.</p><p><strong>Content Publishing</strong></p><p>Content is routed through region-specific queues with per-client publishing contracts, ensuring the right content reaches the right audience with low latency across multiple OEM partners.</p><p><strong>Key Performance Indicators:</strong></p><ul><li><strong>Content Generation Latency:</strong> &lt; 600ms for cached responses, &lt; 7–8s for image generation, and ~10s for metadata creation</li><li><strong>System Throughput:</strong> 1K+ personalised content pieces generated per minute at scale</li><li><strong>Cache Efficiency:</strong> &gt; 85% hit rate across high-frequency user segments, significantly reducing redundant generation and cost</li></ul><p><strong>Key Takeaways:</strong></p><ul><li><strong>Always pair LLMs with a retrieval layer (Vector DB):</strong><br> Treat generation as an expensive operation and back it with embedding-based retrieval to enable reuse, reduce cost, and improve latency.</li><li><strong>Similarity thresholds are model-dependent control knobs:</strong><br> Threshold tuning varies across embedding models (text vs image), requiring continuous iteration to balance precision, diversity, and cost.</li><li><strong>Prompt design is model-aware, not universal:</strong><br> Image generation prompts must be tailored to the underlying model’s training distribution and capabilities — there is no one-size-fits-all prompt.</li><li><strong>Guardrails are critical for autonomous systems:</strong><br> Robust eval-driven moderation for both metadata and images is essential to safely enable automated, large-scale content publishing.</li><li><strong>Token-level observability unlocks optimisation:</strong><br> Logging no.of input/output tokens for every LLM call enables caching strategies, cost attribution, benchmarking across models, and long-term optimisation.</li><li><strong>User profiles are evolving into semantic representations:</strong><br> Moving from structured attributes to “profiles as language” makes LLM optimisation (prompting, context shaping, grounding) a core system concern.</li><li><strong>Prompt engineering becomes infrastructure:</strong><br> Versioned, API-driven prompt management enables rapid experimentation, rollback, and consistency across multiple model pipelines without redeployments.</li><li><strong>High cache hit rates are a key efficiency metric:</strong><br> Achieving &gt;85% cache hits reflects strong semantic reuse, directly reducing GPU utilization, latency, and overall system cost.</li><li><strong>Personalisation at generation time drives product impact:</strong><br> Generating content aligned with user intent (rather than post-hoc filtering) significantly improves engagement and downstream product metrics.</li><li><strong>Vector Databases as a First-Class Primitive: </strong>Embeddings for trends, candidates, and images act as a unified memory layer — powering deduplication, freshness control, and semantic retrieval across modalities and scalable approach for any content generation platform.</li><li><strong>Fully autonomous content pipeline: </strong>The system operates end-to-end without manual intervention — from intent extraction to content generation, validation, and publishing.</li></ul><p><strong>What’s Next?</strong></p><ul><li><strong>Cluster user preferences and summaries</strong> to build a coherent semantic profile, which is then fed into LLMs for more accurate and context-aware candidate generations.</li><li><strong>Adopt LLM gateways with semantic caching</strong>, enabling intelligent reuse of prior responses to reduce latency and significantly cut generation costs.</li><li><strong>Drive engagement through Day 0 and Day N VTON generations</strong>, continuously refreshing visuals across lifestyle categories to keep the feed dynamic, relevant, and evolving with user behaviour.</li></ul><h3><strong>Conclusion:</strong></h3><p>We’ve demonstrated that true personalisation at scale isn’t about better ranking algorithms — it’s about fundamentally rethinking content generation architecture. By inverting the traditional content-to-user mapping and leveraging semantic deduplication, we’ve achieved what seemed impossible: real-time, personalised content for millions of users at sustainable costs.</p><p>This isn’t just an incremental improvement; it’s a paradigm shift that opens new possibilities for user experiences. As LLMs continue to evolve and embedding models become more sophisticated, the techniques presented here will form the foundation for the next generation of content platforms.</p><p>The code and architectures described have been battle-tested in production, serving over 10 million users across multiple platforms with 99.95% uptime. We hope these insights accelerate your journey toward building truly personalised systems at scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec497feb651c" width="1" height="1" alt=""><hr><p><a href="https://engg.glance.com/engineering-hyper-personalised-content-at-scale-architecting-the-shift-from-broadcast-to-ec497feb651c">Engineering Hyper-Personalised Content at Scale: Architecting the Shift from Broadcast to…</a> was originally published in <a href="https://engg.glance.com/">Glance</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>