← Sonatus Interview Insights

Sonatus·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
Apr 2026

Summary

System design round at Sonatus for a software engineer role, focused entirely on building a RAG-based Q&A chatbot over vehicle documentation. Pretty deep dive, they wanted the full picture from ingestion to query-time retrieval, and didn't let you hand-wave the structured data side.

Questions Asked (6)

Q1

Design a RAG architecture for a Q&A chatbot that answers questions about vehicle documentation, covering ingestion, indexing, and query-time retrieval.

System DesignTechnical Trade-offs
Author's notes

This was the main event and it ate up most of the session.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements such as document types, query patterns, latency, and accuracy targets. Then walk through the RAG pipeline end-to-end: ingestion (parsing, chunking, embedding), indexing (vector store, metadata), and query-time retrieval (hybrid search, reranking, generation). Emphasize trade-offs and how you would evaluate and iterate on the system.

Pro tip: Anchor your design in the automotive domain: discuss how to handle tables, diagrams, and versioned documents (e.g., model-year-specific manuals) and mention the need for citations and hallucination mitigation, which are critical for safety and compliance.

1. Clarify Requirements and Constraints

Ask about document volume, formats (PDF, HTML, CAD), update frequency, query types (factual, procedural), latency, and accuracy needs. This shapes architecture choices.

2. Design Ingestion Pipeline

Outline document parsing (OCR, layout analysis), chunking strategies (semantic, hierarchical), metadata extraction (vehicle model, year, section), and embedding generation. Consider incremental updates.

3. Design Indexing and Storage

Choose a vector database (e.g., Pinecone, Weaviate) and optionally a keyword index (e.g., Elasticsearch) for hybrid search. Discuss indexing strategies, sharding, and metadata filtering.

4. Design Query-Time Retrieval and Generation

Describe query processing (embedding, expansion), retrieval (top-k, hybrid, reranking), and LLM generation with context. Include citation and fallback mechanisms.

5. Discuss Evaluation, Monitoring, and Trade-offs

Explain how to measure retrieval and generation quality (precision, recall, faithfulness), monitor drift, and iterate. Highlight trade-offs like latency vs. accuracy, cost vs. performance.

Key Points to Mention

  • Chunking strategies for technical documents (e.g., by section, with overlap, preserving tables)
  • Hybrid retrieval combining dense (vector) and sparse (keyword) search for better recall
  • Metadata filtering to scope queries by vehicle model, year, or document version
  • Reranking retrieved passages to improve precision before generation
  • Hallucination mitigation via citations, confidence scores, and fallback to 'I don't know'
  • Evaluation metrics: retrieval precision/recall, answer faithfulness, and latency

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How would you handle chunking and citation generation specifically for PDFs versus CSVs?

System DesignData Modeling
Author's notes

The follow-up I was least prepared for.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by contrasting the structural differences between PDFs and CSVs, then explain how chunking strategies must adapt to preserve semantics and enable accurate citations. Emphasize that CSV chunking should be row- or record-based with metadata for precise cell references, while PDF chunking should respect document layout (sections, paragraphs) and include page/coordinate metadata for citation.

Pro tip: Mention that citations should be verifiable and user-friendly: for CSVs, include row numbers and column headers; for PDFs, include page numbers and bounding boxes. Also highlight the importance of handling multi-page tables and merged cells in PDFs, which often break naive chunking.

1. Analyze document structure

Identify the inherent structure of each format: PDFs have pages, sections, paragraphs, and tables; CSVs have rows, columns, and headers. This determines chunk boundaries.

2. Define chunking strategy

For PDFs, chunk by logical sections or paragraphs, preserving context and avoiding splitting tables across chunks. For CSVs, chunk by rows or groups of rows, ensuring each chunk is self-contained with headers.

3. Attach citation metadata

For PDFs, store page number, bounding box, and section title. For CSVs, store row range, column names, and file name. This metadata enables precise citations.

4. Generate citations

Use the metadata to produce human-readable citations (e.g., 'PDF p. 5, section 2' or 'CSV rows 10-15, columns A-C') and machine-readable references for linking back to the source.

5. Handle edge cases

Address challenges like multi-page PDF tables, merged cells, and large CSVs by using overlapping chunks or hierarchical indexing to maintain context and citation accuracy.

