<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Feng Zhang</title>
    <description>The latest articles on DEV Community by Feng Zhang (@feng_zhang_cedb4581bee881).</description>
    <link>https://dev.to/feng_zhang_cedb4581bee881</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3875738%2Fd8a58adf-1466-4b32-9d75-041250f25bda.png</url>
      <title>DEV Community: Feng Zhang</title>
      <link>https://dev.to/feng_zhang_cedb4581bee881</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/feng_zhang_cedb4581bee881"/>
    <language>en</language>
    <item>
      <title>Secure Multitenant SaaS Architecture Explained — Tech Interview Concept (2026)</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 02 Sep 2026 14:27:12 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/secure-multitenant-saas-architecture-explained-tech-interview-concept-2026-5foj</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/secure-multitenant-saas-architecture-explained-tech-interview-concept-2026-5foj</guid>
      <description>&lt;p&gt;Multitenant SaaS design questions are easy to answer badly.&lt;/p&gt;

&lt;p&gt;A weak answer says, "Add &lt;code&gt;tenant_id&lt;/code&gt; everywhere and encrypt the database." A better answer explains where tenant isolation is enforced, how authorization works across each access path, how background jobs carry tenant context, and how you stop one customer from hurting another customer's availability.&lt;/p&gt;

&lt;p&gt;This topic comes up often in system design interviews, especially for enterprise products with sensitive data. The original PracHub concept write-up on &lt;a href="https://prachub.com/concepts/secure-multitenant-saas-architecture?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;secure multitenant SaaS architecture&lt;/a&gt; frames it around legal workflows, where documents, matters, privileged communications, and audit trails all raise the bar.&lt;/p&gt;

&lt;p&gt;Let's turn that into a practical interview-ready design.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the interviewer is really testing
&lt;/h2&gt;

&lt;p&gt;The interviewer wants to know if you can design a SaaS system where many customers share infrastructure without sharing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data&lt;/li&gt;
&lt;li&gt;Permissions&lt;/li&gt;
&lt;li&gt;Search results&lt;/li&gt;
&lt;li&gt;Cached responses&lt;/li&gt;
&lt;li&gt;Background jobs&lt;/li&gt;
&lt;li&gt;Operational blast radius&lt;/li&gt;
&lt;li&gt;Observability access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last point matters more than many candidates expect. Multitenancy is not just a database problem. It touches authentication, authorization, queues, object storage, search indexes, logs, metrics, admin tools, and incident response.&lt;/p&gt;

&lt;p&gt;A good answer should show that you understand tradeoffs. Shared infrastructure is cheaper and simpler early on. Dedicated infrastructure gives stronger isolation for large or regulated customers, but it adds migration, deployment, cost, and operations work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick the tenancy model first
&lt;/h2&gt;

&lt;p&gt;Most SaaS systems use one of three models:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Shared database, shared schema&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every tenant's data lives in the same tables. Tenant-owned tables include a &lt;code&gt;tenant_id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is cost-effective and simpler to operate, but it depends on correct tenant scoping everywhere.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Shared database, separate schema&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each tenant has its own schema inside the same database.&lt;/p&gt;

&lt;p&gt;This gives a stronger boundary than shared tables, but migrations and schema management become harder.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Separate database per tenant&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each tenant has its own database.&lt;/p&gt;

&lt;p&gt;This improves isolation and noisy-neighbor control, but connection management, migrations, backups, and provisioning are more complex.&lt;/p&gt;

&lt;p&gt;For most interview answers, start with shared services and a shared &lt;code&gt;Postgres&lt;/code&gt; database with strong logical isolation. Then mention that large or regulated tenants can move to a dedicated database, bucket, or deployment tier.&lt;/p&gt;

&lt;p&gt;That tradeoff sounds realistic. It avoids pretending every customer gets fully dedicated infrastructure from day one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tenant isolation must exist at multiple layers
&lt;/h2&gt;

&lt;p&gt;Do not rely on one &lt;code&gt;WHERE tenant_id = ?&lt;/code&gt; check and call it done.&lt;/p&gt;

&lt;p&gt;A serious design applies tenant scoping across the system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API authentication&lt;/li&gt;
&lt;li&gt;Authorization middleware&lt;/li&gt;
&lt;li&gt;Database predicates&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Postgres&lt;/code&gt; row-level security&lt;/li&gt;
&lt;li&gt;Object storage key prefixes&lt;/li&gt;
&lt;li&gt;Signed URL generation&lt;/li&gt;
&lt;li&gt;Search and vector index filters&lt;/li&gt;
&lt;li&gt;Cache key prefixes&lt;/li&gt;
&lt;li&gt;Queue routing&lt;/li&gt;
&lt;li&gt;Worker pools&lt;/li&gt;
&lt;li&gt;Audit logs&lt;/li&gt;
&lt;li&gt;Admin tools&lt;/li&gt;
&lt;li&gt;Observability permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, a document might be stored in &lt;code&gt;S3&lt;/code&gt; under:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tenant/{tenant_id}/matter/{matter_id}/doc/{doc_id}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That naming pattern helps, but naming alone is not security. Your service should authorize the request before it generates a signed URL. The signed URL should have a short TTL. Metadata should be checked before bytes are served.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication and authorization are different
&lt;/h2&gt;

&lt;p&gt;Authentication answers: "Who are you?"&lt;/p&gt;

&lt;p&gt;Authorization answers: "What can you access?"&lt;/p&gt;

&lt;p&gt;Enterprise SaaS often supports &lt;code&gt;SAML&lt;/code&gt; or &lt;code&gt;OIDC&lt;/code&gt; single sign-on. The system maps identity-provider groups into application roles. Session tokens or &lt;code&gt;JWT&lt;/code&gt;s may contain claims such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sub"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"user_123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"org_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tenant_456"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"roles"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"admin"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"exp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1760000000&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Roles are useful, but roles alone are usually too coarse.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;RBAC&lt;/code&gt; works for broad permissions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;admin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;member&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;viewer&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Legal-style workflows often need &lt;code&gt;ABAC&lt;/code&gt; too. Access may depend on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tenant_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;matter_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;document_classification&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;jurisdiction&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ethical_wall_group&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A common pattern is to combine them. Roles grant capabilities. Attributes constrain which resources those capabilities apply to.&lt;/p&gt;

&lt;p&gt;For example, a user may have permission to view documents, but only for matters they belong to, and only if the document is not blocked by an ethical wall.&lt;/p&gt;

&lt;h2&gt;
  
  
  Put authorization near every resource access
&lt;/h2&gt;

&lt;p&gt;Route-level checks are not enough.&lt;/p&gt;

&lt;p&gt;You need a common authorization API, something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;authorize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;resource&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That call should happen before sensitive resource access, whether the caller is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A REST endpoint&lt;/li&gt;
&lt;li&gt;A GraphQL resolver&lt;/li&gt;
&lt;li&gt;A background worker&lt;/li&gt;
&lt;li&gt;A CSV export job&lt;/li&gt;
&lt;li&gt;A search endpoint&lt;/li&gt;
&lt;li&gt;A document preview service&lt;/li&gt;
&lt;li&gt;An admin impersonation tool&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Policy can live in application code or a system like &lt;code&gt;Open Policy Agent&lt;/code&gt;. The key idea is consistency. Every path that reads or writes tenant data needs a policy decision.&lt;/p&gt;

&lt;p&gt;This is where many designs fail. The main API may be scoped correctly, while a batch export, preview endpoint, webhook retry, or support tool bypasses the same checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design the database so unsafe queries are harder to write
&lt;/h2&gt;

&lt;p&gt;In a shared-schema model, every tenant-owned table should include &lt;code&gt;tenant_id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Example tables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;documents&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;tenant_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;matter_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;document_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;matters&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;tenant_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;matter_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Indexes should match tenant-scoped access patterns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;documents_tenant_matter_created_idx&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;documents&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tenant_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;matter_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;created_at&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Business identifiers should usually be unique within a tenant, not globally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tenant_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;external_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Postgres&lt;/code&gt; row-level security can backstop application mistakes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;tenant_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_setting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.tenant_id'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;RLS is not a replacement for clean application design, but it can reduce the damage from an unscoped query.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat search and vector retrieval as high-risk paths
&lt;/h2&gt;

&lt;p&gt;Search is a common leak point.&lt;/p&gt;

&lt;p&gt;If you use &lt;code&gt;OpenSearch&lt;/code&gt;, &lt;code&gt;Elasticsearch&lt;/code&gt;, &lt;code&gt;pgvector&lt;/code&gt;, or a vector database, every query must include tenant and permission filters before results are returned.&lt;/p&gt;

&lt;p&gt;For sensitive documents, retrieval should filter by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tenant_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;matter_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;User-accessible document IDs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not fetch the top-k chunks globally and then filter afterward. That can leak through ranking, snippets, timing, logs, or accidental response fields. The permission boundary needs to be part of retrieval, not a cleanup step after retrieval.&lt;/p&gt;

&lt;p&gt;Derived data needs the same treatment. OCR text, embeddings, summaries, previews, and cached snippets are still tenant data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background jobs need explicit tenant context
&lt;/h2&gt;

&lt;p&gt;Asynchronous processing is another common source of bugs.&lt;/p&gt;

&lt;p&gt;Suppose a user uploads a legal document. The system creates jobs for virus scanning, OCR, embedding generation, indexing, and preview creation.&lt;/p&gt;

&lt;p&gt;Each job should carry tenant context explicitly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tenant_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tenant_456"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"matter_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"matter_789"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"document_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"doc_123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"requested_by"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"user_999"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system should validate permissions when the job is enqueued and again when it runs. That second check matters because permissions can change while a job is waiting.&lt;/p&gt;

&lt;p&gt;Derived artifacts should be written back into tenant-scoped stores. Queue names, routing keys, and worker pools may also be partitioned or rate-limited by tenant.&lt;/p&gt;

&lt;h2&gt;
  
  
  Encryption helps, but it does not fix bad authorization
&lt;/h2&gt;

&lt;p&gt;Encryption belongs in the design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;TLS&lt;/code&gt; for data in transit&lt;/li&gt;
&lt;li&gt;Storage encryption for data at rest&lt;/li&gt;
&lt;li&gt;Optional per-tenant keys through &lt;code&gt;AWS KMS&lt;/code&gt;, &lt;code&gt;GCP KMS&lt;/code&gt;, or &lt;code&gt;HashiCorp Vault&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Per-tenant envelope encryption can support tenant-specific key rotation or deletion. It also adds latency, key-management paths, and new failure modes.&lt;/p&gt;

&lt;p&gt;The interview mistake is to over-index on encryption. Encryption protects against storage compromise. It does not stop an authenticated user from reading the wrong matter if authorization is broken.&lt;/p&gt;

&lt;p&gt;Access-control correctness is the bigger application-layer risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Audit logs should answer who did what
&lt;/h2&gt;

&lt;p&gt;Enterprise systems need audit trails for security and compliance.&lt;/p&gt;

&lt;p&gt;Log events such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login&lt;/li&gt;
&lt;li&gt;SSO group sync&lt;/li&gt;
&lt;li&gt;Permission changes&lt;/li&gt;
&lt;li&gt;Document upload&lt;/li&gt;
&lt;li&gt;Document download&lt;/li&gt;
&lt;li&gt;Search&lt;/li&gt;
&lt;li&gt;Export&lt;/li&gt;
&lt;li&gt;Admin impersonation&lt;/li&gt;
&lt;li&gt;Failed authorization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A useful audit event includes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"actor_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"user_999"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tenant_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tenant_456"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"resource_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"doc_123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"document.download"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"decision"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"allowed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ip"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"203.0.113.10"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user_agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Mozilla/5.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-01-15T12:00:00Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The audit log should avoid document contents, prompts, secrets, and access tokens.&lt;/p&gt;

&lt;p&gt;There is also a design tradeoff. Synchronous audit writes give stronger confidence but add latency and failure coupling. Asynchronous audit writes improve availability but need durable queues and retries. A strong answer proposes a hybrid: block on authorization, emit audit events to a durable append-only stream, and monitor for delayed or missing audit records.&lt;/p&gt;

&lt;h2&gt;
  
  
  Protect tenants from noisy neighbors
&lt;/h2&gt;

&lt;p&gt;Security includes availability.&lt;/p&gt;

&lt;p&gt;One tenant's large import should not exhaust all background workers or saturate shared database IOPS for everyone else.&lt;/p&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Per-tenant rate limits&lt;/li&gt;
&lt;li&gt;Quotas&lt;/li&gt;
&lt;li&gt;Queue partitioning&lt;/li&gt;
&lt;li&gt;Worker-pool isolation&lt;/li&gt;
&lt;li&gt;Query timeouts&lt;/li&gt;
&lt;li&gt;Resource monitoring by tenant&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where shared infrastructure needs careful guardrails. Tenant isolation includes performance failure boundaries, not just data leakage.&lt;/p&gt;

&lt;h2&gt;
  
  
  A strong interview answer structure
&lt;/h2&gt;

&lt;p&gt;If asked to design a secure multitenant document management system, structure the answer like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clarify requirements&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ask whether tenants are companies or law firms, whether users can belong to multiple tenants, whether documents are scoped to matters, and whether the system needs SSO, audit logs, data residency, or dedicated infrastructure.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;State assumptions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Use shared application services, shared &lt;code&gt;Postgres&lt;/code&gt; for metadata, object storage for files, and strict logical isolation by &lt;code&gt;tenant_id&lt;/code&gt; and &lt;code&gt;matter_id&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cover identity and access&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Use &lt;code&gt;OIDC&lt;/code&gt; or &lt;code&gt;SAML&lt;/code&gt;, map groups to roles, combine &lt;code&gt;RBAC&lt;/code&gt; and &lt;code&gt;ABAC&lt;/code&gt;, and call &lt;code&gt;authorize(actor, action, resource)&lt;/code&gt; across all access paths.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cover data isolation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Put &lt;code&gt;tenant_id&lt;/code&gt; on tenant-owned tables, use scoped indexes, enable RLS on sensitive tables, namespace object keys, and generate signed URLs only after authorization.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cover operations&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Add audit logs, per-tenant rate limits, encrypted storage, key management, queue partitioning, and guardrails for admin access.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Call out tradeoffs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Shared database is simpler and cheaper for most tenants. Dedicated databases or buckets may be needed for large or regulated customers.&lt;/p&gt;

&lt;p&gt;If you want more interview prompts around this style of system design, PracHub has a broader set of &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;technical interview questions&lt;/a&gt; that pair well with this topic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes to avoid
&lt;/h2&gt;

&lt;p&gt;The biggest mistake is treating &lt;code&gt;tenant_id&lt;/code&gt; like a UI filter. It is a security boundary.&lt;/p&gt;

&lt;p&gt;Another mistake is checking authorization only at the route layer. Secondary paths often cause leaks: exports, previews, search snippets, OCR jobs, embeddings, cached responses, webhook retries, and support tooling.&lt;/p&gt;

&lt;p&gt;A third mistake is using encryption as a substitute for authorization. You need both, but they solve different problems.&lt;/p&gt;

&lt;p&gt;If you can explain those risks clearly, your answer will sound much closer to production engineering than checklist security. For a compact version of the concept, use the PracHub guide to &lt;a href="https://prachub.com/concepts/secure-multitenant-saas-architecture?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;secure multitenant SaaS architecture&lt;/a&gt; as a review sheet before practicing the full system design.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>systemdesign</category>
      <category>programming</category>
    </item>
    <item>
      <title>LinkedIn Data Scientist Interview Cheatsheet 2026</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 26 Aug 2026 14:26:39 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/linkedin-data-scientist-interview-cheatsheet-2026-4c4k</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/linkedin-data-scientist-interview-cheatsheet-2026-4c4k</guid>
      <description>&lt;p&gt;LinkedIn data scientist interviews usually test whether you can move between product thinking, SQL/Python, experimentation, and machine learning judgment. The bar is less about memorizing obscure algorithms and more about taking an ambiguous business question, defining the metric, checking the data, and defending your read.&lt;/p&gt;

&lt;p&gt;This is a rewrite of the &lt;a href="https://prachub.com/interview-prep/linkedin-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;PracHub LinkedIn Data Scientist interview prep cheatsheet&lt;/a&gt;, focused on the patterns you are likely to see in a 2026-style interview.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. SQL and Python: get the grain right first
&lt;/h2&gt;

&lt;p&gt;Most technical screens start with relational data manipulation. You may get event logs, job metadata, user tables, article categories, or country mappings, then be asked to compute a metric.&lt;/p&gt;

&lt;p&gt;The interviewer is checking whether you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Join event logs to dimension tables&lt;/li&gt;
&lt;li&gt;Filter on the right timestamp or action type&lt;/li&gt;
&lt;li&gt;Deduplicate at the right grain&lt;/li&gt;
&lt;li&gt;Aggregate without double-counting&lt;/li&gt;
&lt;li&gt;Use window functions for ranking or top-k problems&lt;/li&gt;
&lt;li&gt;Translate the same logic into pandas if needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A practical checklist:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is one row in each table?&lt;/li&gt;
&lt;li&gt;What is the metric grain, user, job, country, post, session, or day?&lt;/li&gt;
&lt;li&gt;Should missing metadata drop the row or stay as &lt;code&gt;NULL&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;Do repeated events count, or do we need uniqueness?&lt;/li&gt;
&lt;li&gt;Is the date filter on the event, the entity, or the metadata?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For SQL joins, be explicit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;member_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;unique_applicants&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_applications&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;applications&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;jobs&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;
  &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;job_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;job_id&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;apply_date&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt; &lt;span class="s1"&gt;'2026-01-01'&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;j&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the prompt asks for the top country per continent, use &lt;code&gt;ROW_NUMBER()&lt;/code&gt; when exactly one row should be returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;country_apps&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;continent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;applications&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;job_applications&lt;/span&gt;
  &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;continent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="n"&gt;ranked&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ROW_NUMBER&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;continent&lt;/span&gt;
      &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;applications&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country&lt;/span&gt; &lt;span class="k"&gt;ASC&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;rn&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;country_apps&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;continent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;applications&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;ranked&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;rn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;RANK()&lt;/code&gt; can return ties. That is fine only if the prompt allows multiple winners.&lt;/p&gt;

&lt;p&gt;In pandas, most variants map to a small set of tools: &lt;code&gt;merge&lt;/code&gt;, boolean filters, &lt;code&gt;groupby().agg()&lt;/code&gt;, &lt;code&gt;nunique()&lt;/code&gt;, &lt;code&gt;drop_duplicates()&lt;/code&gt;, &lt;code&gt;rank(method="first")&lt;/code&gt;, and &lt;code&gt;value_counts()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The common failure mode is aggregating after a many-to-many join without checking row explosion. If a job has multiple categories and a user has multiple views, joining first can inflate counts unless you dedupe at the metric grain.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Sampling algorithms: correctness beats cleverness
&lt;/h2&gt;

&lt;p&gt;LinkedIn data scientist interviews can include randomized sampling questions. These are coding problems, but the evaluation is about bias, efficiency, and whether the sample supports valid modeling or metrics later.&lt;/p&gt;

&lt;p&gt;Know these patterns:&lt;/p&gt;

&lt;h3&gt;
  
  
  Reservoir sampling
&lt;/h3&gt;

&lt;p&gt;Use this when the stream length is unknown and you need a uniform sample of size &lt;code&gt;k&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep the first &lt;code&gt;k&lt;/code&gt; items&lt;/li&gt;
&lt;li&gt;For the &lt;code&gt;i&lt;/code&gt;th item after that, draw a random integer from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;i&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If the index is less than &lt;code&gt;k&lt;/code&gt;, replace that slot&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each item should end with probability &lt;code&gt;k / n&lt;/code&gt; of being included.&lt;/p&gt;

&lt;h3&gt;
  
  
  Weighted sampling
&lt;/h3&gt;

&lt;p&gt;For a weighted die or weighted category draw:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build cumulative weights&lt;/li&gt;
&lt;li&gt;Draw &lt;code&gt;u&lt;/code&gt; uniformly from &lt;code&gt;[0, total_weight)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use binary search to find the bucket&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This avoids expanding a list by weight, which breaks for large or non-integer weights.&lt;/p&gt;

