Design a Chat History and Context Management System
Last updated: September 4, 2025
Quick Overview
Build multi-turn conversational search with session management, context compression, and personalization without violating privacy.
Perplexity
System Design
Software Engineer
Perplexity
September 4, 2025Software Engineer
System Design Round
System Design
Medium
9
6
3,133 solved
Build multi-turn conversational search with session management, context compression, and personalization without violating privacy.
Perplexity supports multi-turn conversations. Managing context across turns while staying within token limits is a key engineering challenge.
What the Interviewer Expects
- Design session storage and retrieval
- Implement context compression for long conversations
- Address personalization with privacy constraints
- Handle context window limits for multi-turn prompts
Key Topics to Cover
Session management
Context compression
Token budget allocation
Conversational search
Privacy-preserving personalization
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you decide how much history to include?
- What happens when the conversation exceeds the context window?
- How do you handle topic switches within a conversation?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional Requirements:
- Session Management: Maintain user sessions across multiple turns of conversation. Each session should store user context, preferences, and conversation history.
- ...
Capacity Estimation
Assuming Perplexity expects to handle 100,000 active users at peak times:
- Average session length: 10 turns
- Average tokens per turn: 50 tokens
- Total tokens generated per session = 10 turn...
Submit Your Answer
Markdown supported