Key Points to Mention

  • PDF chunking should respect layout and reading order; use libraries like PyPDF2 or pdfplumber to extract text with coordinates.
  • CSV chunking should be row-based with headers included in each chunk to maintain column context.
  • Citation metadata must include source location (page/row) and be stored alongside chunks for retrieval.
  • For PDFs, citations can reference page numbers and bounding boxes; for CSVs, row numbers and column headers.
  • Consider using a unified metadata schema to store citations across formats for consistent retrieval.
  • Handle multi-page tables in PDFs by detecting table boundaries and chunking accordingly, and for CSVs, consider chunk size limits to avoid token overflow.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

What vector database would you choose and why, given this workload is read-heavy with a growing corpus?

System DesignTechnical Trade-offs
Author's notes

Went with a managed option and justified it on operational overhead grounds.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the workload characteristics (read-heavy, growing corpus) and then evaluate vector databases based on their read performance, scalability, and indexing strategies. Recommend a database like Milvus or Qdrant, explaining how their architecture supports efficient reads and dynamic scaling, and discuss trade-offs with alternatives.

Pro tip: Mention that read-heavy workloads benefit from optimized indexing (e.g., HNSW) and that some databases allow read replicas or caching layers. Also, consider the operational overhead of managing a growing corpus, such as sharding and reindexing.

1. Clarify Requirements

Restate the workload characteristics: read-heavy, growing corpus, and any latency/throughput requirements. Ask about consistency, cost, and deployment environment if not specified.

2. Identify Key Criteria

List evaluation criteria such as read latency, scalability, index build time, support for incremental updates, and operational complexity.

3. Compare Vector Databases

Discuss 2-3 options (e.g., Milvus, Qdrant, Pinecone) and how they perform on the criteria, highlighting strengths for read-heavy and growing workloads.

4. Make a Recommendation

Choose one database and justify it based on the criteria, explaining how it handles read-heavy traffic and corpus growth.

5. Discuss Trade-offs and Mitigations

Acknowledge potential drawbacks (e.g., cost, complexity) and suggest mitigations like read replicas, caching, or hybrid indexing.

Key Points to Mention

  • Read-heavy workloads benefit from optimized indexes like HNSW and IVF, which reduce query latency.
  • Growing corpus requires efficient incremental indexing and horizontal scaling via sharding.
  • Consider managed vs. self-hosted solutions: managed services (e.g., Pinecone) reduce ops but may cost more; self-hosted (e.g., Milvus) offer control but require maintenance.
  • Read replicas and caching can offload read traffic and improve throughput.
  • Evaluate consistency and freshness requirements: some databases offer tunable consistency for read-heavy scenarios.
  • Benchmark with representative data and queries to validate performance claims.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

How would you enforce document-level access control if different users are entitled to different vehicle models or regions?

System DesignAPI & Integrations
Author's notes

Short answer: metadata filtering at retrieval time, scoped per user session.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data model and access control requirements, then propose a layered approach combining role-based and attribute-based access control. Emphasize enforcement at the API layer with query-level filtering to ensure users only see authorized documents, and discuss scalability and auditability.

Pro tip: Mention that access control should be enforced at the data layer (e.g., via query filters) rather than just the API layer to prevent accidental data leaks. Also, highlight the importance of caching permissions for performance in high-throughput systems.

1. Clarify Requirements and Data Model

Ask questions to understand the entities (users, vehicles, regions, documents) and how entitlements are assigned. Confirm whether access is based on roles, attributes, or both.

2. Choose an Access Control Model

Propose a hybrid model: RBAC for coarse-grained roles (e.g., admin, engineer) and ABAC for fine-grained rules (e.g., vehicle model, region). Explain how policies are defined and stored.

3. Design Enforcement Points

Enforce at multiple layers: API gateway for authentication and coarse authorization, service layer for business logic, and database layer with row-level security or query filters to prevent data leakage.

4. Implement Scalable and Auditable Access

Use centralized policy management (e.g., OPA) and cache permissions for performance. Log all access decisions for auditing and compliance.

5. Test and Iterate

Include unit and integration tests for access control, and plan for regular reviews of policies as entitlements change.

Key Points to Mention

  • Role-Based Access Control (RBAC) vs. Attribute-Based Access Control (ABAC)
  • Policy definition and management (e.g., using OPA or similar)
  • Enforcement at API gateway, service layer, and database (row-level security)
  • Query-level filtering to prevent data leakage
  • Caching permissions for performance
  • Audit logging and compliance

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

