sde
Interview Date
21-08-2026
Result
Selected
Difficulty
Easy
Rounds
01
Drive Type
Off-Campus
Topics asked
Detailed experience
PART 1: ALGORITHMIC PROBLEM - MULTI-WAY SSTABLE MERGE ENGINE BASE PROBLEM You are implementing the compaction engine for an LSM-tree-based storage engine. You are given K sorted files (SSTables) containing key-value pairs, where each key is a unique string and values have an associated integer timestamp representing write time. Task: Design an algorithm to merge these K sorted streams into a single sorted output stream. If the same key appears across multiple files, the output must keep only the entry with the highest timestamp. What data structures will you use to perform this merge in O(N log K) time, where N is the total number of entries across all K files, using minimal working memory? FOLLOW-UP 1 Deletions in an LSM-tree are written as "tombstones" (a key paired with a null value and a timestamp). During compaction, a tombstone can only be safely discarded if no older SSTables at lower levels contain an older version of that key. How would you modify your multi-way merge logic to track level boundaries and purge tombstones without accidentally resurrecting previously deleted keys? FOLLOW-UP 2 The keys and values are variable-length strings, and the total dataset spans hundreds of gigabytes, exceeding available RAM. How do you implement the merge using zero-copy streaming, block-level buffering, and prefix compression to minimize I/O and CPU memory overhead? PART 2: SYSTEM DESIGN - DISTRIBUTED WRITE-INTENSIVE STORAGE ENGINE BASE PROBLEM You need to design a distributed, write-heavy key-value store (similar to Apache Cassandra or Bigtable) capable of handling 2 million writes per second with sub-5ms write latency. Design the end-to-end node architecture, focusing on the ingestion path from network socket to durable storage. FOLLOW-UP 1 LSM-trees trade read performance for write throughput. Over time, reads degrade because a query might need to check the active MemTable, immutable MemTables, and dozens of SSTables on disk (read amplification). How do you design an indexing and caching architecture (such as Bloom filters, block caches, and Leveled Compaction) to ensure point lookups for non-existent or cold keys return in under 2ms without scanning disk blocks? FOLLOW-UP 2 Your cluster spans three geographic availability zones with a replication factor of 3. How do you handle write coordination, dynamic node failures (using hinted handoffs), read repair, and tunable consistency levels (e.g., Quorum reads and writes: R + W > N) during a network partition between data centers? PART 3: AI / LLM DISCUSSION QUESTIONS What is Key-Value (KV) Caching in LLM inference? In auto-regressive generation, the model predicts one token at a time. Each new token requires computing attention against all previous tokens. KV caching stores the computed Key and Value vectors for all prior tokens in GPU memory, avoiding redundant matrix multiplications for the prompt and generated tokens. This reduces the per-step computation complexity from O(N^2) to O(N) relative to sequence length. What is Speculative Decoding? Speculative decoding is an inference optimization technique that accelerates generation without sacrificing output quality. A smaller, faster "draft model" quickly generates a sequence of speculative tokens (e.g., 4–5 tokens). The larger target model then runs a single parallel forward pass to verify or reject those tokens simultaneously. Because verification is computationally cheaper than sequential generation, this yields significant wall-clock speedups. What is Direct Preference Optimization (DPO) and how does it compare to RLHF? DPO is an alternative to traditional Reinforcement Learning from Human Feedback (RLHF). Instead of fitting a separate reward model and using complex reinforcement learning algorithms (like PPO) to update the policy, DPO mathematically reformulates the reward objective directly in terms of the policy. It optimizes the language model weights directly on pairs of chosen and rejected responses using binary cross-entropy loss, resulting in greater training stability and lower compute overhead. What are Attention Sinks in streaming or long-context LLMs? Researchers observed that autoregressive models allocate an unexpectedly high proportion of attention weights to the very first few tokens in a sequence, regardless of their semantic importance. These initial tokens act as "attention sinks" that stabilize the Softmax distribution. When implementing rolling-window KV caches for continuous streaming, retaining the first few tokens (the sink) alongside the most recent sliding-window tokens prevents the model's perplexity from collapsing.