&lt;p&gt;For repeated weighted draws, know the alias method at a high level: preprocess probabilities into tables, then sample in constant time after setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stratified sampling
&lt;/h3&gt;

&lt;p&gt;For imbalanced labels, sample within each class or segment. Then reweight metrics or losses using production prevalence. The trap is treating an oversampled training set as if it mirrors production.&lt;/p&gt;

&lt;p&gt;For imbalanced model evaluation, accuracy is often weak. Be ready to discuss &lt;code&gt;PR-AUC&lt;/code&gt;, recall@k, calibration, and cost-weighted loss.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Job application funnel cases
&lt;/h2&gt;

&lt;p&gt;A common LinkedIn onsite case is: "Applications dropped. Diagnose why."&lt;/p&gt;

&lt;p&gt;Do not jump to one explanation. Start by defining the metric:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total submitted applications?&lt;/li&gt;
&lt;li&gt;Unique applicants?&lt;/li&gt;
&lt;li&gt;Applications per active job seeker?&lt;/li&gt;
&lt;li&gt;Qualified applications?&lt;/li&gt;
&lt;li&gt;A specific geography, platform, or time period?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then decompose the funnel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;job_impressions
→ job_clicks
→ apply_starts
→ apply_submits
→ recruiter_responses
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Track both counts and conditional rates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CTR = job_clicks / job_impressions
apply_start_rate = apply_starts / job_clicks
submit_rate = apply_submits / apply_starts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A useful identity is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;applications =
active_job_seekers
× jobs_seen_per_seeker
× view_rate
× apply_start_rate
× submit_rate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps your answer grounded. A drop in total applications could come from fewer active seekers, fewer jobs shown, ranking changes, UX friction, expired job supply, logging changes, or seasonality.&lt;/p&gt;

&lt;p&gt;Segment with a hypothesis, not a giant list. Strong cuts for LinkedIn-style jobs cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Country&lt;/li&gt;
&lt;li&gt;Device&lt;/li&gt;
&lt;li&gt;Job function&lt;/li&gt;
&lt;li&gt;Seniority&lt;/li&gt;
&lt;li&gt;Industry&lt;/li&gt;
&lt;li&gt;New versus returning job seekers&lt;/li&gt;
&lt;li&gt;Paid versus organic jobs&lt;/li&gt;
&lt;li&gt;Remote versus onsite roles&lt;/li&gt;
&lt;li&gt;Recommended versus search traffic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cohorts matter too. Compare members active before the decline, newly active job seekers, and jobs posted in the same week. If only new cohorts are worse, onboarding, acquisition source, or fresh job supply may be the issue.&lt;/p&gt;

&lt;p&gt;Seasonality is a real confounder for hiring metrics. Compare year-over-year, same weekday, holiday-adjusted trends, and country-specific recruiting cycles.&lt;/p&gt;

&lt;p&gt;A good answer also checks instrumentation. Did &lt;code&gt;apply_submit&lt;/code&gt; logging change? Are external apply redirects missing? Are duplicates being counted differently?&lt;/p&gt;

&lt;p&gt;The quality tradeoff matters. More applications are not automatically better. If a recommender drives low-fit applications, recruiters may respond less and members may lose trust. Include downstream metrics like qualified applications, recruiter saves, messages, interviews, or negative feedback.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Evaluating a jobs recommender
&lt;/h2&gt;

&lt;p&gt;A related prompt is: "How would you evaluate Jobs You May Be Interested In?"&lt;/p&gt;

&lt;p&gt;Start with the outcome. The recommender should create value for members and employers. Online metrics might include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Job clicks per member&lt;/li&gt;
&lt;li&gt;Apply starts per member&lt;/li&gt;
&lt;li&gt;Apply submits per member&lt;/li&gt;
&lt;li&gt;Qualified applications&lt;/li&gt;
&lt;li&gt;Recruiter response rate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Offline ranking metrics can include precision@k, recall@k, NDCG, and calibration by job category.&lt;/p&gt;

&lt;p&gt;The main trap is optimizing clicks. A model can increase clicks by surfacing broadly appealing jobs while reducing completed applications if those jobs are poor fits. Tie recommender evaluation back to the funnel and guard against marketplace harm.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Product metrics and diagnostic analytics
&lt;/h2&gt;

&lt;p&gt;LinkedIn product cases often ask you to define success for a feed, profile, video, or B2B product. The interviewer wants to see whether you can build a metric framework and diagnose movement without relying on anecdotes.&lt;/p&gt;

&lt;p&gt;A useful structure:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Define the product goal&lt;/li&gt;
&lt;li&gt;Choose a primary metric&lt;/li&gt;
&lt;li&gt;Add guardrails&lt;/li&gt;
&lt;li&gt;Build a metric tree&lt;/li&gt;
&lt;li&gt;Validate instrumentation&lt;/li&gt;
&lt;li&gt;Segment based on plausible mechanisms&lt;/li&gt;
&lt;li&gt;Pick an experiment or causal design&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For a homepage feed, a metric tree might break engagement into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eligible users
× visit rate
× feed impressions per session
× engagement rate
× downstream quality
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Guardrails might include hides, spam reports, connection removals, latency, and creator concentration. A single engagement metric can be gamed by low-quality viral content, so quality checks are part of the answer.&lt;/p&gt;

&lt;p&gt;For profile completion, define the funnel precisely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;viewed prompt
→ clicked edit
→ added field
→ saved field
→ reached completion threshold
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the right denominator. If the question is about prompt performance, use eligible exposed members. If the question is population impact, use the broader member base.&lt;/p&gt;

&lt;p&gt;For B2B products, the unit of analysis may be account, seat, admin, or buyer. Average usage can hide that a few large accounts dominate totals, so inspect account-level adoption, seat activation, retention curves, and percentiles.&lt;/p&gt;

&lt;p&gt;If you want targeted drills for these patterns, the &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;PracHub interview questions library&lt;/a&gt; has practice prompts across SQL, product analytics, experimentation, ML, and coding.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Experimentation and causal reasoning
&lt;/h2&gt;

&lt;p&gt;For A/B tests, name the randomization unit. Member-level randomization works for many feed or profile changes. Account-level randomization may be better for B2B products because users inside the same account can influence each other.&lt;/p&gt;

&lt;p&gt;Use primary and guardrail metrics. Report effect size and confidence intervals, not just statistical significance. A tiny lift in clicks with a drop in submits is a bad trade if the goal is completed applications.&lt;/p&gt;

&lt;p&gt;If randomized evidence is unavailable, frame the causal question carefully. For a ranking launch, compare exposed versus unexposed users, pre/post trends, holdouts if available, or similar unaffected surfaces. Difference-in-differences is often a clean framing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;effect =
(treated_post - treated_pre)
-
(control_post - control_pre)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also watch for multiple comparisons during segmentation. If you inspect 100 segments, some will move by chance. Treat exploratory cuts as hypotheses that need validation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final prep advice
&lt;/h2&gt;

&lt;p&gt;For LinkedIn data scientist interviews, your answer should usually sound like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"First, I'd clarify the metric and time window."&lt;/li&gt;
&lt;li&gt;"Then I'd validate logging and denominator changes."&lt;/li&gt;
&lt;li&gt;"Next, I'd decompose the metric into a funnel or metric tree."&lt;/li&gt;
&lt;li&gt;"I'd segment based on plausible mechanisms and contribution to the total change."&lt;/li&gt;
&lt;li&gt;"Then I'd use experiment logs, holdouts, or quasi-experimental comparisons to test the leading hypotheses."&lt;/li&gt;
&lt;li&gt;"I'd include guardrails so we do not optimize short-term activity at the cost of long-term marketplace quality."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That structure works across SQL, funnel diagnosis, recommender evaluation, product metrics, and experimentation. For the full version with the original practice-card structure, use the &lt;a href="https://prachub.com/interview-prep/linkedin-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;PracHub LinkedIn Data Scientist interview prep cheatsheet&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>linkedin</category>
      <category>datascientist</category>
    </item>
    <item>
      <title>Product Diagnostics And Root Cause Analysis Explained — Tech Interview Concept (2026)</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 12 Aug 2026 14:28:02 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/product-diagnostics-and-root-cause-analysis-explained-tech-interview-concept-2026-11n3</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/product-diagnostics-and-root-cause-analysis-explained-tech-interview-concept-2026-11n3</guid>
      <description>&lt;p&gt;Product diagnostics interview questions often sound simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Ads revenue dropped 5%. How would you investigate?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A weak answer turns into a checklist: check seasonality, segment by country, look at app version, maybe inspect experiments. A strong answer has an order. Clarify the metric, rule out measurement failure, break down the movement, find the biggest contributors, then decide what evidence would prove or disprove each cause.&lt;/p&gt;

&lt;p&gt;This is a common Meta-style data science and product analytics interview pattern. PracHub covers this in more detail in its &lt;a href="https://prachub.com/concepts/product-diagnostics-and-root-cause-analysis?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;Product Diagnostics and Root Cause Analysis concept guide&lt;/a&gt;, but this post focuses on the interview version of the mental model.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the interviewer is really testing
&lt;/h2&gt;

&lt;p&gt;The interviewer wants to know if you can debug a product metric when the prompt is vague.&lt;/p&gt;

&lt;p&gt;You need to separate a few possibilities:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A broken metric or logging pipeline&lt;/li&gt;
&lt;li&gt;A real user behavior change&lt;/li&gt;
&lt;li&gt;A business or marketplace change outside the product itself&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;They are not looking for a memorized list of slices. They want to see if you understand metric definitions, logging systems, experiments, user identity, funnels, and business mechanics like ads auctions or retention cohorts.&lt;/p&gt;

&lt;p&gt;A good answer also separates speed from certainty. Some checks belong in the first hour. Some need a day of analysis. Some need a rollback, holdout, or quasi-experiment before you can call them causal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the metric definition
&lt;/h2&gt;

&lt;p&gt;Before diagnosing anything, pin down what moved.&lt;/p&gt;

&lt;p&gt;"Actives dropped 5%" is incomplete. You need to ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is this DAU, WAU, sessions, logged-in users, device-level users, or a rolling 7-day active metric?&lt;/li&gt;
&lt;li&gt;Is the 5% drop absolute or relative?&lt;/li&gt;
&lt;li&gt;What is the comparison baseline?&lt;/li&gt;
&lt;li&gt;Is it statistically meaningful compared with historical variance?&lt;/li&gt;
&lt;li&gt;What is the grain: user, account, device, session, event, or cohort?&lt;/li&gt;
&lt;li&gt;Is the metric computed from raw logs, curated tables, billing systems, or experiment dashboards?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Small definition changes can completely alter the diagnosis. A user-level active metric can fall while device-level activity stays flat if identity resolution changes. A rate can move because the denominator changed, even if the numerator is stable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule out instrumentation before product theories
&lt;/h2&gt;

&lt;p&gt;Do not start with "users dislike the new feature." First, check whether the data is trustworthy.&lt;/p&gt;

&lt;p&gt;Look at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raw event volume&lt;/li&gt;
&lt;li&gt;Null rates&lt;/li&gt;
&lt;li&gt;Schema changes&lt;/li&gt;
&lt;li&gt;Client-side versus server-side logging&lt;/li&gt;
&lt;li&gt;ETL delays&lt;/li&gt;
&lt;li&gt;Backfills&lt;/li&gt;
&lt;li&gt;Bot filtering&lt;/li&gt;
&lt;li&gt;Deduplication logic&lt;/li&gt;
&lt;li&gt;Timezone boundaries&lt;/li&gt;
&lt;li&gt;Event time versus ingestion time&lt;/li&gt;
&lt;li&gt;App version or SDK logging changes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A useful pattern is to compare raw facts with derived aggregates. If raw logs look stable but a dashboard metric moved, the issue may be pipeline logic. If both raw events and aggregates moved together, a real product or user behavior change is more likely.&lt;/p&gt;

&lt;p&gt;For SQL validation, start close to the source:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;DATE_TRUNC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'hour'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event_time&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;hour&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;event_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;platform&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;app_version&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;country&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;raw_events&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;event_time&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="k"&gt;CURRENT_DATE&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="s1"&gt;'3 days'&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At very large scale, exact &lt;code&gt;COUNT(DISTINCT)&lt;/code&gt; may be too expensive. Approximate sketches such as HyperLogLog can be acceptable when you need a directional answer quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decompose the metric
&lt;/h2&gt;

&lt;p&gt;After basic data checks, break the metric into mechanical drivers.&lt;/p&gt;

&lt;p&gt;For ads revenue, a simple decomposition is:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
\text{Revenue} =&lt;br&gt;
\text{Users}&lt;br&gt;
\times&lt;br&gt;
\text{Sessions/User}&lt;br&gt;
\times&lt;br&gt;
\text{Ad Impressions/Session}&lt;br&gt;
\times&lt;br&gt;
\text{Fill Rate}&lt;br&gt;
\times&lt;br&gt;
\text{CPM}/1000&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;Revenue can fall because fewer users visited, users had fewer sessions, ad opportunities dropped, fill rate fell, CPM dropped, advertiser budgets changed, or auction quality shifted.&lt;/p&gt;

&lt;p&gt;For retention, the definition may be:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
D7 = P(\text{return on day 7} \mid \text{new user on day 0})&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;That points you toward cohort entry, return event definition, delayed logging, acquisition mix, app quality, onboarding, and engagement.&lt;/p&gt;

&lt;p&gt;This decomposition prevents random guessing. First identify which component drove the movement. Then investigate that component.&lt;/p&gt;
&lt;h2&gt;
  
  
  Segment by contribution, not just percent change
&lt;/h2&gt;

&lt;p&gt;Segmentation matters, but many candidates do it poorly.&lt;/p&gt;

&lt;p&gt;A tiny segment can drop 80% and explain almost none of the total decline. A huge segment can drop 2% and explain most of it.&lt;/p&gt;

&lt;p&gt;For each segment, compute contribution:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
\frac{\Delta_i}{\Delta_{\text{total}}}&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;or:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
\frac{\Delta_i}{\sum_i \Delta_i}&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;Useful slices often include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Country&lt;/li&gt;
&lt;li&gt;Platform&lt;/li&gt;
&lt;li&gt;App version&lt;/li&gt;
&lt;li&gt;Product surface&lt;/li&gt;
&lt;li&gt;Acquisition source&lt;/li&gt;
&lt;li&gt;New versus returning users&lt;/li&gt;
&lt;li&gt;Experiment group&lt;/li&gt;
&lt;li&gt;Device class&lt;/li&gt;
&lt;li&gt;Advertiser vertical or campaign objective, for ads&lt;/li&gt;
&lt;li&gt;Cohort date, for retention&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Watch for Simpson's paradox. Aggregate trends can reverse when mix shifts across countries, platforms, or user types.&lt;/p&gt;
&lt;h2&gt;
  
  
  Use the right time-series baseline
&lt;/h2&gt;

&lt;p&gt;A metric drop only matters relative to a baseline.&lt;/p&gt;

&lt;p&gt;Compare against:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Same day of week&lt;/li&gt;
&lt;li&gt;Recent historical variance&lt;/li&gt;
&lt;li&gt;Holidays&lt;/li&gt;
&lt;li&gt;Product launch calendars&lt;/li&gt;
&lt;li&gt;Market events&lt;/li&gt;
&lt;li&gt;Country-specific events&lt;/li&gt;
&lt;li&gt;Prior seasonal patterns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For anomaly detection, avoid treating every dashboard wiggle like an incident. Depending on the metric, you can use confidence intervals, binomial approximations for rates, bootstrap intervals for non-normal metrics, or control limits such as:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
\mu \pm 3\sigma&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;At Meta-scale volume, tiny differences can be statistically significant while still being practically small. Interviewers like candidates who say this out loud.&lt;/p&gt;
&lt;h2&gt;
  
  
  Localize through the funnel
&lt;/h2&gt;

&lt;p&gt;A product metric is often the output of a user journey. Break the journey into steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exposure -&amp;gt; click/open -&amp;gt; load -&amp;gt; action -&amp;gt; success
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For actives or account switching, inspect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login success&lt;/li&gt;
&lt;li&gt;Session creation&lt;/li&gt;
&lt;li&gt;Identity resolution&lt;/li&gt;
&lt;li&gt;Account merge or split behavior&lt;/li&gt;
&lt;li&gt;Logout rates&lt;/li&gt;
&lt;li&gt;Cross-device activity&lt;/li&gt;
&lt;li&gt;Shared-device patterns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A rise in account switching could mean product friction, fraud, shared device usage, or a measurement reclassification. Localization tells you where to look next. It does not prove the root cause by itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check launches, experiments, and external factors
&lt;/h2&gt;

&lt;p&gt;Once you know what moved and where, compare the break point against known changes.&lt;/p&gt;

&lt;p&gt;Internal causes may include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Experiment ramps&lt;/li&gt;
&lt;li&gt;Feature flags&lt;/li&gt;
&lt;li&gt;App releases&lt;/li&gt;
&lt;li&gt;Ranking model pushes&lt;/li&gt;
&lt;li&gt;Ads auction changes&lt;/li&gt;
&lt;li&gt;Policy changes&lt;/li&gt;
&lt;li&gt;Outages&lt;/li&gt;
&lt;li&gt;Notification or email sends&lt;/li&gt;
&lt;li&gt;Logging SDK updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;External causes may include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Holidays&lt;/li&gt;
&lt;li&gt;Competitor launches&lt;/li&gt;
&lt;li&gt;Macro ad demand shifts&lt;/li&gt;
&lt;li&gt;OS changes&lt;/li&gt;
&lt;li&gt;Carrier outages&lt;/li&gt;
&lt;li&gt;Country-specific regulation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Experiments need special handling. If the drop is isolated to treatment, inspect ramp timing, guardrails, exposure logging, and heterogeneous treatment effects. If treatment and control drop at the same time, suspect external factors, shared infrastructure, or logging. In social products, interference can complicate interpretation because one user's treatment can affect another user's experience.&lt;/p&gt;

&lt;p&gt;If you want more practice with these interview pivots, PracHub has related &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;data science and product analytics interview questions&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Worked example: diagnosing an ads revenue drop
&lt;/h2&gt;

&lt;p&gt;Suppose the prompt is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Total ads revenue dropped yesterday. How would you diagnose it?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Start with clarifying questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How large is the drop?&lt;/li&gt;
&lt;li&gt;When did it start?&lt;/li&gt;
&lt;li&gt;Is it global or limited to a surface?&lt;/li&gt;
&lt;li&gt;Is "revenue" booked revenue, estimated revenue, or logged auction revenue?&lt;/li&gt;
&lt;li&gt;What baseline are we comparing against?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then state your plan:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Verify measurement&lt;/li&gt;
&lt;li&gt;Decompose revenue&lt;/li&gt;
&lt;li&gt;Localize the biggest contributors&lt;/li&gt;
&lt;li&gt;Compare against launches, incidents, and external signals&lt;/li&gt;
&lt;li&gt;Validate the most likely causes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For measurement, compare ad impression logs, auction logs, billing records, ETL freshness, currency conversion, and schema changes.&lt;/p&gt;

&lt;p&gt;For decomposition, check users, sessions per user, ad impressions per session, fill rate, bid density, CPM, click quality, conversion quality, and advertiser budget behavior.&lt;/p&gt;

&lt;p&gt;For segmentation, inspect country, platform, placement, advertiser vertical, campaign objective, new versus returning users, app version, and auction type.&lt;/p&gt;

&lt;p&gt;For validation, align the break point with product launches, ads ranking changes, policy enforcement, outages, and seasonality. If unaffected geos or placements exist, use them as controls.&lt;/p&gt;

&lt;p&gt;If the revenue drop aligns exactly with a ramped ads ranking launch, you might recommend a rollback during incident triage. But you should still quantify contribution and guard against confounding from weekends, holidays, or macro ad demand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Second example: low retention for a lightweight app
&lt;/h2&gt;

&lt;p&gt;Retention diagnostics are different because the metric is cohort-based.&lt;/p&gt;