What are the key failure modes in a system like this, and how would you observe and diagnose retrieval quality issues in production?

System DesignTechnical Trade-offs
Author's notes

Talked through retrieval returning irrelevant chunks, the LLM hallucinating beyond what was retrieved, and citation drift where the model references a doc it didn't actually use.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system context (e.g., a retrieval-augmented generation pipeline or search service) and then systematically enumerate failure modes across data ingestion, indexing, query processing, and serving. For each failure mode, describe how you would instrument, monitor, and diagnose it in production using metrics, logs, and traces, emphasizing proactive detection and root-cause analysis.

Pro tip: Tie every failure mode to a concrete observability signal (e.g., recall drop → low click-through rate on top results) and mention how you'd set up alerts and runbooks to close the loop. This shows you think like an owner, not just a coder.

1. Clarify the system and its components

Briefly state your assumptions about the system (e.g., document ingestion, embedding generation, vector index, query understanding, ranking) to ground the discussion.

2. Enumerate failure modes by pipeline stage

Walk through each stage and list potential failures: data staleness, embedding drift, index corruption, query parsing errors, ranking bugs, and latency spikes.

3. Define observability metrics for each failure mode

For each failure, specify what to measure (e.g., recall@k, MRR, latency percentiles, error rates, index freshness) and how to collect them (logs, metrics, traces).

4. Describe diagnostic and mitigation strategies

Explain how you would investigate an issue (e.g., A/B tests, canary deployments, offline evaluation, query sampling) and what remediation steps you'd take.

5. Summarize with a proactive monitoring plan

Conclude by outlining how you'd set up alerts, dashboards, and automated rollbacks to catch and address retrieval quality issues before they impact users.

Key Points to Mention

  • Data quality issues: stale, missing, or duplicated documents leading to poor retrieval.
  • Embedding drift: model updates or data distribution shifts causing semantic mismatch.
  • Index health: corruption, sharding imbalance, or slow rebuilds affecting recall and latency.
  • Query understanding failures: misspellings, ambiguous intent, or out-of-vocabulary terms.
  • Ranking and relevance bugs: incorrect scoring, feature skew, or biased results.
  • Observability: tracking recall@k, MRR, NDCG, click-through rate, and latency; using logging, tracing, and A/B testing for diagnosis.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

What latency and throughput targets would you propose for this chatbot, and how would you architect to meet them?

System DesignAdaptability & Ambiguity
Author's notes

Blanked for a second on actual numbers.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the chatbot's use case and expected user load, then propose concrete latency and throughput targets based on industry benchmarks and user expectations. Architect a scalable, low-latency system using techniques like caching, asynchronous processing, and horizontal scaling, and explain how you would validate and iterate on these targets.

Pro tip: Tie your targets to business metrics like user satisfaction and conversion rates, and mention that you would instrument the system to measure real-world performance and adjust as needed.

1. Clarify Requirements and Context

Ask about the chatbot's purpose, expected user volume, peak load, and any existing constraints. This ensures your targets are relevant and realistic.

2. Propose Latency and Throughput Targets

Suggest specific numbers, such as <200ms for simple responses and <1s for complex ones, and throughput like 1000 requests per second. Justify with user experience and industry standards.

3. Design the Architecture

Outline a high-level architecture that meets the targets: load balancers, stateless services, caching layers, message queues for async tasks, and auto-scaling groups.

4. Address Bottlenecks and Trade-offs

Discuss potential bottlenecks (e.g., database, external APIs) and how to mitigate them (e.g., read replicas, circuit breakers). Mention trade-offs between latency and cost.

5. Plan for Monitoring and Iteration

Explain how you would monitor latency and throughput (e.g., Prometheus, Grafana), set alerts, and use A/B testing to refine targets over time.

Key Points to Mention

  • Latency targets: p95 < 200ms for simple queries, p99 < 1s for complex ones
  • Throughput targets: handle 10x peak load with horizontal scaling
  • Use caching (Redis) for frequent queries and CDN for static assets
  • Asynchronous processing with message queues for non-real-time tasks
  • Auto-scaling and load balancing to distribute traffic
  • Monitoring and observability to measure and improve performance

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.