Building a City-Specific Sports News Feed with LLM Summaries
Machine LearningModel answerLast updated
Design an ML system that ingests sports content, generates grounded summaries for local audiences, and personalizes delivery at scale.
Problem Statement
You're building a mobile application that delivers customized sports news digests to users based on their location and interests. The system needs to consume content from thousands of sources, create coherent summaries combining multiple articles, and serve personalized feeds to users.
Core Requirements
Your system must:
-
Content Pipeline: Continuously ingest sports articles from diverse sources (news APIs, RSS feeds, social platforms) and process them for relevance to specific cities and teams.
-
Search and Retrieval: Implement a retrieval strategy that handles both specific queries (player names, team identifiers) and broader semantic matching (understanding user intent).
-
Summary Generation: Produce concise digests that synthesize information from multiple sources while maintaining accurate attribution to original articles.
-
Accuracy Guarantees: Ensure generated content remains factually grounded in source material without introducing unsupported claims.
-
User Adaptation: Present content ordered by relevance to individual users based on their team preferences and engagement patterns.
System Constraints
- Content sources: 10,000+ publishers
- Peak load: 50,000 requests/minute during major events
- Performance targets: retrieval within 500ms, complete summaries within 3 seconds
- Users follow multiple teams across different cities
Expected Output
Provide:
- System architecture showing ingestion, storage, retrieval, and generation components
- Schema design for content and user data
- Strategy for measuring retrieval quality and generation accuracy
- Approach to handling time-sensitive content during live events and graceful degradation when generation services are overwhelmed
Hints
Hint 1
Think about whether summaries should be generated per-user or can be shared across users viewing the same content
Hint 2
Consider how to make location filtering reliable rather than depending solely on semantic understanding
Hint 3
Layer multiple validation techniques to catch different types of factual errors in generated text
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Solution Overview
Initial Scoping
Start by translating requirements into concrete numbers:
- Request volume: 50k req/min peaks translate to roughly 850 QPS. Design for 2,000 QPS capacity since traffic spikes cluster around game conclusions.
- Content ingestion: 10k sources publishing ~50 items daily means 500k articles/day, averaging 6/second with burst periods hitting hundreds per second.
- Latency requirements: 500ms for retrieval, 3s end-to-end including generation.
Critical insight: Don't generate summaries per user request. Instead, generate summaries keyed by (location, story cluster, time window). With thousands of cities and tens of thousands of active team-location pairs, generation scales with content events rather than user requests. Personalization happens during ranking of pre-generated content. This realization is essential for meeting latency and cost targets.
Scope boundaries: Focus on written news summaries. Exclude video processing, real-time play-by-play updates (handle those as structured data), and global sports coverage outside served markets.
API Design
GET /feed?user_id&location&cursor&limit
→ [{id, type: digest|article, headline, content, sources:[{outlet, url, excerpt}],
related_teams, timestamp, freshness_indicator}]
GET /digest/{id}
→ full digest with detailed source attribution
POST /interactions
→ {user_id, content_id, event: viewed|clicked|read_time, timestamp}
PUT /users/{id}/settings
→ {followed_teams:[], locations:[], hidden_topics:[]}
Data Schema
Content Document
| Field | Purpose |
|---|---|
| doc_id, source_id, url, content_hash | Identity and deduplication |
| headline, full_text, segments[] | Text content chunked for embedding (~300 tokens/chunk) |
| published_time, ingested_time | Temporal tracking |
| extracted_entities[] | Teams, athletes, leagues normalized to knowledge base IDs |
| geographic_tags: location_ids[], relevance_scores | City associations with confidence |
| event_reference (optional), content_category | Link to games; classify as preview/recap/breaking/analysis |
| source_credibility | Per-publisher quality score |
| story_group_id | Multi-document story clustering |
Digest: digest_id, story_group_id, location_id, generated_text, sentence_attributions (sentence → source_segment_ids), verification_score, created_at, source_snapshot_time.
User Model:
- Explicit: followed teams, locations, content filters
- Learned: interaction-derived embedding (exponential moving average of engaged content), entity affinity scores with temporal decay, engagement metrics
- Session state
Architecture Components
-
Ingestion Layer: Source adapters feed a message queue. Normalization removes boilerplate, performs language detection, and deduplicates by content hash.
-
Enrichment Pipeline:
- Named entity recognition with linking to sports knowledge graph (team → home_city, venue, league structure)
- Geographic tagging combining publisher location, entity associations, and location mentions into scored city mappings
- Content categorization and event linking
- Story clustering via online clustering using embedding similarity and entity overlap within time windows
-
Storage and Indexing:
- Keyword index (Elasticsearch/OpenSearch) with structured entity fields
- Vector index (HNSW) for chunk embeddings
- Both partition by location_id for efficient filtering
-
Digest Generation (asynchronous): Story cluster updates trigger regeneration for affected (location, cluster) pairs. Flow: generate → verify → persist to digest store and cache.
-
Serving Layer:
- Candidate retrieval fetches recent digests and articles for user's locations/teams plus hybrid search for inferred interests
- Ranking model scores candidates; re-ranker enforces diversity
- Response assembly
-
Feedback Loop: User interaction events stream to feature store and training pipeline.
Deep Dive: Key Design Decisions
Hybrid Retrieval with Geographic Reliability
Combine two retrieval paths:
- Lexical: BM25 with exact entity matching handles precise queries like "Jaylen Brown injury update" where rare names need exact matching
- Semantic: Bi-encoder embeddings capture intent like "how is our defense performing"
Critical: Don't rely solely on embeddings for location. Apply hard pre-filtering on location_id metadata (filtered HNSW or location-specific index partitions). Optionally, augment text with learned location tokens during embedding so geographic neighbors cluster together.
Result fusion: Combine using Reciprocal Rank Fusion, then apply cross-encoder re-ranking on top ~100 candidates (50-80ms on GPU).
Latency breakdown: 30ms parallel BM25 + vector search, 70ms re-ranking, 50ms feature loading and final ranking → well under 500ms.
Grounded Generation with Source Attribution
Feed the language model top-k segments from a story cluster, each labeled with segment_id, source, and timestamp. Prompt structure:
- Instruct the model to output structured format where each sentence includes supporting segment IDs
- Use constrained decoding or schema validation to reject outputs lacking citations
- Use moderate-size model (7-13B parameters) with low temperature
- Provide structured facts (scores, statistics) from sports data API as separate authoritative context
Verification Layers (applied asynchronously)
- Citation completeness: Every sentence must reference at least one source segment
- Entailment checking: Parse into atomic claims, run NLI model on (source_segment, claim) pairs, require high entailment probability
- Fact validation: Extract numbers, scores, names, dates via regex/NER and verify exact matches against source segments and authoritative data
- Recovery: Failed claims get dropped or trigger single regeneration attempt; persistent failures fall back to extractive summaries from high-ranking source sentences
Since generation runs asynchronously, this ~1 second verification never blocks user requests.
Personalization Strategy
Train a gradient-boosted tree or neural ranking model on click and dwell-time data.
Feature categories:
- Team match signals (explicit follows)
- Entity affinity scores from history
- Content-user embedding similarity
- Location relevance score
- Source credibility
- Recency features with event-aware weighting
- Story popularity within location
Cold start: Weight explicit preferences heavily plus location-wide popularity.
Diversity re-ranking: Apply maximal marginal relevance or cluster caps to prevent single-story domination.
Handling Time-Sensitive Content
Digests store source_snapshot_time and link to event_id when applicable.
For live events:
- Score changes from structured data feed invalidate affected digests, triggering regeneration
- Display live scores from structured data widgets, not baked into generated text (text says "trailing late," widget shows current score)
- Apply short TTL (1-2 minutes) for active-game digests, longer TTL (hours) for concluded events
- Surface "Updated X minutes ago" labels rather than presenting stale content as current
Cache Strategy and Graceful Degradation
Multi-tier caching:
- CDN/edge: location-level popular digests
- Application: ranked feed segments per user cohort
- Database: query result cache
Degradation tactics when generation service is overloaded:
- Serve cached digests with staleness indicators
- Fall back to ranked article lists without digests
- Route to extractive summaries (simpler, faster)
- Apply load shedding with priority to active users over anonymous traffic
Evaluation Framework
Retrieval quality:
- Precision@k and recall@k for entity-based queries using labeled test set
- nDCG for ranking quality
- Location accuracy: fraction of results correctly mapped to target city
Generation quality:
- Citation coverage rate
- NLI entailment scores on sampled claims
- Fact accuracy via automated checks and manual review sampling
- ROUGE/BERTScore against reference summaries (limited value)
- User satisfaction via click-through rate and dwell time on digests vs. raw articles
System health:
- Latency percentiles (p50, p95, p99)
- Cache hit rates
- Fallback activation frequency
Common Pitfalls
- Per-user generation: Attempting to generate summaries on-demand per user makes latency and cost targets impossible to meet
- Embedding-only location: Semantic search alone is unreliable for geographic constraints; use explicit filtering
- Synchronous verification: Running expensive fact-checking in the request path violates latency budget
- Single verification method: Layered checks catch different error types; no single technique is sufficient
- Ignoring cold start: New users need immediate value from explicit preferences before personalization learns