&lt;p&gt;First define:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retention window, such as D1, D7, or D28&lt;/li&gt;
&lt;li&gt;Cohort entry event&lt;/li&gt;
&lt;li&gt;Return event&lt;/li&gt;
&lt;li&gt;Whether users are new installs, reactivations, or first successful logins&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then decompose the funnel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;install -&amp;gt; open -&amp;gt; signup/login -&amp;gt; feed load -&amp;gt; meaningful interaction -&amp;gt; return
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a lightweight Android app in emerging markets, useful segments include device RAM, OS version, network quality, app version, country, language, acquisition channel, crash rate, and cold-start latency.&lt;/p&gt;

&lt;p&gt;Retention analysis also needs care with right-censoring and delayed events. Recent cohorts may appear to have poor D7 retention simply because day 7 has not fully arrived or logs arrived late. Acquisition mix can also distort retention if a campaign brings in lower-intent users.&lt;/p&gt;

&lt;p&gt;A common product decision is whether to use D1 retention as an early signal or wait for D7 or D28 to avoid reacting to noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes to avoid
&lt;/h2&gt;

&lt;p&gt;The first mistake is jumping to a favorite cause before checking instrumentation. A better answer explicitly rules out logging, pipelines, denominators, and event delays before discussing user sentiment.&lt;/p&gt;

&lt;p&gt;The second mistake is listing segments without priority. Do not dump "country, platform, age, gender, app version" as a flat list. Explain your ordering: verify the metric, find the component that moved, segment the largest contributor, then test hypotheses against known changes.&lt;/p&gt;

&lt;p&gt;The third mistake is treating localization as causation. "The drop is mostly Android in India" is a finding, not a root cause. The next question is what changed for that segment: app release adoption, crash spikes, network latency, ranking rollout, carrier outage, ad demand shock, or logging SDK version.&lt;/p&gt;

&lt;h2&gt;
  
  
  A simple interview structure to remember
&lt;/h2&gt;

&lt;p&gt;Use this sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Define the metric precisely.&lt;/li&gt;
&lt;li&gt;Check data quality and instrumentation.&lt;/li&gt;
&lt;li&gt;Decompose the metric into drivers.&lt;/li&gt;
&lt;li&gt;Segment by contribution.&lt;/li&gt;
&lt;li&gt;Compare against time-series baselines.&lt;/li&gt;
&lt;li&gt;Map the movement to funnel steps.&lt;/li&gt;
&lt;li&gt;Check launches, incidents, experiments, and external events.&lt;/li&gt;
&lt;li&gt;Use causal methods or rollbacks when correlation is not enough.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That structure keeps your answer practical. It shows speed, but it also shows that you know when fast diagnosis is not the same as proof.&lt;/p&gt;

&lt;p&gt;For a fuller version of this framework, including Meta-style prompts and edge cases, read the PracHub guide on &lt;a href="https://prachub.com/concepts/product-diagnostics-and-root-cause-analysis?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;Product Diagnostics and Root Cause Analysis&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>programming</category>
      <category>tech</category>
    </item>
    <item>
      <title>TikTok Data Scientist Interview Cheatsheet 2026</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 05 Aug 2026 14:27:01 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/tiktok-data-scientist-interview-cheatsheet-2026-2b6d</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/tiktok-data-scientist-interview-cheatsheet-2026-2b6d</guid>
      <description>&lt;p&gt;TikTok Data Scientist interviews usually test product sense, causal reasoning, SQL, experiment design, and statistics. The tricky part is that the prompts can sound basic: calculate retention, analyze a funnel, design an A/B test, explain a metric tradeoff. Strong answers go past the query or formula and explain what decision the analysis supports.&lt;/p&gt;

&lt;p&gt;This guide adapts PracHub's &lt;a href="https://prachub.com/interview-prep/tiktok-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;TikTok Data Scientist interview prep cheatsheet&lt;/a&gt; into a standalone study plan for developer-community readers.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the interview is really testing
&lt;/h2&gt;

&lt;p&gt;A TikTok-style Data Scientist interview is rarely about memorizing definitions. You are being tested on whether you can reason from messy event data to a product decision.&lt;/p&gt;

&lt;p&gt;Expect questions across these areas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL and Python data manipulation&lt;/li&gt;
&lt;li&gt;Cohort, retention, funnel, and product metrics&lt;/li&gt;
&lt;li&gt;A/B testing and experiment design&lt;/li&gt;
&lt;li&gt;Power, diagnostics, and inference under noisy data&lt;/li&gt;
&lt;li&gt;Causal inference methods like matching and difference-in-differences&lt;/li&gt;
&lt;li&gt;Recommendation, ads ranking, and marketplace objectives&lt;/li&gt;
&lt;li&gt;Classification thresholds and imbalanced learning&lt;/li&gt;
&lt;li&gt;Communication with product and engineering partners&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The onsite rounds often combine several of these. A question about DAU and ad revenue, for example, is also a question about metric decomposition, segmentation, causal inference, and launch tradeoffs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cohorts, retention, funnels, and product metrics
&lt;/h2&gt;

&lt;p&gt;For product analytics questions, start by defining the unit and denominator. Many weak answers fail before the SQL starts because they count the wrong thing.&lt;/p&gt;

&lt;p&gt;A cohort groups users by a shared starting point, such as signup date, first app open, first post, first purchase, or first experiment exposure. Always clarify which one applies.&lt;/p&gt;

&lt;p&gt;A common cohort key is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="nb"&gt;DATE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event_ts&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;cohort_date&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;partitioned by &lt;code&gt;user_id&lt;/code&gt;, but the meaning depends on the product question.&lt;/p&gt;

&lt;p&gt;For day-N retention, the basic definition is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;day-N retention =
users active on cohort_date + N / users in cohort
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You still need to define "active." It could mean opening the app, watching a video, posting, liking, purchasing, or some other qualifying event.&lt;/p&gt;

&lt;p&gt;Also separate exact retention from rolling retention:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Day-7 exact retention: user was active exactly on day 7&lt;/li&gt;
&lt;li&gt;7-day rolling retention: user was active at least once from day 1 through day 7&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These answer different questions. Exact retention is closer to a habit signal. Rolling retention captures less frequent usage.&lt;/p&gt;

&lt;p&gt;Funnels have the same issue. A funnel such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;video_view -&amp;gt; profile_visit -&amp;gt; follow
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;can be measured at the user level, session level, or item level. The conversion rate can change a lot based on that choice.&lt;/p&gt;

&lt;p&gt;Temporal order matters. If you count unordered events, you will overstate conversion. Require each step to happen after the previous one, often with window functions such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;ROW_NUMBER&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;product_id&lt;/span&gt;
  &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;event_ts&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That lets you deduplicate repeated actions and enforce the sequence.&lt;/p&gt;

&lt;h2&gt;
  
  
  The DAU vs ad revenue question
&lt;/h2&gt;

&lt;p&gt;A common interview prompt is some version of: "DAU increased, but ad revenue decreased. How would you analyze it?"&lt;/p&gt;

&lt;p&gt;Do not jump straight to "optimize for growth" or "optimize for revenue." Break the metric apart.&lt;/p&gt;

&lt;p&gt;A useful decomposition is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Revenue =
DAU
x sessions per user
x impressions per session
x fill rate
x eCPM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can ask better questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did traffic grow, but from lower-monetizing regions?&lt;/li&gt;
&lt;li&gt;Did sessions per user fall?&lt;/li&gt;
&lt;li&gt;Did ad impressions per session decrease?&lt;/li&gt;
&lt;li&gt;Did auction pricing change?&lt;/li&gt;
&lt;li&gt;Did fill rate drop?&lt;/li&gt;
&lt;li&gt;Did new users retain worse than existing users?&lt;/li&gt;
&lt;li&gt;Did ad load changes affect watch time or churn?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A strong answer includes both objective metrics and guardrails. Objective metrics might include DAU, ad revenue, ARPDAU, retention, watch time, and ad impressions per user. Guardrails might include day-7 retention, session length, ad fatigue signals, and creator-side metrics if the feature affects posting supply.&lt;/p&gt;

&lt;p&gt;Segmentation is part of the core answer, not an optional add-on. Break results down by geography, acquisition source, user maturity, device, content vertical, and engagement level. A flat average can hide a traffic mix shift.&lt;/p&gt;

&lt;p&gt;Also watch for censoring. If today is May 23, users who joined on May 20 cannot have day-7 retention yet. Exclude immature cohorts or mark them incomplete. Do not treat missing future activity as churn.&lt;/p&gt;

&lt;h2&gt;
  
  
  A/B testing: design before math
&lt;/h2&gt;

&lt;p&gt;For experimentation questions, do not start with "randomize users 50/50." Start with the causal question.&lt;/p&gt;

&lt;p&gt;A good structure is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Objective&lt;/li&gt;
&lt;li&gt;Hypothesis&lt;/li&gt;
&lt;li&gt;Unit of randomization&lt;/li&gt;
&lt;li&gt;Eligibility and exposure&lt;/li&gt;
&lt;li&gt;Primary metric&lt;/li&gt;
&lt;li&gt;Guardrail metrics&lt;/li&gt;
&lt;li&gt;Power and minimum detectable effect&lt;/li&gt;
&lt;li&gt;Validity risks&lt;/li&gt;
&lt;li&gt;Analysis plan&lt;/li&gt;
&lt;li&gt;Decision rule&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The unit of randomization is a design choice. User-level randomization works when one user's treatment does not affect another user's outcome. That assumption can break in recommendation systems, creator ecosystems, and ad auctions.&lt;/p&gt;

&lt;p&gt;If treatment affects shared inventory, creator exposure, feed composition, or advertiser competition, consider cluster, geo, advertiser-level, or switchback designs.&lt;/p&gt;

&lt;p&gt;Eligibility and exposure rules also matter. For a For You feed experiment, assigned users are not the same as exposed users. A user may be assigned to treatment but never open the app or never see the new ranking behavior. Define both assignment and treatment exposure.&lt;/p&gt;

&lt;p&gt;Your metric hierarchy should match the decision:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Recommendation experiments: watch time per user, retention, sessions, like rate, hide rate, content diversity&lt;/li&gt;
&lt;li&gt;Monetization experiments: revenue per user, RPM, cost per conversion, advertiser ROAS&lt;/li&gt;
&lt;li&gt;Guardrails: report rate, crash rate, latency, not-interested rate, retention, creator concentration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Power should be discussed before launch. A common two-sample approximation is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;n ≈ 2σ²(z(1-α/2) + z(1-β))² / δ²
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where &lt;code&gt;δ&lt;/code&gt; is the minimum detectable effect. If you want to detect an effect half as large, you need roughly four times the sample size.&lt;/p&gt;

&lt;p&gt;Ratio metrics need care. Metrics like cost per conversion or watch time per session have random denominators. Look at numerator and denominator separately, or use methods like the delta method or bootstrap.&lt;/p&gt;

&lt;p&gt;CUPED can reduce variance by adjusting for pre-experiment behavior:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Y_adj = Y - θ(X - X_bar)
θ = Cov(Y, X) / Var(X)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works best when pre-period behavior predicts post-period outcomes, such as historical watch time predicting future watch time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interference, seasonality, and sequential peeking
&lt;/h2&gt;

&lt;p&gt;TikTok-style experiments often have interference. One user's treatment may change what content creators make, how inventory is allocated, or what untreated users see. If that risk is present, say so directly.&lt;/p&gt;

&lt;p&gt;Cluster randomization can reduce contamination, but it lowers power. The effective sample size depends on intra-cluster correlation. A common design effect is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DE = 1 + (m - 1)ρ
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where &lt;code&gt;m&lt;/code&gt; is average cluster size and &lt;code&gt;ρ&lt;/code&gt; is intra-cluster correlation.&lt;/p&gt;

&lt;p&gt;Seasonality also needs a real plan. Run treatment and control concurrently, cover full weekly cycles, and account for region, day of week, time zone, device, and traffic source when those affect the baseline.&lt;/p&gt;

&lt;p&gt;Sequential monitoring is another common trap. If you check results every day and stop as soon as &lt;code&gt;p &amp;lt; 0.05&lt;/code&gt;, your false positive rate is higher than 5%. Use a pre-planned monitoring rule, alpha spending, group sequential tests, or mark interim reads as exploratory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Statistics that come up often
&lt;/h2&gt;

