cost
AI, ML & GenAI interview questions tagged cost, across every topic.
16 questions · 2 unlocked for you
Concepts behind "cost"
The curriculum that explains the ideas these questions test.
Foundational
The LLM GatewayAn LLM gateway is one proxy layer sitting between your application and one or more model providers. It consolidates the cross-cutting concerns every LLM app needs: routing and fallback across models/providers, caching, rate limiting, authentication, cost tracking, observability, and guardrails. By hiding providers behind a single interface, it also guards against vendor lock-in. AI, ML, and GenAI engineer interviews probe it because it forms the backbone of a production LLM platform and holds most operational controls.⚙️ System Design for AI in Production
Foundational
LLM Cost OptimizationLLM systems get expensive fast, and the cost model comes down mostly to tokens and number of model calls. The levers, in rough order of impact: route easy queries to cheaper/smaller models, cache repeated and similar requests, trim context (fewer, better chunks), use cheaper retrieval/reranking, and for agents cut unnecessary steps. The discipline is measuring cost per request and going after the dominant contributor. AI, ML, and GenAI engineer interviews probe it because cost is a primary production constraint and most teams overspend by defaulting to the biggest model on everything.⚙️ System Design for AI in Production
Core
Small vs Large Models and RoutingBigger is not always better in production: small models are far cheaper and faster, and for many tasks they are good enough, especially when fine-tuned or given retrieval. The mature pattern is routing, send easy queries to a small/cheap model and hold back large or reasoning models for genuinely hard ones, often with a cascade that escalates on low confidence. AI, ML, and GenAI interviews probe it because picking and routing models is where most of the cost and latency budget is won or lost.🧠 Foundations of LLMs & GenAISign in
Core
Context Compression and Prompt CompactionWhen a prompt is too big, compression is the last lever you should reach for, not the first. Restructuring for a stable cached prefix is bigger and cheaper, and compaction (summarizing old turns, dropping stale tool output, reranking so you send five good chunks instead of twenty mediocre ones) covers most of the rest. Hard compression trades a measurable accuracy tax for tokens, and it can raise your bill by destroying cache hits. AI, ML, and GenAI interviews probe this because candidates reach for the clever technique before the free one.🧠 Foundations of LLMs & GenAISign in
Core
Retrieval vs Long ContextIf a whole document fits in a model's large context window, should you paste it, or retrieve only the relevant chunks? Long context is simpler but costly (quadratic attention), slower, and used unevenly (lost in the middle); retrieval is cheaper, faster, refreshes without retraining, and surfaces only what matters. The usual answer is retrieval for large, changing, or partially-relevant corpora, and long context for small, cohesive inputs. AI, ML, and GenAI engineer interviews test it because 'just use the big context window' is a common, costly oversimplification.🤖 Retrieval & AgentsSign in
Core
Prompt and Semantic CachingCaching ranks among the cheapest, highest-impact LLM optimizations. Prefix (prompt) caching reuses the computed attention state for a shared prompt prefix (a long system prompt or document), cutting prefill cost and latency. Semantic caching returns a stored answer for a query that is similar (not identical) to a past one, by embedding the query and matching nearest neighbors. AI, ML, and GenAI engineer interviews probe it because repetitive traffic is everywhere, and caching turns expensive recomputation into near-free lookups, with a correctness caveat for semantic caching.⚙️ System Design for AI in ProductionSign in
