Design and explain robust web APIs for ML inference

Quick Overview

This question evaluates a candidate's proficiency in designing HTTP REST APIs for ML inference, including API endpoints, versioning, idempotency, request/response schemas, authentication/authorization, rate limiting, observability, and backward-compatibility policies, and it falls under the Coding & Algorithms domain for a data scientist role.

Design and explain robust web APIs for ML inference

Company: NVIDIA

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: hard

Interview Round: HR Screen

Design an HTTP API to serve image-based model predictions. Include: 1) Endpoints (e.g., POST /v1/predict, GET /v1/jobs/{id}/status), methods, idempotency, and versioning. 2) Request/response schemas (JSON + multipart), content types, standard error codes, and retry semantics with exponential backoff and idempotency keys. 3) Authentication/authorization (OAuth2/OIDC with scopes), rate limiting/quotas, and audit logging. 4) Backward compatibility and a deprecation policy. 5) Security (TLS, input validation, JWT verification), PII handling, and observability (structured logs, metrics, tracing, request IDs). 6) Provide a concise OpenAPI 3.0 snippet for one endpoint that captures parameters, schema, and error responses.

Quick Answer: This question evaluates a candidate's proficiency in designing HTTP REST APIs for ML inference, including API endpoints, versioning, idempotency, request/response schemas, authentication/authorization, rate limiting, observability, and backward-compatibility policies, and it falls under the Coding & Algorithms domain for a data scientist role.

|Home/Coding & Algorithms/NVIDIA
NVIDIA logo
NVIDIA
Oct 13, 2025, 9:49 PM
hardData ScientistHR ScreenCoding & Algorithms
3
0

Design an HTTP API for Image-Based Model Predictions

Context: Design an HTTP REST API that serves predictions for image inputs (e.g., classification, detection). Assume the service may need both synchronous and asynchronous inference, and will be consumed by first- and third-party clients.

Requirements

  1. Endpoints, Methods, Idempotency, and Versioning
  • Define core endpoints (e.g., POST /v1/predict for sync, POST /v1/jobs for async, GET /v1/jobs/{id}/status).
  • Specify HTTP methods and how idempotency is achieved (e.g., Idempotency-Key header).
  • Define versioning strategy.
  1. Request/Response Schemas, Content Types, Errors, Retries
  • Provide JSON and multipart request/response schemas and content types.
  • Define standard error codes and error schema.
  • Define retry semantics, exponential backoff, and use of idempotency keys.
  1. AuthN/AuthZ, Rate Limiting/Quotas, Audit Logging
  • Use OAuth2/OIDC with scopes.
  • Describe rate limiting and quotas.
  • Describe audit logging requirements.
  1. Backward Compatibility and Deprecation Policy
  • State which changes are backward compatible and how deprecations are communicated.
  1. Security and Observability
  • TLS, input validation, JWT verification.
  • PII handling.
  • Structured logs, metrics, tracing, request IDs.
  1. Provide a concise OpenAPI 3.0 snippet for one endpoint showing parameters, schema, and error responses.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...