&lt;p&gt;For binary outcomes like conversion, activation, or retention, the standard difference-in-proportions test is common:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SE = sqrt(
  pT(1 - pT) / nT +
  pC(1 - pC) / nC
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then compare:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(pT - pC) / SE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;against a normal approximation.&lt;/p&gt;

&lt;p&gt;For one-sample proportion tests, compare an observed rate against a benchmark. For example, if a campaign must exceed 60% conversion, test the observed conversion rate against &lt;code&gt;p0 = 0.60&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With clustered randomization, do not pretend millions of events are millions of independent observations. The unit of analysis should line up with the unit of randomization. You may need cluster-level aggregation or cluster-robust standard errors. With too few clusters, be cautious and consider small-sample corrections or randomization inference.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to answer in the interview
&lt;/h2&gt;

&lt;p&gt;For metric questions, use this pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Clarify the product setup.
Define the unit, denominator, and time window.
Write the metric logic.
Segment the result.
Check causality and bias.
Discuss decision and guardrails.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For experiment questions, use this pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Define the hypothesis.
Choose the randomization unit.
Define eligibility and exposure.
Pick primary and guardrail metrics.
Plan power and duration.
Call out interference and seasonality.
State the analysis and launch rule.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want more targeted prompts, PracHub has a bank of &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;data science interview practice questions&lt;/a&gt; that pairs well with this study plan.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final prep advice
&lt;/h2&gt;

&lt;p&gt;The best TikTok Data Scientist answers are precise. Define the metric before calculating it. Be explicit about correlation versus causation. Talk through tradeoffs without hand-waving. A statistically significant lift can still be a bad launch if guardrails move the wrong way.&lt;/p&gt;

&lt;p&gt;For the full version of the cheatsheet, including the original topic map and interview framing, use PracHub's &lt;a href="https://prachub.com/interview-prep/tiktok-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;TikTok Data Scientist interview prep guide&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>tiktok</category>
      <category>datascientist</category>
    </item>
    <item>
      <title>Multi-Tenant Isolation And Sandboxing Explained — Tech Interview Concept (2026)</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 29 Jul 2026 14:26:55 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/multi-tenant-isolation-and-sandboxing-explained-tech-interview-concept-2026-50d4</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/multi-tenant-isolation-and-sandboxing-explained-tech-interview-concept-2026-50d4</guid>
      <description>&lt;p&gt;Multi-tenant sandboxing questions are about boundaries. Can you run code, jobs, sessions, or agents for many customers on shared infrastructure without data leaks, secret exposure, or one tenant eating all the capacity?&lt;/p&gt;

&lt;p&gt;That is the core idea behind the original PracHub note on &lt;a href="https://prachub.com/concepts/multi-tenant-isolation-and-sandboxing?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;multi-tenant isolation and sandboxing&lt;/a&gt;. In interviews, this topic usually shows up as a system design prompt:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Design a cloud IDE&lt;/li&gt;
&lt;li&gt;Design a CI/CD runner&lt;/li&gt;
&lt;li&gt;Design a multi-tenant workspace app&lt;/li&gt;
&lt;li&gt;Design a sandbox for user-submitted code&lt;/li&gt;
&lt;li&gt;Design a tool execution layer for AI agents&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A weak answer says, "Add &lt;code&gt;tenant_id&lt;/code&gt; everywhere." A strong answer explains which boundary protects against which risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the threat model
&lt;/h2&gt;

&lt;p&gt;Before picking Kubernetes, Firecracker, or VMs, say what you are defending against.&lt;/p&gt;

&lt;p&gt;For a cloud IDE or CI/CD platform, assume user code is hostile. It may try to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read files from another tenant&lt;/li&gt;
&lt;li&gt;Escape the filesystem sandbox&lt;/li&gt;
&lt;li&gt;Abuse CPU or memory for crypto-mining&lt;/li&gt;
&lt;li&gt;Steal credentials from environment variables&lt;/li&gt;
&lt;li&gt;Call cloud metadata endpoints such as &lt;code&gt;169.254.169.254&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Scan internal services&lt;/li&gt;
&lt;li&gt;Poison a shared dependency cache&lt;/li&gt;
&lt;li&gt;Exploit a kernel or container runtime bug&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a normal SaaS workspace app, the threat model is different. You may care more about authorization bugs, stolen tokens, misconfigured admin access, and data leakage through logs or search indexes.&lt;/p&gt;

&lt;p&gt;Do not treat those as the same problem. That leads to bad designs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tenant isolation has layers
&lt;/h2&gt;

&lt;p&gt;Tenant isolation is not one control. It is a stack of controls across several layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identity: who is the caller?&lt;/li&gt;
&lt;li&gt;Authorization: what can the caller do?&lt;/li&gt;
&lt;li&gt;Data: which rows, objects, indexes, and backups can be accessed?&lt;/li&gt;
&lt;li&gt;Compute: where does code run?&lt;/li&gt;
&lt;li&gt;Network: what can the runtime connect to?&lt;/li&gt;
&lt;li&gt;Secrets: which credentials are available?&lt;/li&gt;
&lt;li&gt;Observability: what appears in logs, traces, metrics, and audits?&lt;/li&gt;
&lt;li&gt;Billing and quotas: who pays for the work, and who can consume capacity?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;tenant_id&lt;/code&gt; filtering in &lt;code&gt;Postgres&lt;/code&gt; helps with logical data isolation. It does not sandbox a build script. It does not stop SSRF. It does not cap CPU usage. It does not redact a secret from logs.&lt;/p&gt;

&lt;p&gt;Good interview answers make that distinction clear.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose the right isolation primitive
&lt;/h2&gt;

&lt;p&gt;Isolation primitives sit on a spectrum.&lt;/p&gt;

&lt;p&gt;Processes are cheap and fast, but they are weak for untrusted code. Containers add Linux namespaces and cgroups. MicroVMs, such as &lt;code&gt;Firecracker&lt;/code&gt;, reduce host kernel sharing compared with containers. Full VMs provide stronger separation, but startup time and memory overhead are higher.&lt;/p&gt;

&lt;p&gt;A practical answer often compares them like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Primitive&lt;/th&gt;
&lt;th&gt;Strength&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Process&lt;/td&gt;
&lt;td&gt;Low isolation&lt;/td&gt;
&lt;td&gt;Very low overhead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Container&lt;/td&gt;
&lt;td&gt;Namespaces, cgroups, image packaging&lt;/td&gt;
&lt;td&gt;Fast startup, shared kernel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MicroVM&lt;/td&gt;
&lt;td&gt;Stronger kernel boundary&lt;/td&gt;
&lt;td&gt;More overhead than containers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full VM&lt;/td&gt;
&lt;td&gt;Strong separation&lt;/td&gt;
&lt;td&gt;Higher startup and memory cost&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For an interactive cloud IDE, containers may give better startup latency and density. For arbitrary public workloads, microVMs may be worth the extra overhead. For regulated or high-risk tenants, full VMs or separate cloud accounts may be justified.&lt;/p&gt;

&lt;p&gt;Tie the primitive back to the product constraint. Think about latency, cost, workload duration, risk level, and tenant value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Know what namespaces and cgroups do
&lt;/h2&gt;

&lt;p&gt;If you mention containers, be ready to name the underlying controls.&lt;/p&gt;

&lt;p&gt;Linux namespaces isolate what a process can see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;pid&lt;/code&gt;: process tree&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;net&lt;/code&gt;: network interfaces and routing&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mnt&lt;/code&gt;: filesystem mounts&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;uts&lt;/code&gt;: hostname and domain name&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ipc&lt;/code&gt;: interprocess communication&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;user&lt;/code&gt;: user and group IDs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cgroup&lt;/code&gt;: cgroup hierarchy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;cgroups limit what a process can consume:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU shares&lt;/li&gt;
&lt;li&gt;Memory&lt;/li&gt;
&lt;li&gt;Process count&lt;/li&gt;
&lt;li&gt;I/O bandwidth&lt;/li&gt;
&lt;li&gt;Device access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A simple way to say it: namespaces hide resources, cgroups limit resources.&lt;/p&gt;

&lt;p&gt;For sandboxed execution, add hardening:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run as non-root&lt;/li&gt;
&lt;li&gt;Drop Linux capabilities such as &lt;code&gt;CAP_SYS_ADMIN&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use a deny-by-default &lt;code&gt;seccomp&lt;/code&gt; profile&lt;/li&gt;
&lt;li&gt;Apply &lt;code&gt;AppArmor&lt;/code&gt; or &lt;code&gt;SELinux&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Mount filesystems read-only where possible&lt;/li&gt;
&lt;li&gt;Reject privileged containers&lt;/li&gt;
&lt;li&gt;Avoid host mounts unless there is a very specific reason&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Saying "each job runs in a pod" is not enough. Pods share the host kernel, and unsafe pod settings can break your isolation model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resource fairness needs admission control
&lt;/h2&gt;

&lt;p&gt;Multi-tenant systems can fail even without an attacker. One tenant can start too many builds or keep too many IDE sessions open.&lt;/p&gt;

&lt;p&gt;You need admission control before scheduling work. A simple capacity model is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;concurrent_jobs &amp;lt;= floor(total_safe_capacity / per_job_reservation)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Per-tenant quotas&lt;/li&gt;
&lt;li&gt;Global queues&lt;/li&gt;
&lt;li&gt;Priority classes&lt;/li&gt;
&lt;li&gt;Burst limits&lt;/li&gt;
&lt;li&gt;Timeouts and TTLs&lt;/li&gt;
&lt;li&gt;Eviction rules for idle sessions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CI/CD systems care heavily about queue fairness. Cloud IDEs care about interactive latency and idle cleanup. Both need limits, or one tenant can become a noisy neighbor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data isolation is physical, logical, or hybrid
&lt;/h2&gt;

&lt;p&gt;There are three common data tenancy models.&lt;/p&gt;

&lt;p&gt;Separate databases per tenant reduce blast radius and can simplify deletion or export. The tradeoff is operational overhead.&lt;/p&gt;

&lt;p&gt;Shared tables with &lt;code&gt;tenant_id&lt;/code&gt; are easier to operate at scale, but every query and authorization path must be correct. Use composite indexes such as &lt;code&gt;(tenant_id, object_id)&lt;/code&gt;, and consider &lt;code&gt;Postgres&lt;/code&gt; row-level security as defense in depth.&lt;/p&gt;

&lt;p&gt;A hybrid model may put large or high-risk tenants in dedicated storage while smaller tenants share tables.&lt;/p&gt;

&lt;p&gt;The interview signal is not that one model is always best. The signal is that you can explain the tradeoff and add safeguards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authorization should fail closed
&lt;/h2&gt;

&lt;p&gt;Never trust a client-supplied &lt;code&gt;tenant_id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Derive tenant context from one of these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Session data&lt;/li&gt;
&lt;li&gt;Token claims&lt;/li&gt;
&lt;li&gt;Server-side membership lookup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then check permissions centrally. Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;workspace:read&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;workspace:write&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;runner:execute&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;artifact:download&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;admin:invite_user&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every request should carry an authenticated principal and tenant context. If the system cannot determine either one, deny the request.&lt;/p&gt;

&lt;p&gt;Cross-tenant authorization bugs are common because teams scatter permission checks across handlers. A central authorization layer reduces that risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use ephemeral runtimes for code execution
&lt;/h2&gt;

&lt;p&gt;Mutable shared workers are dangerous for CI/CD and cloud IDE workloads.&lt;/p&gt;

&lt;p&gt;A safer lifecycle looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a fresh runtime from a known image&lt;/li&gt;
&lt;li&gt;Attach only the credentials needed for this job or session&lt;/li&gt;
&lt;li&gt;Run the workload&lt;/li&gt;
&lt;li&gt;Stream logs and terminal output&lt;/li&gt;
&lt;li&gt;Persist declared artifacts or workspace changes&lt;/li&gt;
&lt;li&gt;Tear down the sandbox&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Warm pools can reduce startup time, but they must be scrubbed carefully before reuse. If you cannot prove cleanup is correct, prefer fresh environments.&lt;/p&gt;

&lt;p&gt;A useful state machine is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Queued -&amp;gt; Provisioning -&amp;gt; Running -&amp;gt; Stopping -&amp;gt; Persisting -&amp;gt; Terminated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add retries and cleanup for every transition. Orphaned sandboxes cost money and create risk, so use heartbeats, leases, TTLs, and a janitor process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Secrets are often the breach path
&lt;/h2&gt;

&lt;p&gt;Many sandbox escapes start with boring credential leakage.&lt;/p&gt;

&lt;p&gt;Do not bake secrets into images, dependency caches, or shared volumes. Inject short-lived credentials at runtime from &lt;code&gt;Vault&lt;/code&gt;, a cloud IAM system, or a secret manager.&lt;/p&gt;

&lt;p&gt;Scope credentials as tightly as possible:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tenant&lt;/li&gt;
&lt;li&gt;Repository&lt;/li&gt;
&lt;li&gt;Branch&lt;/li&gt;
&lt;li&gt;Job&lt;/li&gt;
&lt;li&gt;Environment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Redact secrets in logs. Treat terminal output, build logs, traces, and error reports as possible exfiltration channels.&lt;/p&gt;

&lt;h2&gt;
  
  
  Network isolation needs egress control
&lt;/h2&gt;

&lt;p&gt;A sandbox should not have broad network access by default.&lt;/p&gt;

&lt;p&gt;Use per-sandbox network namespaces, Kubernetes network policy, security groups, service mesh policy, or egress proxies. Block access to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cloud metadata endpoints such as &lt;code&gt;169.254.169.254&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Internal admin services&lt;/li&gt;
&lt;li&gt;Other tenants' private networks&lt;/li&gt;
&lt;li&gt;Control plane APIs unless explicitly allowed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ingress matters too, but egress is where many sandbox designs fail. If arbitrary code can reach internal services, SSRF becomes a real incident path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cache carefully
&lt;/h2&gt;

&lt;p&gt;Caches are great for build speed and infrastructure cost. They are also a common isolation footgun.&lt;/p&gt;

&lt;p&gt;Key dependency caches and Docker layer caches by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tenant&lt;/li&gt;
&lt;li&gt;Repository&lt;/li&gt;
&lt;li&gt;Lockfile hash&lt;/li&gt;
&lt;li&gt;Architecture&lt;/li&gt;
&lt;li&gt;Trust level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cross-tenant read-only public caches can be acceptable. Writable shared caches are risky because one tenant may poison dependencies or artifacts used by another.&lt;/p&gt;

&lt;p&gt;For CI/CD platforms, artifact integrity should be part of the design. Signed artifacts and strict cache keys are stronger than "we have a shared cache directory."&lt;/p&gt;

&lt;h2&gt;
  
  
  A strong cloud IDE answer
&lt;/h2&gt;

&lt;p&gt;For "Design a sandboxed cloud IDE," start with clarifying questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are users running arbitrary code?&lt;/li&gt;
&lt;li&gt;Do sessions need internet access?&lt;/li&gt;
&lt;li&gt;Which languages must be supported?&lt;/li&gt;
&lt;li&gt;Is the home directory persistent?&lt;/li&gt;
&lt;li&gt;What startup latency target matters, such as &lt;code&gt;p95 &amp;lt; 5s&lt;/code&gt;?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then structure the design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Control plane: authenticates users, maps users to tenants and workspaces, schedules sessions, stores metadata in &lt;code&gt;Postgres&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Execution plane: runs containers or microVMs on isolated node pools with cgroups, seccomp, non-root users, per-session networking, and TTL cleanup&lt;/li&gt;
&lt;li&gt;Persistence and streaming: stores workspace files on per-tenant volumes or object storage snapshots, streams terminal I/O through &lt;code&gt;WebSocket&lt;/code&gt; or server-sent events&lt;/li&gt;
&lt;li&gt;Operations: quotas, warm pools, autoscaling, audit logs, metrics, and janitor jobs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Call out the container versus microVM tradeoff. Containers are faster and denser. MicroVMs reduce kernel-sharing risk for arbitrary code. A tiered model is often the cleanest answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  A strong CI/CD answer
&lt;/h2&gt;

&lt;p&gt;For "Design a multi-tenant CI/CD platform," the same principles apply, but the workload is batch-oriented.&lt;/p&gt;

&lt;p&gt;Focus on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ephemeral runners&lt;/li&gt;
&lt;li&gt;Per-job credentials&lt;/li&gt;
&lt;li&gt;Tenant-scoped queues&lt;/li&gt;
&lt;li&gt;Fair scheduling&lt;/li&gt;
&lt;li&gt;Cache keys tied to lockfiles and trust boundaries&lt;/li&gt;
&lt;li&gt;Signed artifacts&lt;/li&gt;
&lt;li&gt;Strict teardown after each pipeline step&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The risks are malicious build scripts, dependency cache poisoning, secret exfiltration, and queue starvation.&lt;/p&gt;

&lt;p&gt;If you want more prompts in this area, PracHub has related &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;software engineering interview questions&lt;/a&gt; that pair well with this topic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;p&gt;The biggest mistake is treating &lt;code&gt;tenant_id&lt;/code&gt; as the full isolation story. It only covers part of data access.&lt;/p&gt;

&lt;p&gt;The second mistake is jumping to Kubernetes without naming the real security boundary. A pod is not automatically safe.&lt;/p&gt;

&lt;p&gt;The third mistake is choosing maximum isolation without product context. A full VM per request may be too slow or expensive for an IDE. A shared container may be too weak for hostile public code.&lt;/p&gt;

&lt;p&gt;A good answer layers controls and explains tradeoffs. Start with the threat model, pick the isolation primitive, lock down data and secrets, add quotas, restrict networking, and design cleanup as part of the system.&lt;/p&gt;

&lt;p&gt;For a more interview-focused version of this breakdown, see the original PracHub guide to &lt;a href="https://prachub.com/concepts/multi-tenant-isolation-and-sandboxing?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;multi-tenant isolation and sandboxing&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>systemdesign</category>
      <category>programming</category>
    </item>
    <item>
      <title>DoorDash Data Scientist Interview Cheatsheet 2026</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 22 Jul 2026 14:26:03 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/doordash-data-scientist-interview-cheatsheet-2026-25fi</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/doordash-data-scientist-interview-cheatsheet-2026-25fi</guid>
      <description>&lt;p&gt;DoorDash Data Scientist interviews usually test two things at the same time: can you write clean analytical code, and can you reason about a messy three-sided marketplace without acting like the data is cleaner than it is.&lt;/p&gt;

&lt;p&gt;If you are preparing for the 2026 cycle, the full &lt;a href="https://prachub.com/interview-prep/doordash-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;DoorDash Data Scientist interview prep cheatsheet on PracHub&lt;/a&gt; is a useful reference. This post condenses the main patterns into a standalone guide you can use while studying.&lt;/p&gt;

&lt;p&gt;The core areas are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SQL and Python data manipulation&lt;/li&gt;
&lt;li&gt;Window functions&lt;/li&gt;
&lt;li&gt;A/B testing&lt;/li&gt;
&lt;li&gt;Causal inference&lt;/li&gt;
&lt;li&gt;Marketplace metric design&lt;/li&gt;
&lt;li&gt;Delivery quality diagnostics&lt;/li&gt;
&lt;li&gt;Switchback experiments&lt;/li&gt;
&lt;li&gt;Unit economics, pricing, and power analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The main theme across all of them: DoorDash questions are rarely pure syntax questions. They are business analytics questions where the hard part is often defining the metric correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL: treat business definitions as part of the problem
&lt;/h2&gt;

&lt;p&gt;DoorDash SQL questions usually involve orders, customers, restaurants, Dashers, events, cities, and time. You may be asked to calculate monthly spend, identify top restaurants, compare customer behavior across periods, or derive delivery-quality metrics.&lt;/p&gt;

&lt;p&gt;The interviewer is checking whether you can turn vague business language into correct query logic.&lt;/p&gt;

&lt;p&gt;Before writing code, clarify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What counts as a completed order?&lt;/li&gt;
&lt;li&gt;Which timestamp should be used: created, confirmed, picked up, delivered, canceled?&lt;/li&gt;
&lt;li&gt;What timezone should reporting use?&lt;/li&gt;
&lt;li&gt;Are canceled or refunded orders included?&lt;/li&gt;
&lt;li&gt;Is the metric order-level, customer-level, restaurant-level, or market-level?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common SQL patterns include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;DATE_TRUNC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'month'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;created_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for monthly metrics,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;CASE&lt;/span&gt; &lt;span class="k"&gt;WHEN&lt;/span&gt; &lt;span class="n"&gt;condition&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;ELSE&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;END&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for rates, and &lt;code&gt;ROW_NUMBER&lt;/code&gt;, &lt;code&gt;RANK&lt;/code&gt;, or &lt;code&gt;DENSE_RANK&lt;/code&gt; for top-N queries.&lt;/p&gt;

&lt;p&gt;The mistake I see most often is row inflation after joins. If you join an order table to item-level or event-level data, &lt;code&gt;COUNT(*)&lt;/code&gt; may no longer mean number of orders. Use &lt;code&gt;COUNT(DISTINCT order_id)&lt;/code&gt; when the grain requires it.&lt;/p&gt;

&lt;p&gt;Also be careful with &lt;code&gt;LEFT JOIN&lt;/code&gt;. A filter in the &lt;code&gt;WHERE&lt;/code&gt; clause on the right-side table can turn it into an inner join and remove customers, restaurants, or cities with zero activity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Window functions: know the grain before ranking or comparing
&lt;/h2&gt;

&lt;p&gt;Window functions come up often because marketplace data is sequential. Customers reorder, Dashers receive dispatches, orders move through statuses, and restaurants have performance trends over time.&lt;/p&gt;

&lt;p&gt;You should be comfortable with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;LAG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;
  &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;order_ts&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for prior-order comparisons,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;LEAD&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for what happened after an event, and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;ROW_NUMBER&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;city_id&lt;/span&gt;
  &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;restaurant_id&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for deterministic top-N logic.&lt;/p&gt;

&lt;p&gt;A good answer explains tie behavior. If the interviewer asks for one top restaurant per city, &lt;code&gt;RANK()&lt;/code&gt; may return multiple rows. &lt;code&gt;ROW_NUMBER()&lt;/code&gt; with a stable tie-breaker is safer.&lt;/p&gt;

&lt;p&gt;For rolling or cumulative metrics, distinguish row-based windows from calendar-based windows. A "7-day rolling order count" is not the same as "last 7 rows." If the table has missing days, that difference matters.&lt;/p&gt;

&lt;p&gt;A reliable workflow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Aggregate to the right grain first, such as restaurant-day or customer-month.&lt;/li&gt;
&lt;li&gt;Apply window functions after that.&lt;/li&gt;
&lt;li&gt;Filter top-N results in an outer query or CTE.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That prevents mixing raw order rows with grouped metrics, which can duplicate revenue or distort rates.&lt;/p&gt;

&lt;h2&gt;
  
  
  A/B testing: user-level randomization is often wrong
&lt;/h2&gt;

&lt;p&gt;Many DoorDash experimentation questions are traps for people who default to "split users 50/50 and compare conversion."&lt;/p&gt;

&lt;p&gt;That can work for independent consumer UI changes. It can fail badly for marketplace interventions.&lt;/p&gt;

&lt;p&gt;If a change affects dispatch, batching, fees, delivery radius, Dasher incentives, or restaurant availability, one treated unit can affect untreated units. A treated order can change Dasher supply, merchant wait time, ETA accuracy, and customer experience nearby.&lt;/p&gt;

&lt;p&gt;That is interference, and it violates the usual assumption that one unit's treatment does not affect another unit's outcome.&lt;/p&gt;

&lt;p&gt;For marketplace changes, consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Geo-level randomization&lt;/li&gt;
&lt;li&gt;Market-level randomization&lt;/li&gt;
&lt;li&gt;Zone-level randomization&lt;/li&gt;
&lt;li&gt;Time-block randomization&lt;/li&gt;
&lt;li&gt;Geo-time switchback experiments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A switchback design might randomize treatment by &lt;code&gt;zone × time_block&lt;/code&gt;, such as 2-hour or 4-hour blocks. This is useful when market conditions differ across cities or zones, but the policy can alternate over time.&lt;/p&gt;

&lt;p&gt;A common analysis equation is:&lt;/p&gt;

&lt;p&gt;$$Y_{g,t}=\alpha_g+\gamma_t+\beta T_{g,t}+\epsilon_{g,t}$$&lt;/p&gt;

&lt;p&gt;where geography fixed effects control for persistent market differences, time fixed effects control for common time shocks, and treatment estimates the policy effect.&lt;/p&gt;

&lt;p&gt;Use clustered standard errors at the assignment level. If treatment was assigned by zone-hour, raw order count alone does not tell you the true amount of independent evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Power: millions of orders can still be underpowered
&lt;/h2&gt;

&lt;p&gt;Clustered experiments reduce effective sample size. If you randomize across 10 markets, you do not magically have millions of independent experimental units just because millions of orders occurred.&lt;/p&gt;

&lt;p&gt;A simple design effect is:&lt;/p&gt;

&lt;p&gt;$$DE = 1 + (m-1)\rho$$&lt;/p&gt;

&lt;p&gt;where &lt;code&gt;m&lt;/code&gt; is cluster size and &lt;code&gt;ρ&lt;/code&gt; is intra-cluster correlation.&lt;/p&gt;

&lt;p&gt;That means power depends on the number of independent clusters and the variance at that level. For switchbacks, use historical variance at the market-time or zone-time level.&lt;/p&gt;

&lt;p&gt;For a two-sample mean comparison, a rough sample size formula is:&lt;/p&gt;

&lt;p&gt;$$n \approx \frac{2\sigma^2(z_{1-\alpha/2}+z_{1-\beta})^2}{\delta^2}$$&lt;/p&gt;

&lt;p&gt;For proportions, replace variance with &lt;code&gt;p(1-p)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In an interview, you do not need to compute every value perfectly. You do need to say what minimum detectable effect matters, what variance estimate you would use, and how clustering changes the calculation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Metrics: pick one decision metric and guardrails
&lt;/h2&gt;

&lt;p&gt;DoorDash experiments often involve tradeoffs. A batching algorithm may raise orders per Dasher hour but hurt food quality. A promotion may improve D7 retention but increase refunds. A dispatch change may reduce delivery time while lowering Dasher earnings.&lt;/p&gt;

&lt;p&gt;A strong metric setup has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One primary decision metric&lt;/li&gt;
&lt;li&gt;Guardrail metrics&lt;/li&gt;
&lt;li&gt;Diagnostic metrics&lt;/li&gt;
&lt;li&gt;Pre-planned segments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For logistics changes, primary metrics might include delivery time, on-time rate, or contribution profit per order. Guardrails might include cancellation rate, merchant wait time, Dasher idle time, customer rating, refund rate, or reorder rate.&lt;/p&gt;

&lt;p&gt;Segments matter because effects can differ by market density, peak versus off-peak, new versus existing customers, restaurant category, distance band, Dasher mode, and supply-demand balance.&lt;/p&gt;

&lt;p&gt;Do not claim success from an aggregate lift if suburban zones degrade while dense urban zones improve. That is exactly the kind of marketplace reasoning interviewers expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Causal inference: start with the estimand
&lt;/h2&gt;

&lt;p&gt;Causal inference questions usually start with a metric change or a proposed rollout: late deliveries increased, a merchant variety launch changed retention, a new incentive changed Dasher behavior.&lt;/p&gt;

&lt;p&gt;Do not jump straight to a model. Start by defining the causal question.&lt;/p&gt;

&lt;p&gt;Are you estimating:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Average treatment effect?&lt;/li&gt;
&lt;li&gt;Treatment effect on treated?&lt;/li&gt;
&lt;li&gt;Segment-specific effect?&lt;/li&gt;
&lt;li&gt;Local effect for compliers?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then choose the method.&lt;/p&gt;

&lt;p&gt;Randomized experiments are best when feasible. If not, DoorDash-style questions often point toward difference-in-differences, matched controls, synthetic control, or staggered rollout analysis.&lt;/p&gt;

&lt;p&gt;For difference-in-differences:&lt;/p&gt;

&lt;p&gt;$$\hat{\tau} = (Y_{treated,post} - Y_{treated,pre}) - (Y_{control,post} - Y_{control,pre})$$&lt;/p&gt;

&lt;p&gt;The key assumption is parallel trends. You should say you would check pre-period trends, run placebo tests, and compare against matched markets.&lt;/p&gt;

&lt;p&gt;Regression adjustment can improve precision, but it does not remove bias by itself. Use pre-treatment covariates only. Controlling for post-treatment variables, such as actual delivery time, can block part of the treatment effect you are trying to measure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example: diagnosing late deliveries
&lt;/h2&gt;

&lt;p&gt;A good answer starts with definitions.&lt;/p&gt;

&lt;p&gt;"Late" could mean late relative to quoted ETA, promised delivery window, or food-ready time. The business may care about order-level lateness, customer perception, merchant SLA, or retention.&lt;/p&gt;

&lt;p&gt;Then decompose total delivery time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Merchant prep time&lt;/li&gt;
&lt;li&gt;Dasher assignment latency&lt;/li&gt;
&lt;li&gt;Travel to merchant&lt;/li&gt;
&lt;li&gt;Pickup wait&lt;/li&gt;
&lt;li&gt;Travel to customer&lt;/li&gt;
&lt;li&gt;Batching delay&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compare affected and unaffected markets, dayparts, merchant types, weather conditions, and distance bands. Once you have a leading hypothesis, choose the design.&lt;/p&gt;

&lt;p&gt;If prep-time estimates look wrong, test merchant-facing prep prompts or adjusted buffers. If Dasher supply is the issue, a zone-hour switchback test of incentives may fit better than customer-level randomization.&lt;/p&gt;

&lt;p&gt;The final recommendation should tie back to launch criteria: reduce late rate without hurting Dasher earnings, merchant wait, cancellations, refunds, or contribution margin.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to practice
&lt;/h2&gt;

&lt;p&gt;For SQL, practice joins, conditional aggregation, date grouping, ranking, rolling metrics, and percentiles. For experimentation, practice explaining why user-level randomization may fail and how switchbacks work. For causal inference, practice turning a vague metric movement into a clear estimand, method, and decision.&lt;/p&gt;

&lt;p&gt;You can find related DoorDash-style and marketplace analytics prompts in the &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;PracHub interview questions library&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want the full structured version with topic-by-topic practice cards, use the &lt;a href="https://prachub.com/interview-prep/doordash-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;DoorDash Data Scientist interview prep cheatsheet&lt;/a&gt; as your study checklist.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>doordash</category>
      <category>datascientist</category>
    </item>
    <item>
      <title>Supervised ML Fundamentals, Evaluation And Feature Engineering Explained — Tech Interview Concept (2026)</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 15 Jul 2026 14:25:45 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/supervised-ml-fundamentals-evaluation-and-feature-engineering-explained-tech-interview-concept-3g90</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/supervised-ml-fundamentals-evaluation-and-feature-engineering-explained-tech-interview-concept-3g90</guid>
      <description>&lt;p&gt;Supervised ML interview questions usually are not about reciting definitions. The better signal is whether you can pick a model, design the evaluation, explain tradeoffs, and tie the choice to business cost.&lt;/p&gt;

&lt;p&gt;If you want the original interview-focused version, PracHub has a concise concept page on &lt;a href="https://prachub.com/concepts/supervised-ml-fundamentals-evaluation-and-feature-engineering?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;supervised ML fundamentals, evaluation, and feature engineering&lt;/a&gt;. This post rewrites the same ideas as a practical guide for developer and data science readers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the decision context
&lt;/h2&gt;

&lt;p&gt;Before comparing algorithms, ask what the model output is used for.&lt;/p&gt;

&lt;p&gt;Are you optimizing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Probability accuracy?&lt;/li&gt;
&lt;li&gt;Ranking quality?&lt;/li&gt;
&lt;li&gt;Forecast accuracy?&lt;/li&gt;
&lt;li&gt;A hard business action, such as block, approve, alert, or reorder?&lt;/li&gt;
&lt;li&gt;Interpretability for product, operations, or compliance teams?&lt;/li&gt;
&lt;li&gt;Low-latency scoring?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That question changes the model and the evaluation.&lt;/p&gt;

&lt;p&gt;A fraud model with a rare positive class should not be judged by raw accuracy. A demand forecast should not use random cross-validation if time order matters. A conversion model used for bidding may need calibrated probabilities, while a search relevance model may care more about ranking metrics.&lt;/p&gt;

&lt;p&gt;A good interview answer often starts with: "I would first clarify whether we need calibrated probabilities, ranking quality, forecast accuracy, or an action threshold tied to business cost."&lt;/p&gt;

&lt;h2&gt;
  
  
  Linear and logistic regression are still worth knowing well
&lt;/h2&gt;

&lt;p&gt;Linear regression estimates coefficients by minimizing squared error:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
\min_\beta \sum_i (y_i - x_i^\top\beta)^2&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;The classic assumptions are linearity, independent errors, homoscedasticity, no perfect multicollinearity, and exogeneity:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
E[\epsilon \mid X]=0&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;Breaking these assumptions does not automatically make predictions useless. It does affect inference, confidence intervals, and how much you should trust coefficient interpretation.&lt;/p&gt;

&lt;p&gt;Logistic regression models class probability as:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
P(y=1 \mid x)=\sigma(x^\top\beta)&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;It minimizes log loss, not squared error. In tabular classification, logistic regression is often a strong baseline, especially with sparse high-dimensional features. It is also easier to explain and often better calibrated than many complex models out of the box.&lt;/p&gt;

&lt;p&gt;Do not skip the baseline. If a boosted tree barely beats regularized logistic regression but is harder to explain, slower to score, and poorly calibrated, the simpler model may be the better production choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Regularization is about controlling variance
&lt;/h2&gt;

&lt;p&gt;Regularization penalizes model complexity to reduce overfitting.&lt;/p&gt;

&lt;p&gt;Common forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;L2 regularization adds $\lambda|\beta|_2^2$. It shrinks coefficients smoothly and works well with correlated predictors.&lt;/li&gt;
&lt;li&gt;L1 regularization adds $\lambda|\beta|_1$. It can set coefficients to zero, which makes it useful for sparse feature selection.&lt;/li&gt;
&lt;li&gt;Elastic Net combines L1 and L2. It is useful when groups of correlated predictors are present.&lt;/li&gt;
&lt;li&gt;L0 regularization counts nonzero coefficients, $|\beta|_0$. It directly targets subset selection, but exact optimization is usually combinatorial.&lt;/li&gt;
&lt;li&gt;L∞ regularization constrains the maximum absolute coefficient. It is less common in applied interviews, but it tests whether you understand norm geometry and constraints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feature scaling matters here. If one feature is measured in cents and another in years, a regularization penalty treats their coefficients differently unless you scale the inputs. Scaling is also needed for distance-based models and many gradient-based linear models.&lt;/p&gt;

&lt;p&gt;Tree models such as Random Forests, Gradient Boosted Trees, &lt;code&gt;XGBoost&lt;/code&gt;, and &lt;code&gt;LightGBM&lt;/code&gt; are mostly invariant to monotonic scaling. Transformations can still help with outliers or skewed distributions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Random Forests vs Gradient Boosting
&lt;/h2&gt;

&lt;p&gt;This is a common interview comparison because both are tree ensembles, but they behave differently.&lt;/p&gt;

&lt;p&gt;Random Forests reduce variance through bagging. They train many decorrelated trees on bootstrap samples and random subsets of predictors. They are stable, parallelizable, and less sensitive to hyperparameter settings. They are often a safe first model when labels are noisy or you need a benchmark that does not take much tuning.&lt;/p&gt;

&lt;p&gt;Gradient Boosting trains trees sequentially. Each new tree fits residuals or gradients from the current model. This tends to reduce bias and often works very well on structured tabular data. &lt;code&gt;XGBoost&lt;/code&gt; and &lt;code&gt;LightGBM&lt;/code&gt; are common examples.&lt;/p&gt;

&lt;p&gt;The tradeoff is tuning. Boosted trees need careful control of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learning rate&lt;/li&gt;
&lt;li&gt;Number of trees&lt;/li&gt;
&lt;li&gt;Max depth&lt;/li&gt;
&lt;li&gt;Subsampling&lt;/li&gt;
&lt;li&gt;Column sampling&lt;/li&gt;
&lt;li&gt;Early stopping&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If trees are too deep or boosting rounds run too long, boosted models can overfit label noise.&lt;/p&gt;

&lt;p&gt;A solid answer sounds like this:&lt;/p&gt;

&lt;p&gt;"Random Forests mainly reduce variance through bagging, while Gradient Boosted Trees reduce bias through sequential additive learning. I would compare them based on predictive performance, sensitivity to noisy data, tuning cost, calibration, and the business metric. Boosted trees may win on &lt;code&gt;PR-AUC&lt;/code&gt; or lift, but Random Forests may be easier to tune and less brittle."&lt;/p&gt;

&lt;p&gt;That answer is much better than "Gradient Boosting is more accurate" or "Random Forests avoid overfitting."&lt;/p&gt;

&lt;h2&gt;
  
  
  Class imbalance changes the metric
&lt;/h2&gt;

&lt;p&gt;Accuracy is a trap when positives are rare.&lt;/p&gt;

&lt;p&gt;If the positive class rate is 0.5%, a classifier that always predicts negative gets 99.5% accuracy. That number is useless.&lt;/p&gt;

&lt;p&gt;For imbalanced classification, consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;precision&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;recall&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;F1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;PR-AUC&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Top-k lift&lt;/li&gt;
&lt;li&gt;Recall at fixed precision&lt;/li&gt;
&lt;li&gt;Cost-weighted metrics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;ROC-AUC&lt;/code&gt; can also mislead when positives are extremely rare. A model can have a strong &lt;code&gt;ROC-AUC&lt;/code&gt; while precision is too low for production use.&lt;/p&gt;

&lt;p&gt;Sampling and class weights can help training, but they do not replace a good evaluation plan. You still need to choose a decision threshold based on cost.&lt;/p&gt;

&lt;p&gt;For example, a fraud model might optimize:&lt;/p&gt;

&lt;p&gt;$$&lt;br&gt;
EV(t)=TP(t)\cdot B - FP(t)\cdot C - FN(t)\cdot L&lt;br&gt;
$$&lt;/p&gt;

&lt;p&gt;Here, $t$ is the threshold, $B$ is the benefit of catching fraud, $C$ is the cost of a false positive, and $L$ is the loss from a false negative.&lt;/p&gt;

&lt;p&gt;The model produces scores or probabilities. The threshold is a business policy layered on top.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calibration matters when probabilities drive decisions
&lt;/h2&gt;

&lt;p&gt;Ranking quality and probability accuracy are different.&lt;/p&gt;

&lt;p&gt;A model can rank cases well but produce poorly calibrated probabilities. That may be fine for a top-k review queue. It is a problem if probabilities feed expected-value calculations, capacity planning, pricing, or downstream decision systems.&lt;/p&gt;

&lt;p&gt;Logistic regression is often reasonably calibrated. Boosted trees may need Platt scaling or isotonic regression.&lt;/p&gt;

&lt;p&gt;Useful calibration checks include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calibration curves&lt;/li&gt;
&lt;li&gt;Brier score&lt;/li&gt;
&lt;li&gt;Observed vs predicted rates by score bucket&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a bucket of users predicted at 20% conversion actually converts at 8%, that model may still rank users well, but its probabilities are not reliable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Time-series forecasting needs temporal validation
&lt;/h2&gt;

&lt;p&gt;Forecasting has a different data-generating process from ordinary tabular classification.&lt;/p&gt;

&lt;p&gt;Random train/test splits leak future information. They can make a weak model look strong, especially when seasonality, promotions, customer behavior shifts, or inventory effects are present.&lt;/p&gt;

&lt;p&gt;Use temporal validation, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A simple holdout from a later time period&lt;/li&gt;
&lt;li&gt;Rolling-origin evaluation&lt;/li&gt;
&lt;li&gt;Backtesting across several forecast windows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before using complex models, compare against simple baselines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Seasonal naive&lt;/li&gt;
&lt;li&gt;Moving average&lt;/li&gt;
&lt;li&gt;Simple exponential smoothing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then test models such as &lt;code&gt;ARIMA&lt;/code&gt;, &lt;code&gt;Prophet&lt;/code&gt;, tree models with lagged variables, or sequence models if the problem calls for them.&lt;/p&gt;

&lt;p&gt;Metrics should match the operational decision. For demand forecasting, common choices include &lt;code&gt;WAPE&lt;/code&gt;, &lt;code&gt;sMAPE&lt;/code&gt;, pinball loss, or a service-level cost tied to stockouts and overstock.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feature engineering without leakage
&lt;/h2&gt;

&lt;p&gt;Feature engineering should encode signal available at prediction time. That last phrase matters.&lt;/p&gt;

&lt;p&gt;Common tabular features include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lagged demand&lt;/li&gt;
&lt;li&gt;Rolling means&lt;/li&gt;
&lt;li&gt;Customer tenure&lt;/li&gt;
&lt;li&gt;Frequency counts&lt;/li&gt;
&lt;li&gt;Recency&lt;/li&gt;
&lt;li&gt;Price bands&lt;/li&gt;
&lt;li&gt;Target encodings for categoricals&lt;/li&gt;
&lt;li&gt;Missingness indicators&lt;/li&gt;
&lt;li&gt;Log-transformed monetary values&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The risk is leakage. If you compute a rolling average using data after the prediction timestamp, you have leaked future information. If you use target encoding without proper out-of-fold or time-aware computation, the model may learn the answer indirectly.&lt;/p&gt;

&lt;p&gt;For repeated entities, grouped splits may be needed. For time-dependent data, temporal holdouts are safer than random splits. Segment-level error checks can also reveal that a model works overall but fails for a product category, region, or customer group.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to answer this in an interview
&lt;/h2&gt;

&lt;p&gt;A strong structure is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clarify the target and decision use.&lt;/li&gt;
&lt;li&gt;Describe the data conditions: size, sparsity, label noise, missingness, class balance, time dependence.&lt;/li&gt;
&lt;li&gt;Pick baselines first.&lt;/li&gt;
&lt;li&gt;Compare model families conditionally.&lt;/li&gt;
&lt;li&gt;Choose metrics tied to business cost.&lt;/li&gt;
&lt;li&gt;Discuss calibration, thresholds, and validation design.&lt;/li&gt;
&lt;li&gt;Name leakage risks.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;"I would start with regularized logistic regression as a baseline because it is interpretable and often well calibrated. I would compare Random Forests and Gradient Boosted Trees using a temporally held-out set if time matters. Since positives are rare, I would use &lt;code&gt;PR-AUC&lt;/code&gt;, recall at fixed precision, and expected cost rather than accuracy. If probabilities drive actions, I would check calibration and apply Platt scaling or isotonic regression if needed."&lt;/p&gt;

&lt;p&gt;That answer shows model knowledge, evaluation judgment, and production awareness.&lt;/p&gt;

&lt;p&gt;For more interview prompts around these topics, PracHub has a set of &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;technical interview practice questions&lt;/a&gt; you can use to test your reasoning under pressure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes to avoid
&lt;/h2&gt;

&lt;p&gt;Using accuracy by default.&lt;br&gt;&lt;br&gt;
Accuracy is often the wrong metric for imbalanced classification.&lt;/p&gt;

&lt;p&gt;Comparing models without conditions.&lt;br&gt;&lt;br&gt;
"XGBoost is better" is not enough. Better for what data, what metric, what latency limit, and what decision?&lt;/p&gt;

&lt;p&gt;Ignoring validation design.&lt;br&gt;&lt;br&gt;
Random splits can leak information in time-series and repeated-entity problems.&lt;/p&gt;

&lt;p&gt;Forgetting calibration.&lt;br&gt;&lt;br&gt;
A high-ranking model may still produce bad probabilities.&lt;/p&gt;

&lt;p&gt;Treating feature engineering as harmless.&lt;br&gt;&lt;br&gt;
Rolling features, target encodings, and aggregations can leak future or label information if computed incorrectly.&lt;/p&gt;

&lt;p&gt;If you want the original concept-card version with the compact interview framing, see PracHub's post on &lt;a href="https://prachub.com/concepts/supervised-ml-fundamentals-evaluation-and-feature-engineering?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;supervised ML fundamentals, evaluation, and feature engineering&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>machinelearning</category>
      <category>programming</category>
    </item>
    <item>
      <title>Amazon Data Scientist Interview Cheatsheet 2026</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 08 Jul 2026 14:25:57 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/amazon-data-scientist-interview-cheatsheet-2026-3e7m</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/amazon-data-scientist-interview-cheatsheet-2026-3e7m</guid>
      <description>&lt;p&gt;Amazon Data Scientist interviews test whether you can turn messy data into a product decision you can defend. You need SQL or pandas fluency, experiment design, metric judgment, ML fundamentals, and clear communication when the prompt is underspecified.&lt;/p&gt;

&lt;p&gt;This post is a condensed, blog-friendly version of the &lt;a href="https://prachub.com/interview-prep/amazon-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;PracHub Amazon Data Scientist interview cheatsheet&lt;/a&gt;, focused on the parts that tend to separate candidates who have done real analysis from candidates who only know textbook definitions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Amazon is usually testing
&lt;/h2&gt;

&lt;p&gt;The interview loop can cover several areas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data manipulation with SQL and Python&lt;/li&gt;
&lt;li&gt;Product analytics and root-cause analysis&lt;/li&gt;
&lt;li&gt;A/B testing and statistical inference&lt;/li&gt;
&lt;li&gt;Machine learning fundamentals and evaluation&lt;/li&gt;
&lt;li&gt;Applied ML system thinking, including RAG&lt;/li&gt;
&lt;li&gt;Behavioral answers mapped to Amazon Leadership Principles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The bar is not "can you recite a formula?" It is closer to: can you define the right metric, compute it correctly, explain your assumptions, catch validity problems, and recommend an action?&lt;/p&gt;

&lt;h2&gt;
  
  
  Python and pandas: show that your metrics are trustworthy
&lt;/h2&gt;

&lt;p&gt;For pandas questions, interviewers want analysis-grade data manipulation. Expect messy inputs, duplicate rows, mixed date formats, joins across tables, missing values, and business logic hidden in the prompt.&lt;/p&gt;

&lt;p&gt;Common pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;agg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;revenue&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sum&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;order_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;nunique&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;customers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;customer_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;nunique&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That code is easy. The interview is about whether the aggregation is valid.&lt;/p&gt;

&lt;p&gt;Before grouping, ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the row grain?&lt;/li&gt;
&lt;li&gt;Are there duplicate events or repeated order lines?&lt;/li&gt;
&lt;li&gt;Are timestamps in the same timezone?&lt;/li&gt;
&lt;li&gt;Are we joining many-to-one, one-to-many, or many-to-many?&lt;/li&gt;
&lt;li&gt;Do we need currency normalization before summing revenue?&lt;/li&gt;
&lt;li&gt;How should ties be handled in rankings?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good answer sounds like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I would first validate the grain. If this table is order-line level, I should not count rows as orders. I would count distinct order IDs, normalize currency through the exchange-rate table, then aggregate by customer and month."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That shows you know metric code can be syntactically correct and still wrong.&lt;/p&gt;

&lt;p&gt;Useful pandas tools to have ready:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;pd.to_datetime()&lt;/code&gt; for date cleanup&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.dt.date&lt;/code&gt;, &lt;code&gt;.dt.to_period("M")&lt;/code&gt; for time buckets&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;merge()&lt;/code&gt; for lookup joins&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;drop_duplicates()&lt;/code&gt; for business-key dedupe&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rank()&lt;/code&gt;, &lt;code&gt;sort_values()&lt;/code&gt;, &lt;code&gt;cumcount()&lt;/code&gt; for within-group ranking&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;np.where()&lt;/code&gt;, &lt;code&gt;pd.cut()&lt;/code&gt;, boolean masks for segments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The biggest mistake is aggregating before fixing grain. Once duplicate rows flow into your metric table, every chart and model downstream inherits the error.&lt;/p&gt;

&lt;h2&gt;
  
  
  A/B testing: do not jump straight to p-values
&lt;/h2&gt;

&lt;p&gt;Amazon-style experimentation questions usually ask you to design or analyze an online controlled experiment. The interviewer is testing causal reasoning, metric design, statistical mechanics, and judgment.&lt;/p&gt;

&lt;p&gt;Start with clarification:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the randomization unit: user, session, product, request?&lt;/li&gt;
&lt;li&gt;What is the primary metric?&lt;/li&gt;
&lt;li&gt;What are the guardrails?&lt;/li&gt;
&lt;li&gt;Is the assignment stable?&lt;/li&gt;
&lt;li&gt;Is the analysis window long enough for delayed outcomes?&lt;/li&gt;
&lt;li&gt;Are users counted once or multiple times?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a binary metric, such as conversion, you may compute:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Control rate: &lt;code&gt;x_c / n_c&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Treatment rate: &lt;code&gt;x_t / n_t&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Absolute lift: &lt;code&gt;p_t - p_c&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Relative lift: &lt;code&gt;(p_t - p_c) / p_c&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Confidence interval for the difference&lt;/li&gt;
&lt;li&gt;Two-proportion z-test, if sample size assumptions are reasonable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But a better interview answer does not stop there.&lt;/p&gt;

&lt;p&gt;Before inference, check validity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sample ratio mismatch&lt;/li&gt;
&lt;li&gt;Exposure logging gaps&lt;/li&gt;
&lt;li&gt;Duplicate users&lt;/li&gt;
&lt;li&gt;Bot or internal traffic&lt;/li&gt;
&lt;li&gt;Pre-period balance&lt;/li&gt;
&lt;li&gt;Metric denominator consistency&lt;/li&gt;
&lt;li&gt;Unit mismatch between randomization and analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A weak answer is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Treatment conversion is higher and p &amp;lt; 0.05, so launch."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A better answer is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I would first verify the planned traffic split and user-level assignment. Then I would estimate absolute and relative lift with a confidence interval. I would launch only if the lift is statistically and practically meaningful, guardrails such as latency and refund rate are neutral, and the result is stable across major pre-specified cohorts."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That last part matters. At Amazon scale, a tiny lift can be statistically significant. It still may not be worth shipping if it harms customer trust, latency, complaints, or downstream outcomes.&lt;/p&gt;

&lt;p&gt;For sample size questions, ask for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Baseline conversion rate&lt;/li&gt;
&lt;li&gt;Minimum detectable effect&lt;/li&gt;
&lt;li&gt;Alpha&lt;/li&gt;
&lt;li&gt;Desired power&lt;/li&gt;
&lt;li&gt;Number of variants&lt;/li&gt;
&lt;li&gt;Metric type: binary, continuous, ratio-based, clustered&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then define the decision rule before the data arrives. For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Ship if the 95% confidence interval excludes zero, the lower bound is above the practical threshold, and guardrail metrics stay within agreed limits."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Product metrics and root-cause analysis: build the metric tree
&lt;/h2&gt;

&lt;p&gt;Product analytics questions often start with a vague movement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Revenue dropped."&lt;/li&gt;
&lt;li&gt;"CTR is down."&lt;/li&gt;
&lt;li&gt;"Search conversion changed."&lt;/li&gt;
&lt;li&gt;"A dashboard metric spiked."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not start with random theories. Start by defining the metric and decomposing it.&lt;/p&gt;

&lt;p&gt;For revenue, a simple tree might be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Revenue = Traffic × Conversion Rate × Average Order Value
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then break each branch down:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Traffic:
- visits
- unique customers
- channel mix
- device mix

Conversion:
- product views
- add-to-cart rate
- checkout start rate
- order completion rate

Average Order Value:
- item price
- units per order
- discounts
- shipping or fees
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Good root-cause analysis usually follows this flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Confirm the metric definition.&lt;/li&gt;
&lt;li&gt;Check data quality and pipeline changes.&lt;/li&gt;
&lt;li&gt;Compare time windows correctly.&lt;/li&gt;
&lt;li&gt;Segment by product, geography, device, customer type, traffic source, or cohort.&lt;/li&gt;
&lt;li&gt;Separate correlation from causal claims.&lt;/li&gt;
&lt;li&gt;Use visualizations that match the question.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Dashboard tooling can mislead if joins, filters, and aggregation grain are wrong. If a Tableau chart says revenue dropped, you still need to know whether it uses order date or shipment date, whether canceled orders are included, and whether currency conversion happened before or after aggregation.&lt;/p&gt;

&lt;h2&gt;
  
  
  RAG questions: treat it as an ML system, not "add a vector database"
&lt;/h2&gt;

&lt;p&gt;Retrieval-augmented generation is now fair game for Data Scientist interviews. The DS angle is less about serving infrastructure and more about evaluation, tradeoffs, and risk.&lt;/p&gt;

&lt;p&gt;A typical RAG pipeline has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Document selection&lt;/li&gt;
&lt;li&gt;Chunking&lt;/li&gt;
&lt;li&gt;Embeddings&lt;/li&gt;
&lt;li&gt;Vector retrieval&lt;/li&gt;
&lt;li&gt;Optional lexical retrieval such as BM25&lt;/li&gt;
&lt;li&gt;Reranking&lt;/li&gt;
&lt;li&gt;Prompt construction&lt;/li&gt;
&lt;li&gt;Generation&lt;/li&gt;
&lt;li&gt;Post-generation validation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If asked to design or evaluate a RAG system, frame the use case first:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What corpus are we answering from? How fresh is it? What is the cost of a wrong answer? Do we need citations? Are out-of-scope questions common?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then split evaluation into retrieval quality and answer quality.&lt;/p&gt;

&lt;p&gt;Retrieval metrics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Recall@k&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Precision@k&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;MRR&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nDCG@k&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Answer metrics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Correctness&lt;/li&gt;
&lt;li&gt;Faithfulness to retrieved context&lt;/li&gt;
&lt;li&gt;Citation accuracy&lt;/li&gt;
&lt;li&gt;Coverage&lt;/li&gt;
&lt;li&gt;Refusal quality&lt;/li&gt;
&lt;li&gt;Helpfulness&lt;/li&gt;
&lt;li&gt;Latency and cost per query&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A key distinction: an answer can be true but unsupported by the retrieved context. For factual systems, that is still a failure.&lt;/p&gt;

&lt;p&gt;Know the RAG vs fine-tuning tradeoff:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use RAG when facts change often, citations matter, or the corpus is large.&lt;/li&gt;
&lt;li&gt;Use fine-tuning for tone, output format, intent classification, or consistent task behavior.&lt;/li&gt;
&lt;li&gt;A strong system may use RAG for grounding and fine-tuning for behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Amazon-like catalogs, policies, seller docs, and support content, hybrid retrieval often makes sense. Dense retrieval handles semantic similarity. BM25 helps with exact product IDs, policy names, rare entities, and error codes. A reranker can improve the final passage list, though it adds latency and cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Behavioral answers still matter
&lt;/h2&gt;

&lt;p&gt;For Amazon, technical strength is not enough. Prepare STAR stories tied to Leadership Principles. Your stories should be specific: what you owned, what tradeoff you made, what data you used, what changed because of your work.&lt;/p&gt;

&lt;p&gt;Avoid generic claims like "I am customer obsessed." Show the decision.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"We had a metric discrepancy between two dashboards. I traced it to different order-date logic, aligned the definition with finance, backfilled the metric table, and added validation checks so the issue would not recur."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That kind of story connects ownership, data quality, and business impact.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to practice
&lt;/h2&gt;

&lt;p&gt;Use timed practice. For each question, force yourself to produce:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clarifying questions&lt;/li&gt;
&lt;li&gt;Assumptions&lt;/li&gt;
&lt;li&gt;A clean solution path&lt;/li&gt;
&lt;li&gt;Edge cases&lt;/li&gt;
&lt;li&gt;A recommendation or decision rule&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find related prompts in the &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;PracHub interview question bank&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want the full topic map, examples, and practice cards for this role, use the &lt;a href="https://prachub.com/interview-prep/amazon-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;Amazon Data Scientist interview cheatsheet on PracHub&lt;/a&gt; as your prep checklist.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>amazon</category>
      <category>datascientist</category>
    </item>
    <item>
      <title>Product Metric Design And Diagnostic Deep Dives Explained — Tech Interview Concept (2026)</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 01 Jul 2026 14:25:38 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/product-metric-design-and-diagnostic-deep-dives-explained-tech-interview-concept-2026-50p8</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/product-metric-design-and-diagnostic-deep-dives-explained-tech-interview-concept-2026-50p8</guid>
      <description>&lt;p&gt;A product metric design interview is usually a test of judgment, not memorization. You get an ambiguous product or integrity problem, then you need to turn it into a measurement plan a real team could act on.&lt;/p&gt;

&lt;p&gt;The interviewer is checking whether you can keep these separate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What the product should optimize&lt;/li&gt;
&lt;li&gt;What the data can reliably observe&lt;/li&gt;
&lt;li&gt;What might be biased, gamed, or misleading&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article adapts the main ideas from PracHub's guide to &lt;a href="https://prachub.com/concepts/product-metric-design-and-diagnostic-deep-dives?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;product metric design and diagnostic investigations&lt;/a&gt;, with a focus on how to structure your answer in a Data Scientist interview.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the product goal, not the metric
&lt;/h2&gt;

&lt;p&gt;A weak answer starts with a list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DAU&lt;/li&gt;
&lt;li&gt;posts&lt;/li&gt;
&lt;li&gt;clicks&lt;/li&gt;
&lt;li&gt;retention&lt;/li&gt;
&lt;li&gt;reports&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That sounds busy, but it does not explain what success means.&lt;/p&gt;

&lt;p&gt;A stronger answer starts by clarifying how the product is supposed to work. For example, if the prompt is "Define success metrics for a Circles feature," you might say:&lt;/p&gt;

&lt;p&gt;"I will treat Circles as a community product meant to deepen meaningful interaction among smaller groups. Success should be sustained, high-quality engagement without safety issues or notification fatigue."&lt;/p&gt;

&lt;p&gt;That short framing does a lot of work. It tells the interviewer you will not blindly optimize raw activity. A feature can create more posts and still make the product worse if those posts are low quality, spammy, or annoying.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick a north-star metric that maps to durable value
&lt;/h2&gt;

&lt;p&gt;A north-star metric should capture product value, not surface activity.&lt;/p&gt;

&lt;p&gt;For a community product like Circles, raw joins or raw posts are easy to inflate. Users may join once and never return. Creators may post low-effort content. Spam accounts may create noisy groups.&lt;/p&gt;

&lt;p&gt;A better primary metric could be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;weekly active circle members with meaningful two-sided interactions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then normalize it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;meaningful interactions / eligible circle members
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;meaningful interactions / eligible impressions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The denominator matters because each version answers a different question.&lt;/p&gt;

&lt;p&gt;Per-member metrics ask whether members are getting value. Per-impression metrics ask whether exposed content creates useful engagement. Per-session metrics ask whether Circles changes behavior during active use. Raw counts hide these differences.&lt;/p&gt;

&lt;p&gt;For a B2B chat product, the north-star metric might be qualified conversation starts, not total messages. A qualified conversation could require both parties to participate, or require that the conversation passes a basic quality threshold.&lt;/p&gt;

&lt;p&gt;Define the unit of value before you define the count.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build a metric tree
&lt;/h2&gt;

&lt;p&gt;A metric tree helps you avoid treating metric design as a bag of unrelated numbers.&lt;/p&gt;

&lt;p&gt;A useful structure is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Outcome metric&lt;/li&gt;
&lt;li&gt;Input metrics&lt;/li&gt;
&lt;li&gt;Diagnostic metrics&lt;/li&gt;
&lt;li&gt;Guardrails&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For B2B chat, that might look like:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Example metrics&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Outcome&lt;/td&gt;
&lt;td&gt;Qualified conversation starts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inputs&lt;/td&gt;
&lt;td&gt;Response rate, time-to-first-response&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Diagnostics&lt;/td&gt;
&lt;td&gt;Exposure rate, click-through rate, reply depth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Guardrails&lt;/td&gt;
&lt;td&gt;Blocks, spam reports, opt-outs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This structure lets you explain why a metric moved.&lt;/p&gt;

&lt;p&gt;If qualified conversations dropped, maybe fewer users saw the entry point. Maybe users clicked but did not send messages. Maybe messages were sent, but businesses stopped responding. Each diagnosis points to a different product issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use guardrails to block bad launches
&lt;/h2&gt;

&lt;p&gt;A positive primary metric does not mean the launch is safe.&lt;/p&gt;

&lt;p&gt;Guardrail metrics protect user experience, integrity, and ecosystem health. Common guardrails include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hide rate&lt;/li&gt;
&lt;li&gt;report rate&lt;/li&gt;
&lt;li&gt;block rate&lt;/li&gt;
&lt;li&gt;unfollow rate&lt;/li&gt;
&lt;li&gt;session length&lt;/li&gt;
&lt;li&gt;notification opt-outs&lt;/li&gt;
&lt;li&gt;harmful-content prevalence&lt;/li&gt;
&lt;li&gt;advertiser complaints&lt;/li&gt;
&lt;li&gt;support contacts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Circles, guardrails might include mute rate, leave rate, reports, blocks, notification opt-outs, and displacement from broader feed engagement.&lt;/p&gt;

&lt;p&gt;That last one is easy to miss. A feature may increase activity inside Circles while reducing healthy engagement elsewhere. If the new product fragments the social graph or pushes spammy invites, the top-line metric may look good while the broader product gets worse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cohort before you trust the average
&lt;/h2&gt;

&lt;p&gt;Averages can hide the real story.&lt;/p&gt;

&lt;p&gt;Cut the results by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;new vs existing users&lt;/li&gt;
&lt;li&gt;market&lt;/li&gt;
&lt;li&gt;device class&lt;/li&gt;
&lt;li&gt;language&lt;/li&gt;
&lt;li&gt;creator size&lt;/li&gt;
&lt;li&gt;business type&lt;/li&gt;
&lt;li&gt;group size&lt;/li&gt;
&lt;li&gt;spam-risk tier&lt;/li&gt;
&lt;li&gt;prior engagement&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In a Meta-style interview, you should ask whether gains are broad-based or concentrated in a small segment. For example, Circles may help highly connected users while doing little for new users. A B2B chat change may help large businesses but hurt smaller ones that cannot respond quickly.&lt;/p&gt;

&lt;p&gt;This is also where fairness and integrity concerns enter the answer. A harmful-content system that reduces measured prevalence overall may still perform poorly for a language group with weaker labels or lower reviewer coverage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Match attribution windows to the product mechanism
&lt;/h2&gt;

&lt;p&gt;The time window should match how value appears.&lt;/p&gt;

&lt;p&gt;A chat product may need same-day response metrics and 7-day retention. A community product may need 14-day or 28-day return behavior. Harmful-content outcomes may need delayed labels because review, appeals, and classifier updates take time.&lt;/p&gt;

&lt;p&gt;A window that is too short misses downstream value. A window that is too long adds noise and confounding.&lt;/p&gt;

&lt;p&gt;Say this explicitly in the interview. It shows that you understand measurement as a product decision, not just a query.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose the right randomization unit
&lt;/h2&gt;

&lt;p&gt;Experiment design starts with the unit of randomization.&lt;/p&gt;

&lt;p&gt;User-level randomization works when the experience is isolated. Networked products are harder. For communities, pages, advertisers, threads, or circles, users interact with each other. One user's treatment can affect another user's experience.&lt;/p&gt;

&lt;p&gt;That means you may need community-level, page-level, advertiser-level, or thread-level randomization.&lt;/p&gt;

&lt;p&gt;You should also define the estimand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;direct effect&lt;/li&gt;
&lt;li&gt;spillover effect&lt;/li&gt;
&lt;li&gt;total ecosystem effect&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, if some Circle members receive a new invite flow and others do not, their behavior may interact. A user-level A/B test may underestimate or distort the effect if treated and control users are in the same groups.&lt;/p&gt;

&lt;p&gt;If randomization is not possible, you can propose a retrospective cohort design with matching or difference-in-differences. Keep the caveat clear: observational methods need stronger assumptions about confounding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Think about power, especially for rare events
&lt;/h2&gt;

&lt;p&gt;Rare events are hard to measure. Spam exposure, harmful-content reports, severe abuse, and appeals may have very low base rates.&lt;/p&gt;

&lt;p&gt;A rough minimum detectable effect relationship is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MDE ≈ (z_alpha/2 + z_beta) * sqrt(2 * sigma^2 / n)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The takeaway is that smaller effects, noisier metrics, and rare events need more data.&lt;/p&gt;

&lt;p&gt;For low base-rate outcomes, you can consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;aggregated exposure units&lt;/li&gt;
&lt;li&gt;longer test duration&lt;/li&gt;
&lt;li&gt;stratification&lt;/li&gt;
&lt;li&gt;higher-signal proxy labels&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do not promise that a short test can detect rare harm reliably. That is exactly the kind of overconfidence interviewers watch for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat proxy metrics with suspicion
&lt;/h2&gt;

&lt;p&gt;Proxy metrics are useful because they are often fast and available. They are also dangerous.&lt;/p&gt;

&lt;p&gt;For harmful content, user reports are visible and timely. But reports are biased by user awareness, culture, language, and reporting propensity. More reports could mean more harm, better reporting UX, higher user awareness, or more total usage.&lt;/p&gt;

&lt;p&gt;Reports are not ground truth.&lt;/p&gt;

&lt;p&gt;A stronger harmful-content evaluation combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;user reports&lt;/li&gt;
&lt;li&gt;human review labels&lt;/li&gt;
&lt;li&gt;classifier scores&lt;/li&gt;
&lt;li&gt;prevalence estimates&lt;/li&gt;
&lt;li&gt;severity-weighted harm metrics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Severity matters. Counting all violations equally treats mild spam and severe abuse as the same kind of event.&lt;/p&gt;

&lt;p&gt;A better metric is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;severity-weighted prevalence =
sum(exposures_i * severity_i) / total eligible exposures
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The severity buckets should be transparent, and calibration checks should verify that labels are consistent enough to support decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use a diagnostic funnel for investigations
&lt;/h2&gt;

&lt;p&gt;When a metric moves, avoid guessing. Use a funnel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exposure -&amp;gt; action -&amp;gt; quality -&amp;gt; retention -&amp;gt; harm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a product metric drops, ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did fewer users become eligible?&lt;/li&gt;
&lt;li&gt;Did fewer users see the surface?&lt;/li&gt;
&lt;li&gt;Did fewer users act after exposure?&lt;/li&gt;
&lt;li&gt;Did the quality of actions change?&lt;/li&gt;
&lt;li&gt;Did retention move?&lt;/li&gt;
&lt;li&gt;Did harm or negative feedback move?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This keeps the answer analytical. It also mirrors how real product teams debug launches.&lt;/p&gt;

&lt;p&gt;Before interpreting a movement, check measurement validity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;logging coverage&lt;/li&gt;
&lt;li&gt;denominator definitions&lt;/li&gt;
&lt;li&gt;duplicate events&lt;/li&gt;
&lt;li&gt;bot or spam filtering&lt;/li&gt;
&lt;li&gt;experiment balance&lt;/li&gt;
&lt;li&gt;sample-ratio mismatch&lt;/li&gt;
&lt;li&gt;missing labels&lt;/li&gt;
&lt;li&gt;metric backfills&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You do not need to design the ingestion system in a product metric interview. You do need to know when the measurement is untrustworthy.&lt;/p&gt;

&lt;h2&gt;
  
  
  A compact answer pattern for interviews
&lt;/h2&gt;

&lt;p&gt;For a metric design prompt, use this flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Clarify the product goal.&lt;/li&gt;
&lt;li&gt;State assumptions.&lt;/li&gt;
&lt;li&gt;Define the primary metric.&lt;/li&gt;
&lt;li&gt;Add supporting funnel metrics.&lt;/li&gt;
&lt;li&gt;Add guardrails.&lt;/li&gt;
&lt;li&gt;Discuss cohorts and denominators.&lt;/li&gt;
&lt;li&gt;Explain experiment design.&lt;/li&gt;
&lt;li&gt;Name likely diagnostics if the result moves.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For Circles, that might be:&lt;/p&gt;

&lt;p&gt;"Success is weekly active circle members with meaningful two-sided interactions, normalized by eligible members. I would support that with circle creation, invite acceptance, posting, comment depth, repeat participation, and 7-day or 28-day retention. Guardrails would include mutes, leaves, reports, blocks, notification opt-outs, and displacement from broader feed engagement. I would run an A/B test if possible, with user-level or circle-level assignment depending on spillovers. I would cut by new users, highly connected users, small markets, and baseline sharing behavior."&lt;/p&gt;

&lt;p&gt;That is a defensible answer because it ties metrics to the decision the team needs to make.&lt;/p&gt;

&lt;p&gt;If you want more prompts to practice this style, PracHub has a set of &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;data science and product interview questions&lt;/a&gt;. For the full concept breakdown, use the original PracHub guide on &lt;a href="https://prachub.com/concepts/product-metric-design-and-diagnostic-deep-dives?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;product metric design and diagnostic investigations&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>analyticsexperimentation</category>
      <category>programming</category>
    </item>
    <item>
      <title>Amazon Machine Learning Engineer Interview Cheatsheet 2026</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 24 Jun 2026 14:26:21 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/amazon-machine-learning-engineer-interview-cheatsheet-2026-2n5k</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/amazon-machine-learning-engineer-interview-cheatsheet-2026-2n5k</guid>
      <description>&lt;p&gt;If you are preparing for an Amazon Machine Learning Engineer interview, expect more than "I know the model." You need to explain how the model works, how you would implement it, what breaks in production, and how you would decide whether it is good enough to ship.&lt;/p&gt;

&lt;p&gt;The longer &lt;a href="https://prachub.com/interview-prep/amazon-machine-learning-engineer-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;PracHub Amazon Machine Learning Engineer interview prep guide&lt;/a&gt; breaks this down by interview stage. This article condenses the highest-signal areas into a study guide you can use before a technical screen or onsite.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Amazon is likely testing
&lt;/h2&gt;

&lt;p&gt;For an MLE role, Amazon interviewers usually care about four things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can you reason from ML theory to working code?&lt;/li&gt;
&lt;li&gt;Can you design systems that train, evaluate, and serve models reliably?&lt;/li&gt;
&lt;li&gt;Can you debug models using metrics, data, and experiments?&lt;/li&gt;
&lt;li&gt;Can you explain tradeoffs around latency, cost, memory, and quality?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good answer does not stop at "use a Transformer" or "train XGBoost." You should be able to talk through tensor shapes, masks, evaluation gaps, distributed training, sparse data, online metrics, and deployment risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transformers: know the internals, not just the vocabulary
&lt;/h2&gt;

&lt;p&gt;Transformers are one of the highest-yield topics for an Amazon MLE interview. Be ready to explain scaled dot-product attention:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Attention(Q, K, V) = softmax((QK^T / sqrt(d_k)) + M)V
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;M&lt;/code&gt; is often an additive mask. Allowed positions get &lt;code&gt;0&lt;/code&gt;; blocked positions get &lt;code&gt;-inf&lt;/code&gt;. The &lt;code&gt;sqrt(d_k)&lt;/code&gt; scaling keeps attention logits from getting too large and saturating the softmax.&lt;/p&gt;

&lt;p&gt;For implementation questions, shape reasoning matters. Given input &lt;code&gt;X&lt;/code&gt; with shape &lt;code&gt;B x T x d_model&lt;/code&gt;, multi-head attention projects it into &lt;code&gt;Q&lt;/code&gt;, &lt;code&gt;K&lt;/code&gt;, and &lt;code&gt;V&lt;/code&gt;, then reshapes them into something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;B x num_heads x T x head_dim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The attention score tensor then has shape:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;B x num_heads x T x T
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A common bug is reshaping after a transpose without handling non-contiguous tensors. In PyTorch, that means knowing when &lt;code&gt;.view()&lt;/code&gt; can break and when &lt;code&gt;.reshape()&lt;/code&gt; or &lt;code&gt;.contiguous()&lt;/code&gt; is safer.&lt;/p&gt;

&lt;p&gt;For decoder-only models, causal masking is mandatory. Token &lt;code&gt;t&lt;/code&gt; can only attend to positions &lt;code&gt;&amp;lt;= t&lt;/code&gt;. If you forget this, the model can leak future labels during training. The loss may look great, but generation will fail.&lt;/p&gt;

&lt;p&gt;You should also know the standard GPT-style block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x = x + attention(LayerNorm(x))
x = x + MLP(LayerNorm(x))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This pre-norm layout is common because it helps gradient flow in deeper models. Post-norm matches the original Transformer pattern, but can be harder to train at scale.&lt;/p&gt;

&lt;p&gt;LayerNorm is another frequent follow-up. It normalizes across the hidden dimension for each token independently:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LN(x) = gamma * (x - mean) / sqrt(variance + epsilon) + beta
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike BatchNorm, LayerNorm does not depend on batch statistics. That helps with variable batch sizes, sequence models, and autoregressive inference.&lt;/p&gt;

&lt;h2&gt;
  
  
  LLMs: connect architecture to operations
&lt;/h2&gt;

&lt;p&gt;For LLM questions, you need to move between model internals and production behavior.&lt;/p&gt;

&lt;p&gt;A strong answer covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decoder-only Transformer architecture&lt;/li&gt;
&lt;li&gt;Tokenization with BPE, WordPiece, or SentencePiece&lt;/li&gt;
&lt;li&gt;Pretraining with next-token prediction&lt;/li&gt;
&lt;li&gt;Instruction tuning with prompt-response data&lt;/li&gt;
&lt;li&gt;Preference alignment methods such as RLHF or DPO&lt;/li&gt;
&lt;li&gt;Fine-tuning choices such as full fine-tuning, LoRA, QLoRA, prefix tuning, and prompt tuning&lt;/li&gt;
&lt;li&gt;Evaluation beyond perplexity&lt;/li&gt;
&lt;li&gt;Serving constraints such as KV cache memory, throughput, and p99 latency&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Perplexity is useful, but it is not enough. It measures next-token likelihood, not whether the model follows instructions, refuses unsafe requests correctly, produces grounded answers, or gives useful task outputs.&lt;/p&gt;

&lt;p&gt;For a validation-system design question, structure your answer around:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Evaluation data&lt;br&gt;&lt;br&gt;
Use golden prompts, task-specific benchmarks, adversarial sets, regression cases from past failures, and production-like prompts sampled in a privacy-safe way.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Metrics&lt;br&gt;&lt;br&gt;
Include exact match where it fits, rubric scores, human preference win rate, hallucination or groundedness for RAG, toxicity or safety rates, refusal correctness, latency &lt;code&gt;p50/p95/p99&lt;/code&gt;, tokens per second, and cost per request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;System components&lt;br&gt;&lt;br&gt;
Mention a model registry, prompt/version registry, evaluation runner, deterministic inference harness, result store, dashboard, and deployment gates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Online validation&lt;br&gt;&lt;br&gt;
Use shadow tests, canary rollout, alerts for regressions, drift checks, and rollback criteria.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If the system is RAG-based, model quality depends on more than weights. Retrieval, chunking, embedding quality, ranking, prompt assembly, citation grounding, and index freshness all matter. Good evaluation should include retrieval recall@k, answer faithfulness, source attribution, and latency budget split across retrieval and generation.&lt;/p&gt;

&lt;h2&gt;
  
  
  MoE: sparse compute has systems costs
&lt;/h2&gt;

&lt;p&gt;Mixture-of-Experts models often replace dense MLP layers with multiple expert networks and a learned router. A token may be sent to the top-1 or top-2 experts.&lt;/p&gt;

&lt;p&gt;The benefit is that the model can have more total parameters without activating all of them for every token. The cost is systems complexity.&lt;/p&gt;

&lt;p&gt;In an interview, avoid saying "MoE is more efficient" without explaining the tradeoff. Good answers mention:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load-balancing losses&lt;/li&gt;
&lt;li&gt;Expert collapse risk&lt;/li&gt;
&lt;li&gt;Capacity factors&lt;/li&gt;
&lt;li&gt;Token dropping during overload&lt;/li&gt;
&lt;li&gt;Distributed &lt;code&gt;all-to-all&lt;/code&gt; communication&lt;/li&gt;
&lt;li&gt;Harder batching because routing is data-dependent&lt;/li&gt;
&lt;li&gt;Higher risk around p99 latency&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dense models are simpler to serve. MoE models can scale parameter count better relative to FLOPs, but routing and communication make training and serving harder.&lt;/p&gt;

&lt;h2&gt;
  
  
  XGBoost: understand why it is fast
&lt;/h2&gt;

&lt;p&gt;Amazon MLE interviews may still test classic ML, especially for tabular problems. XGBoost is a common topic because it mixes algorithm knowledge with systems thinking.&lt;/p&gt;

&lt;p&gt;Gradient boosting builds an additive model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;y_hat_i^(t) = y_hat_i^(t-1) + eta * f_t(x_i)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each new tree fits the residual signal, often framed as the negative gradient of the loss. This means boosting rounds are sequential. Tree &lt;code&gt;t&lt;/code&gt; depends on predictions from earlier trees.&lt;/p&gt;

&lt;p&gt;The parallelism is inside each tree:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;across candidate splits&lt;/li&gt;
&lt;li&gt;across features&lt;/li&gt;
&lt;li&gt;across data partitions&lt;/li&gt;
&lt;li&gt;across histogram bins&lt;/li&gt;
&lt;li&gt;across workers in distributed training&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;XGBoost uses second-order information. Split scoring uses gradients and Hessians, with regularization terms such as &lt;code&gt;lambda&lt;/code&gt; and &lt;code&gt;gamma&lt;/code&gt;. You do not need to derive every line from memory, but you should be able to explain that XGBoost uses both first and second derivatives to score split quality.&lt;/p&gt;

&lt;p&gt;For large datasets, exact split search can be expensive. Histogram-based split finding buckets continuous values into quantile bins, often far fewer than the number of raw thresholds. Workers build local histograms of gradient and Hessian sums, then reduce them. This gives better cache behavior and lower memory use, with some loss in split precision.&lt;/p&gt;

&lt;p&gt;Also know why sparse handling matters. XGBoost learns a default direction for missing values, which helps with sparse one-hot data and missing feature values.&lt;/p&gt;

&lt;h2&gt;
  
  
  PyTorch implementation questions: be concrete
&lt;/h2&gt;

&lt;p&gt;For "Implement a decoder-only GPT-style Transformer," start by clarifying scope:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Should I implement a minimal PyTorch module with embeddings, positional encoding, masked multi-head attention, MLP blocks, and logits, or should I include training and generation too?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then state assumptions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input token IDs have shape &lt;code&gt;B x T&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Vocabulary size is &lt;code&gt;V&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Embedding dimension is &lt;code&gt;C&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Number of heads divides &lt;code&gt;C&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Output logits have shape &lt;code&gt;B x T x V&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Talk through token embeddings, positional embeddings or RoPE, stacked pre-norm blocks, causal masking, output projection, and loss.&lt;/p&gt;

&lt;p&gt;Call out edge cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;T&lt;/code&gt; exceeds configured context length&lt;/li&gt;
&lt;li&gt;mask broadcasting is wrong&lt;/li&gt;
&lt;li&gt;train/eval dropout behavior differs&lt;/li&gt;
&lt;li&gt;causal mask is missing&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.view()&lt;/code&gt; is used on a non-contiguous tensor&lt;/li&gt;
&lt;li&gt;generation lacks a KV cache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good implementation answer includes unit tests for shape, causal leakage, and a tiny overfit test to verify the model can learn.&lt;/p&gt;

&lt;h2&gt;
  
  
  Behavioral answers still need metrics
&lt;/h2&gt;

&lt;p&gt;The source guide groups behavioral preparation under leadership principles, ownership, and measurable impact. For Amazon, that phrasing matters.&lt;/p&gt;

&lt;p&gt;Do not give vague stories like "I improved model performance." Give the situation, your decision, the tradeoff, the result, and the metric. For an MLE, strong stories often include model quality, latency, cost, reliability, data quality, rollback decisions, or experiment design.&lt;/p&gt;

&lt;p&gt;For example, a better answer sounds like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"We had a relevance regression after a feature pipeline change. I traced the issue to offline/online feature mismatch, added validation checks before promotion, and reduced bad launches in that area."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The exact numbers depend on your experience, but the structure should make your ownership clear.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final prep checklist
&lt;/h2&gt;

&lt;p&gt;Before the interview, make sure you can answer these without notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Derive and explain scaled dot-product attention&lt;/li&gt;
&lt;li&gt;Trace Transformer tensor shapes through multi-head attention&lt;/li&gt;
&lt;li&gt;Explain causal masking and label leakage&lt;/li&gt;
&lt;li&gt;Compare LayerNorm and BatchNorm&lt;/li&gt;
&lt;li&gt;Discuss KV cache memory and autoregressive latency&lt;/li&gt;
&lt;li&gt;Explain why perplexity is not enough for LLM evaluation&lt;/li&gt;
&lt;li&gt;Design an LLM validation system with offline and online gates&lt;/li&gt;
&lt;li&gt;Explain MoE routing and serving tradeoffs&lt;/li&gt;
&lt;li&gt;Explain XGBoost histogram split finding and boosting-round dependency&lt;/li&gt;
&lt;li&gt;Write a minimal PyTorch Transformer block&lt;/li&gt;
&lt;li&gt;Tie every model choice to quality, latency, cost, or reliability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to drill with targeted prompts, the &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;PracHub interview questions library&lt;/a&gt; has practice questions across ML theory, system design, coding, and behavioral topics.&lt;/p&gt;

&lt;p&gt;For the full role-specific breakdown, use the &lt;a href="https://prachub.com/interview-prep/amazon-machine-learning-engineer-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;Amazon Machine Learning Engineer interview prep guide on PracHub&lt;/a&gt; as your main checklist.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>amazon</category>
      <category>machinelearningengineer</category>
    </item>
    <item>
      <title>Notifications And Lifecycle Engagement Explained — Tech Interview Concept (2026)</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 17 Jun 2026 14:26:03 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/notifications-and-lifecycle-engagement-explained-tech-interview-concept-2026-54bg</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/notifications-and-lifecycle-engagement-explained-tech-interview-concept-2026-54bg</guid>
      <description>&lt;p&gt;Notifications are easy to measure badly.&lt;/p&gt;

&lt;p&gt;If a push campaign gets more clicks, did it create real engagement, or did it interrupt people who were already likely to open the app? If a ranking model lifts CTR, did it improve relevance, or did it learn to send curiosity bait? If dormant users come back today, do they stick around next month, or do they disable notifications?&lt;/p&gt;

&lt;p&gt;That is what interviewers are getting at when they ask about notification and lifecycle engagement metrics. The original PracHub concept post on &lt;a href="https://prachub.com/concepts/notifications-and-lifecycle-engagement?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;Notifications and Lifecycle Engagement&lt;/a&gt; covers the concept, but this article focuses on the answer pattern you can use in a data science or product analytics interview.&lt;/p&gt;

&lt;h2&gt;
  
  
  What interviewers are really testing
&lt;/h2&gt;

&lt;p&gt;A weak answer sounds like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I would track CTR, opens, DAU, and retention."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is a metric list, not an evaluation plan.&lt;/p&gt;

&lt;p&gt;A stronger answer explains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What product decision the metric supports&lt;/li&gt;
&lt;li&gt;What the primary outcome is&lt;/li&gt;
&lt;li&gt;Which metrics are drivers&lt;/li&gt;
&lt;li&gt;Which metrics are guardrails&lt;/li&gt;
&lt;li&gt;How the experiment estimates incremental impact&lt;/li&gt;
&lt;li&gt;How you handle fatigue, delayed outcomes, and selection bias&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a company like Meta, notifications can bring users back and help build habits. They can also annoy users, increase opt-outs, and reduce long-term trust. The interview is testing whether you can separate short-term movement from durable product value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with the product goal
&lt;/h2&gt;

&lt;p&gt;Before naming metrics, clarify the goal.&lt;/p&gt;

&lt;p&gt;A notification system may be trying to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reactivate dormant users&lt;/li&gt;
&lt;li&gt;Improve relevance of pushes&lt;/li&gt;
&lt;li&gt;Increase marketplace actions&lt;/li&gt;
&lt;li&gt;Reduce notification fatigue&lt;/li&gt;
&lt;li&gt;Test a new ranking or sending policy&lt;/li&gt;
&lt;li&gt;Personalize volume caps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The right metric depends on the goal. A reactivation system may care about &lt;code&gt;D7_retained_active_users&lt;/code&gt;. A marketplace notification may care about &lt;code&gt;listing_detail_views&lt;/code&gt;, &lt;code&gt;saves&lt;/code&gt;, or &lt;code&gt;seller_messages&lt;/code&gt;. A fatigue-reduction project may use &lt;code&gt;disable_push_rate&lt;/code&gt; or &lt;code&gt;mute_rate&lt;/code&gt; as the primary outcome.&lt;/p&gt;

&lt;p&gt;This step matters because it ties measurement to an actual product decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build a metric hierarchy
&lt;/h2&gt;

&lt;p&gt;For notification experiments, organize metrics into three layers.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Primary metric
&lt;/h3&gt;

&lt;p&gt;This is the metric you would use to make the launch decision.&lt;/p&gt;

&lt;p&gt;Good candidates include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;D7_retained_active_users&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;D28_retained_active_users&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Incremental &lt;code&gt;sessions_per_user&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;meaningful_sessions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Downstream actions such as messages, purchases, comments, or listing views&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The primary metric should capture user or business value, not raw notification volume.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Driver metrics
&lt;/h3&gt;

&lt;p&gt;These explain why the primary metric moved.&lt;/p&gt;

&lt;p&gt;Common driver metrics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;notification_open_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;notification_click_through_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;session_starts_from_notification&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;notification-attributed_sessions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;downstream_conversion&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CTR is useful here, but it should rarely be the launch metric.&lt;/p&gt;

&lt;p&gt;The formula is simple:&lt;/p&gt;

&lt;p&gt;$$CTR = \frac{\text{notification clicks}}{\text{notifications delivered}}$$&lt;/p&gt;

&lt;p&gt;The problem is what CTR rewards. It can favor clickbait, curiosity, or over-targeting users who were already active. A notification that gets many clicks may still reduce retention if users feel spammed.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Guardrail metrics
&lt;/h3&gt;

&lt;p&gt;Guardrails protect user trust and long-term health.&lt;/p&gt;

&lt;p&gt;Use metrics such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;disable_push_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mute_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uninstall_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hide_notification_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;negative_feedback_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;notifications_sent_per_user&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;complaints&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Quality metrics like &lt;code&gt;meaningful_interactions_per_session&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A treatment that lifts DAU but also raises push disables may be a bad trade.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design the experiment around assignment, not clicks
&lt;/h2&gt;

&lt;p&gt;For most notification policies, randomize at the user level.&lt;/p&gt;

&lt;p&gt;Control users get the existing policy. Treatment users are eligible for the new notification policy, ranking model, or sending rule.&lt;/p&gt;

&lt;p&gt;The treatment should not be defined as "clicked a notification" or "received a notification." Those are post-treatment events. If you analyze only users who clicked, you introduce selection bias because the treatment itself affects who receives, sees, and clicks notifications.&lt;/p&gt;

&lt;p&gt;Use intent-to-treat analysis as the primary estimate:&lt;/p&gt;

&lt;p&gt;$$ITT = E[Y \mid Z=1] - E[Y \mid Z=0]$$&lt;/p&gt;

&lt;p&gt;Here, &lt;code&gt;Z&lt;/code&gt; is assignment to treatment.&lt;/p&gt;

&lt;p&gt;This estimates the effect of being assigned to the new policy. Some assigned users may never receive a notification during the experiment. That is fine. ITT matches the product decision: should we launch this policy to eligible users?&lt;/p&gt;

&lt;p&gt;You can report treatment-on-treated as a secondary diagnostic, but be careful. If exposure is affected by the treatment, exposed-user analysis can be misleading. If needed, use exposure rates or instrumental variables, with clear caveats.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watch for interference
&lt;/h2&gt;

&lt;p&gt;User-level randomization works well for many notification systems, but social notifications can create spillovers.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Your friend commented"&lt;/li&gt;
&lt;li&gt;"Someone tagged you"&lt;/li&gt;
&lt;li&gt;"A creator you follow posted"&lt;/li&gt;
&lt;li&gt;Marketplace messages tied to listings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One user's treatment can generate messages or activity that affects another user. That violates SUTVA, the assumption that one unit's treatment does not affect another unit's outcome.&lt;/p&gt;

&lt;p&gt;In those cases, consider cluster randomization. The cluster could be a conversation, household, creator-follower graph component, marketplace listing neighborhood, or another unit that captures likely spillovers.&lt;/p&gt;

&lt;p&gt;Cluster experiments need more sample size because observations inside a cluster are correlated. The design effect is:&lt;/p&gt;

&lt;p&gt;$$DE = 1 + (m-1)\rho$$&lt;/p&gt;

&lt;p&gt;Here, &lt;code&gt;m&lt;/code&gt; is cluster size and &lt;code&gt;rho&lt;/code&gt; is the intra-cluster correlation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan for small effects
&lt;/h2&gt;

&lt;p&gt;Retention and opt-out effects can be small, so power matters.&lt;/p&gt;

&lt;p&gt;For a two-sample comparison of means, a rough sample size formula is:&lt;/p&gt;

&lt;p&gt;$$n \approx \frac{2\sigma^2(z_{1-\alpha/2}+z_{1-\beta})^2}{\delta^2}$$&lt;/p&gt;

&lt;p&gt;Here, &lt;code&gt;delta&lt;/code&gt; is the minimum detectable effect. For binary metrics, use &lt;code&gt;p(1-p)&lt;/code&gt; as the variance.&lt;/p&gt;

&lt;p&gt;If you have strong pre-period behavior, use CUPED or regression adjustment to reduce variance. Good covariates include pre-experiment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sessions_per_user&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;notification_clicks&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;active_days&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The covariates must be measured before assignment. This improves sensitivity without changing the estimand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Segment by lifecycle stage
&lt;/h2&gt;

&lt;p&gt;Notification impact is rarely uniform.&lt;/p&gt;

&lt;p&gt;Analyze cohorts such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New users&lt;/li&gt;
&lt;li&gt;Dormant users&lt;/li&gt;
&lt;li&gt;Power users&lt;/li&gt;
&lt;li&gt;Notification-heavy users&lt;/li&gt;
&lt;li&gt;Low-intent users&lt;/li&gt;
&lt;li&gt;Users with prior disables or mutes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A policy may help dormant users come back while annoying already-active users. A broad average can hide that pattern.&lt;/p&gt;

&lt;p&gt;This is especially relevant for lifecycle engagement. The same push can feel helpful to one user and spammy to another. Segment analysis can support personalization, caps, or targeted rollout instead of a full launch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure beyond the first click
&lt;/h2&gt;

&lt;p&gt;Notifications often have delayed costs.&lt;/p&gt;

&lt;p&gt;Common patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CTR rises, but &lt;code&gt;disable_push_rate&lt;/code&gt; rises later&lt;/li&gt;
&lt;li&gt;DAU increases, but &lt;code&gt;D28_retention&lt;/code&gt; falls&lt;/li&gt;
&lt;li&gt;Sessions increase, but session quality drops&lt;/li&gt;
&lt;li&gt;Short-term reactivation fades after users habituate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use a window that matches the product goal. If the goal is reactivation, D1 may be too short. D7 or D28 can show whether users came back again. For long-term fatigue, use longer experiments, staggered rollouts, or holdouts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control multiple testing
&lt;/h2&gt;

&lt;p&gt;Notification systems have many surfaces, cohorts, and outcomes. If you slice enough, some result will look significant by chance.&lt;/p&gt;

&lt;p&gt;A clean answer says you would predefine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Primary metric&lt;/li&gt;
&lt;li&gt;Main guardrails&lt;/li&gt;
&lt;li&gt;Evaluation window&lt;/li&gt;
&lt;li&gt;High-risk cohorts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For many exploratory slices, use false discovery control such as Benjamini-Hochberg. For guardrails where false positives or false negatives are costly, Bonferroni correction may be more appropriate.&lt;/p&gt;

&lt;p&gt;If you want more practice with these interview-style pivots, PracHub has related &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;data science and product interview questions&lt;/a&gt; that cover experimentation, metrics, ranking, and causal inference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Worked example: general notification policy
&lt;/h2&gt;

&lt;p&gt;Suppose the prompt is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Define metrics and design experiments for notifications."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A strong answer could sound like this:&lt;/p&gt;

&lt;p&gt;First, clarify the goal. Assume we are testing a new push notification ranking policy for a social app. The goal is to increase meaningful engagement and retention without increasing fatigue.&lt;/p&gt;

&lt;p&gt;Primary metric:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;D7_retained_active_users&lt;/code&gt; or incremental &lt;code&gt;sessions_per_user&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Driver metrics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;notification_open_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;notification-attributed_sessions&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;downstream_actions&lt;/code&gt;, such as comments, messages, or shares&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Guardrails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;disable_push_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mute_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uninstall_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;notifications_sent_per_user&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;negative_feedback_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;meaningful_interactions_per_session&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Experiment design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Randomize eligible users into control and treatment&lt;/li&gt;
&lt;li&gt;Control keeps the current policy&lt;/li&gt;
&lt;li&gt;Treatment is eligible for the new ranking or sending policy&lt;/li&gt;
&lt;li&gt;Analyze by assignment using ITT&lt;/li&gt;
&lt;li&gt;Avoid conditioning on users who clicked or received a notification&lt;/li&gt;
&lt;li&gt;Use cluster randomization if social spillovers are strong&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Decision rule:&lt;/p&gt;

&lt;p&gt;Ship only if the primary metric improves and guardrails do not show statistically or practically meaningful harm. If the lift is concentrated in dormant users but guardrail harm appears among power users, consider personalization or volume caps instead of a full rollout.&lt;/p&gt;

&lt;h2&gt;
  
  
  Worked example: similar-listing notifications
&lt;/h2&gt;

&lt;p&gt;Now suppose the prompt is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How would you evaluate a similar-listing notification feature?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The product goal is narrower. You want to know whether notifying users about similar marketplace listings helps them find relevant items without feeling spammed.&lt;/p&gt;

&lt;p&gt;Primary metrics could include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Incremental &lt;code&gt;listing_detail_views&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;saves&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;seller_messages&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Purchase-intent actions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Guardrails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;notification_disable_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hide_rate&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Lower engagement with future marketplace notifications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Randomize eligible users who viewed or saved a listing. Do not randomize only people who receive the notification, because eligibility is part of the treatment.&lt;/p&gt;

&lt;p&gt;Use an evaluation window that includes delayed actions. A user may click today but message a seller two days later. Segment by intent strength too. Recent searchers may benefit, while casual browsers may find the same push irrelevant.&lt;/p&gt;

&lt;h2&gt;
  
  
  The common traps
&lt;/h2&gt;

&lt;p&gt;Avoid these mistakes in an interview:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Optimizing only for CTR&lt;/li&gt;
&lt;li&gt;Analyzing only users who opened the notification&lt;/li&gt;
&lt;li&gt;Listing metrics without a launch rule&lt;/li&gt;
&lt;li&gt;Ignoring opt-outs, mutes, and uninstalls&lt;/li&gt;
&lt;li&gt;Treating all lifecycle cohorts the same&lt;/li&gt;
&lt;li&gt;Missing network spillovers in social notifications&lt;/li&gt;
&lt;li&gt;Reading too much into short-term DAU lift&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good interview answer is causal, decision-oriented, and honest about tradeoffs. You are not trying to prove notifications work. You are trying to estimate whether a specific policy creates incremental value without damaging retention or trust.&lt;/p&gt;

&lt;p&gt;For a more compact interview-prep version of this framework, use the PracHub write-up on &lt;a href="https://prachub.com/concepts/notifications-and-lifecycle-engagement?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;Notifications and Lifecycle Engagement&lt;/a&gt; as a reference before practicing mock answers.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>programming</category>
      <category>tech</category>
    </item>
    <item>
      <title>Uber Data Scientist Interview Cheatsheet 2026</title>
      <dc:creator>Feng Zhang</dc:creator>
      <pubDate>Wed, 10 Jun 2026 14:25:36 +0000</pubDate>
      <link>https://dev.to/feng_zhang_cedb4581bee881/uber-data-scientist-interview-cheatsheet-2026-fal</link>
      <guid>https://dev.to/feng_zhang_cedb4581bee881/uber-data-scientist-interview-cheatsheet-2026-fal</guid>
      <description>&lt;p&gt;If you're preparing for an Uber Data Scientist interview, the hard part is not memorizing formulas. It is knowing how Uber frames data science problems: marketplace effects, experiment validity, ETA quality, and metric definitions that do not fall apart under edge cases.&lt;/p&gt;

&lt;p&gt;This post is a condensed rewrite of PracHub's &lt;a href="https://prachub.com/interview-prep/uber-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;Uber Data Scientist interview prep guide&lt;/a&gt;, focused on the themes that come up in technical screens and onsite rounds.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Uber is really testing
&lt;/h2&gt;

&lt;p&gt;Across SQL, product analytics, experimentation, and stats, interviewers want to see whether you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;define the metric correctly&lt;/li&gt;
&lt;li&gt;choose the right unit of analysis&lt;/li&gt;
&lt;li&gt;avoid leakage and bad denominators&lt;/li&gt;
&lt;li&gt;reason about interference in a two-sided marketplace&lt;/li&gt;
&lt;li&gt;separate model quality from business impact&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last one matters a lot. Lower prediction error does not automatically mean a better rider experience. A statistically significant A/B test result does not automatically mean "launch."&lt;/p&gt;

&lt;h2&gt;
  
  
  1) SQL: can you build defensible metrics from messy event data?
&lt;/h2&gt;

&lt;p&gt;Uber SQL questions often look simple at first. Then they turn into deduping events, picking the correct grain, and handling time windows without leaking future information.&lt;/p&gt;

&lt;p&gt;Topics that come up often:&lt;/p&gt;

&lt;h3&gt;
  
  
  Window functions you should be comfortable with
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Last or first event per entity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use &lt;code&gt;ROW_NUMBER()&lt;/code&gt; with a deterministic sort:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;ROW_NUMBER&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt;
  &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;event_ts&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event_id&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the standard pattern for "latest trip per rider" or "first exposure per user."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rolling metrics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For time-series summaries, know how to write rolling averages by partition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;metric&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;OVER&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;PARTITION&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;
  &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;dt&lt;/span&gt;
  &lt;span class="k"&gt;ROWS&lt;/span&gt; &lt;span class="k"&gt;BETWEEN&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="k"&gt;PRECEDING&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;CURRENT&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Top-N logic&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You should know when to use &lt;code&gt;RANK&lt;/code&gt;, &lt;code&gt;DENSE_RANK&lt;/code&gt;, and &lt;code&gt;ROW_NUMBER&lt;/code&gt;, and be able to explain tie behavior clearly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cohort conversion and CTR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A common failure mode is inflated CTR after joining impressions to clicks. If one impression maps to multiple clicks, &lt;code&gt;COUNT(*)&lt;/code&gt; breaks the metric. You need to define the denominator once, dedupe at the right grain, and use explicit attribution windows like &lt;code&gt;click_ts &amp;lt;= impression_ts + interval '48 hours'&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Date spine joins&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These matter for rolling averages and anomaly detection. Generate all dates first, then left join events, and fill missing counts with zero.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Timezone-aware aggregation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you analyze market-level data, local time matters. San Francisco metrics in January should not be cut on raw UTC day boundaries.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common SQL mistakes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;counting rows after a one-to-many join&lt;/li&gt;
&lt;li&gt;using future rows in a rolling metric&lt;/li&gt;
&lt;li&gt;treating &lt;code&gt;RANK&lt;/code&gt; and &lt;code&gt;ROW_NUMBER&lt;/code&gt; as interchangeable&lt;/li&gt;
&lt;li&gt;skipping timezone conversion before &lt;code&gt;DATE_TRUNC&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want realistic drills for this style of question, PracHub has a set of &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;data science interview practice questions&lt;/a&gt; that match the patterns above.&lt;/p&gt;

&lt;h2&gt;
  
  
  2) ETA questions: accuracy is only part of the problem
&lt;/h2&gt;

&lt;p&gt;ETA is one of the clearest examples of how Uber expects product sense and statistical judgment to work together.&lt;/p&gt;

&lt;p&gt;An interviewer is not looking for "we reduced MAE, so the model is better." They want you to think through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what the ETA label is&lt;/li&gt;
&lt;li&gt;how to evaluate prediction quality&lt;/li&gt;
&lt;li&gt;whether the prediction is calibrated&lt;/li&gt;
&lt;li&gt;how uncertainty should be measured&lt;/li&gt;
&lt;li&gt;what user behavior changes after ETA changes&lt;/li&gt;
&lt;li&gt;how interference breaks naive A/B testing&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Start with label definition
&lt;/h3&gt;

&lt;p&gt;You need to ask what ETA means in the question.&lt;/p&gt;

&lt;p&gt;Is it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;request-to-pickup time?&lt;/li&gt;
&lt;li&gt;pickup-to-dropoff time?&lt;/li&gt;
&lt;li&gt;total trip duration?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The target has to match the user-facing promise. Cancellations, reassignment, batching, and no-shows all affect the label definition.&lt;/p&gt;

&lt;h3&gt;
  
  
  Know the evaluation metrics and what they miss
&lt;/h3&gt;

&lt;p&gt;Uber cares about more than one error metric:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MAE&lt;/strong&gt; is easy to interpret in minutes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RMSE&lt;/strong&gt; penalizes large misses&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;median absolute error&lt;/strong&gt; is more stable with outliers like airports or events&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;bias&lt;/strong&gt; tells you whether the model is systematically optimistic or pessimistic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You should also say you would segment results by city, time of day, weather, airport, and trip type.&lt;/p&gt;

&lt;h3&gt;
  
  
  Calibration matters
&lt;/h3&gt;

&lt;p&gt;If the app says 5 minutes and riders usually wait 7, the model is underestimating. That can increase conversion in the short run and hurt trust later.&lt;/p&gt;

&lt;p&gt;Reliability curves by ETA bucket are often more useful than one aggregate accuracy score.&lt;/p&gt;

&lt;h3&gt;
  
  
  Uncertainty matters too
&lt;/h3&gt;

&lt;p&gt;For dispatch and UX decisions, intervals can matter as much as point estimates. A 90% prediction interval should contain the actual arrival time about 90% of the time. Coverage and interval width are both relevant.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connect ETA to business outcomes
&lt;/h3&gt;

&lt;p&gt;A good answer separates model metrics from business metrics.&lt;/p&gt;

&lt;p&gt;Examples of business outcomes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;request conversion&lt;/li&gt;
&lt;li&gt;cancellation rate&lt;/li&gt;
&lt;li&gt;completed trips&lt;/li&gt;
&lt;li&gt;pickup delay&lt;/li&gt;
&lt;li&gt;rider satisfaction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Guardrails might include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;driver idle time&lt;/li&gt;
&lt;li&gt;acceptance rate&lt;/li&gt;
&lt;li&gt;surge exposure&lt;/li&gt;
&lt;li&gt;support contacts&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3) Uber experiments are often not standard A/B tests
&lt;/h2&gt;

&lt;p&gt;This is where many candidates get too generic.&lt;/p&gt;

&lt;p&gt;For consumer apps, user-level randomization is often fine. At Uber, treatment can affect shared supply. One rider's treatment can change another rider's outcome. That means &lt;code&gt;SUTVA&lt;/code&gt; may fail.&lt;/p&gt;

&lt;h3&gt;
  
  
  When interference matters
&lt;/h3&gt;

&lt;p&gt;If treatment changes dispatch, pricing, ETA display, or demand, untreated users may still be affected.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a rider-facing ETA change shifts demand in a neighborhood&lt;/li&gt;
&lt;li&gt;a driver incentive changes driver supply for everyone nearby&lt;/li&gt;
&lt;li&gt;a marketplace ranking change affects matching outcomes across groups&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you ignore that, your experiment readout may look precise and still be wrong.&lt;/p&gt;

&lt;h3&gt;
  
  
  Know when to propose switchback experiments
&lt;/h3&gt;

&lt;p&gt;For marketplace changes, Uber often needs geo-time randomization instead of user-level assignment.&lt;/p&gt;

&lt;p&gt;A strong answer for an ETA or dispatch experiment usually includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the estimand&lt;/li&gt;
&lt;li&gt;the randomization design&lt;/li&gt;
&lt;li&gt;primary metrics and guardrails&lt;/li&gt;
&lt;li&gt;the inference plan&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A reasonable design is a switchback experiment with city-zone-hour cells. You randomize treatment by market and time block, then analyze results with cluster-robust standard errors or a regression with time and geography fixed effects.&lt;/p&gt;

&lt;p&gt;Do not use naive row-level standard errors if the design is clustered.&lt;/p&gt;

&lt;h3&gt;
  
  
  Power is different under clustering
&lt;/h3&gt;

&lt;p&gt;For clustered experiments, you need to account for design effect:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;DEFF = 1 + (m - 1)rho&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;where &lt;code&gt;m&lt;/code&gt; is cluster size and &lt;code&gt;rho&lt;/code&gt; is intra-cluster correlation.&lt;/p&gt;

&lt;p&gt;That means more events inside the same cluster do not help as much as people expect. More independent clusters or time blocks usually matter more.&lt;/p&gt;

&lt;h2&gt;
  
  
  4) A/B testing answers need a decision framework
&lt;/h2&gt;

&lt;p&gt;A lot of candidates list metrics and stop there. Uber wants a launch recommendation, not a metrics dump.&lt;/p&gt;

&lt;p&gt;A solid structure is:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Define the objective
&lt;/h3&gt;

&lt;p&gt;Example: Does a promo targeting change increase completed trips or gross bookings at an acceptable promo cost and contribution margin?&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Pick the right randomization unit
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;rider_id&lt;/code&gt; for rider promos&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;driver_id&lt;/code&gt; for driver incentives&lt;/li&gt;
&lt;li&gt;geo or switchback for marketplace changes with spillovers&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Choose one primary metric
&lt;/h3&gt;

&lt;p&gt;Possible primary metrics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;completed trips per user&lt;/li&gt;
&lt;li&gt;conversion rate&lt;/li&gt;
&lt;li&gt;gross bookings&lt;/li&gt;
&lt;li&gt;variable contribution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then add a short list of guardrails:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cancellation rate&lt;/li&gt;
&lt;li&gt;ETA&lt;/li&gt;
&lt;li&gt;surge rate&lt;/li&gt;
&lt;li&gt;driver utilization&lt;/li&gt;
&lt;li&gt;support contact rate&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Check validity before interpretation
&lt;/h3&gt;

&lt;p&gt;You should mention:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sample ratio mismatch&lt;/li&gt;
&lt;li&gt;exposure correctness&lt;/li&gt;
&lt;li&gt;pre-treatment balance&lt;/li&gt;
&lt;li&gt;logging completeness&lt;/li&gt;
&lt;li&gt;novelty or day-of-week effects&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Make the recommendation based on practical value
&lt;/h3&gt;

&lt;p&gt;Do not say "p &amp;lt; 0.05, ship it."&lt;/p&gt;

&lt;p&gt;A result can be statistically significant and still be a bad launch if contribution drops, promo spend gets out of control, or marketplace health gets worse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final prep advice
&lt;/h2&gt;

&lt;p&gt;If you're studying for this interview, spend less time on abstract ML talk and more time on clean definitions, marketplace-aware experiment design, and SQL execution details. That is where many answers get weak.&lt;/p&gt;

&lt;p&gt;The full &lt;a href="https://prachub.com/interview-prep/uber-data-scientist-interview-prep?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;Uber Data Scientist interview prep guide on PracHub&lt;/a&gt; goes deeper on ETA evaluation, A/B testing, SQL patterns, and practice prompts. If you want to pressure-test yourself, work through timed &lt;a href="https://prachub.com/interview-questions?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=backlinks" rel="noopener noreferrer"&gt;practice questions here&lt;/a&gt; and say your answer out loud like you're already in the interview.&lt;/p&gt;

</description>
      <category>interview</category>
      <category>career</category>
      <category>uber</category>
      <category>datascientist</category>
    </item>
  </channel>
</rss>
