Latency & Cost Questions with Answers

21 practice questions on Latency & Cost (AI Engineering (LLM Apps)) with answers and step-by-step solutions. Try 10 samples below, then practise all 21 free in the AptiNest app.

Sample questions

Question 1Easy

Setting a max_tokens limit on responses mainly controls:

  1. The upper bound on output cost and generation time
  2. The embedding dimension
  3. The size of the input prompt
  4. The number of tools available

Answer: A. The upper bound on output cost and generation time

Explanation

Generation stops at the limit, capping per-request spend and latency.

Step-by-step solution

  1. max_tokens caps output length.
  2. Limits cost and time.
  3. Does not affect input.

Why the other options are wrong

  • B. Embedding dimension unrelated.
  • C. Input size unaffected.
  • D. Tools unaffected.

Question 2Easy

Prefill and decode are the two phases of LLM inference. Decode is:

  1. Loading model weights from disk
  2. Tokenising the user's input text
  3. Processing the whole prompt in parallel
  4. Generating output tokens one at a time

Answer: D. Generating output tokens one at a time

Explanation

Prefill processes input tokens together; decode produces one token per step, so long outputs take longer.

Step-by-step solution

  1. Prefill handles initial input processing in parallel.
  2. Decode generates output tokens sequentially.
  3. Each token is produced step by step during decoding.
  4. This makes long outputs slower compared to prefill.
  5. Final answer: Generating output tokens one at a time.

Why the other options are wrong

  • A. Loading weights is a setup step, not decode; decode produces output tokens one at a time.
  • B. Tokenising the input is a separate preprocessing step, not the decode phase.
  • C. Processing the whole prompt in parallel describes prefill, not decode.

Tip: Decode is slow for long outputs because it generates tokens step by step.

Question 3Easy

Streaming tokens to the user as they are generated mainly improves:

  1. Context length, since tokens are reused
  2. Perceived latency, since text appears after the first token
  3. Accuracy, since the model can revise
  4. Total cost, since streamed tokens are free

Answer: B. Perceived latency, since text appears after the first token

Explanation

Total generation time is similar, but users see progress from the time to first token.

Step-by-step solution

  1. Streaming shows text as it's generated, not all at once.
  2. Users feel faster response with early text visible.
  3. This reduces wait time before seeing any output.
  4. Perceived latency drops because of early feedback.
  5. Final answer: B (Perceived latency, since text appears after the first token).

Why the other options are wrong

  • A. Streaming does not reuse tokens or change the context length; it only shows output as it arrives.
  • C. Streaming does not make the model more accurate; it shows output sooner and does not revise it.
  • D. Streamed tokens are billed like any other output; streaming does not make them free.

Tip: Think about how users perceive speed, not just actual time.

Question 4Easy

Which choice usually reduces both cost and latency for simple FAQ-style questions?

  1. Routing them to a smaller, cheaper model
  2. Adding ten few-shot examples to each prompt
  3. Retrieving fifty chunks for every question
  4. Sending them to the largest model available

Answer: A. Routing them to a smaller, cheaper model

Explanation

Small models are faster and cheaper and are often good enough for easy requests.

Step-by-step solution

  1. Small models process questions faster, reducing latency.
  2. Smaller models use less resources, lowering cost.
  3. Simple FAQs don't need large models' power.
  4. Routing to smaller models saves time and money.
  5. Final answer: Routing them to a smaller, cheaper model.

Why the other options are wrong

  • B. Ten few-shot examples add input tokens to each call, which raises both cost and latency.
  • C. Fifty chunks add tokens and slow the call; FAQ questions do not need that much retrieval.
  • D. The largest model costs more and is slower for simple questions.

Tip: For simple tasks, use the simplest tool that works.

Question 5Medium

An app serves 40,000 requests a day at an average of ₹0.80 per request. What is the cost for a 30-day month?

  1. ₹32,000
  2. ₹96,00,000
  3. ₹960,000
  4. ₹1,20,000

Answer: C. ₹960,000

Explanation

40,000 × 30 × 0.80 = ₹960,000 (₹9,60,000 in Indian grouping).

Step-by-step solution

  1. Requests per month = 40,000 × 30 = 1,200,000.
  2. Cost = 1,200,000 × ₹0.80 = ₹960,000.
  3. In Indian grouping this is ₹9,60,000.
  4. So option C, ₹960,000, is correct.

Why the other options are wrong

  • A. ₹32,000 is only one day's cost (40,000 × 0.80).
  • B. ₹96,00,000 is ten times the correct amount.
  • D. ₹1,20,000 has no basis in the numbers given.

Tip: Multiply requests per day by days, then by the cost per request.

Question 6Medium

About how much memory do the weights of a 7-billion-parameter model need in 16-bit precision?

  1. 14 GB
  2. 7 GB
  3. 28 GB
  4. 3.5 GB

Answer: A. 14 GB

Explanation

7 × 10^9 parameters × 2 bytes
= 14 × 10^9 bytes
≈ 14 GB, before KV cache and activations.

Step-by-step solution

  1. 16-bit = 2 bytes per parameter.
  2. 7 x 10^9 x 2 = 14 x 10^9 bytes.
  3. = 14 GB.

Why the other options are wrong

  • B. 7 GB is 8-bit.
  • C. 28 GB is 32-bit.
  • D. 3.5 GB is 4-bit.

Tip: GB = billions of params x bytes.

Question 7Medium

For the same meaning, text in many Indian languages often uses more tokens than English with common tokenizers. The engineering consequence is:

  1. Higher cost and less effective context per request for that text
  2. No change, since billing is per character
  3. Lower cost, because those scripts are more compact than English when tokenised
  4. Faster generation because tokens are shorter

Answer: A. Higher cost and less effective context per request for that text

Explanation

Token-based pricing and context limits apply to tokens, so token-hungry scripts cost more; measure with the actual tokenizer.

Step-by-step solution

  1. Many Indian-language scripts split into more tokens per word than English with common tokenisers.
  2. Pricing and context limits count tokens, not characters.
  3. So the same meaning costs more and leaves less room in the context.
  4. So option A, higher cost and less effective context, is the consequence.

Why the other options are wrong

  • B. Billing is per token, so token count changes the cost.
  • C. These scripts usually take more tokens, not fewer, than English.
  • D. Shorter or longer tokens do not make generation faster for the user.

Tip: Measure token counts with the real tokenizer before costing a feature.

Question 8Medium

Which change usually reduces time to first token for long prompts?

  1. Adding more few-shot examples up front
  2. Raising the temperature, which makes the sampling step run faster
  3. Shorter prompts or a prefix cache hit for the static part
  4. Asking the model to answer more briefly

Answer: C. Shorter prompts or a prefix cache hit for the static part

Explanation

- TTFT is dominated by processing the input (prefill);
- fewer or cached input tokens cut it.

Step-by-step solution

  1. Time to first token depends on how much input needs pre-processing.
  2. Fewer input tokens mean less work for the model.
  3. Cached inputs save time by reusing previous computations.
  4. Short prompts or cached parts reduce prefill time.
  5. Final answer: Shorter prompts or a prefix cache hit for the static part.

Why the other options are wrong

  • A. More few-shot examples add input tokens, which increases the prefill work and slows the first token.
  • B. Temperature only changes sampling randomness; it does not speed up the prefill step.
  • D. A briefer answer shortens the output, not the prefill; time to first token depends on the input.

Tip: Cut input length or use caching to slash TTFT.

Question 9Hard

An agent runs 6 sequential LLM steps averaging 2.5 s each. Steps 2, 3 and 4 are independent of each other. If they run in parallel (taking as long as one step), what is the new total time?

  1. 12.5 s
  2. 10.0 s
  3. 15.0 s
  4. 7.5 s

Answer: B. 10.0 s

Explanation

Original 6 × 2.5 = 15 s. Merging three steps into one parallel step leaves 4 step-times: 4 × 2.5 = 10 s.

Step-by-step solution

  1. Total original time = 6 * 2.5 = 15.
  2. Parallel steps reduce to 4 sequential steps: 4 * 2.5 = 10.
  3. Final answer is 10.0 s.

Why the other options are wrong

  • A. 12.5 s counts five sequential steps; the three parallel steps collapse into one slot, leaving four.
  • C. 15.0 s is the original total of six steps; running steps 2 to 4 in parallel removes that time.
  • D. 7.5 s counts only three slots; the parallel steps still take one 2.5 s slot, so the total is 10 s.

Tip: Group parallel steps to cut time.

Question 10Hard

Two options for a classifier: a large general model at 10 units per call with 93% accuracy, or a small fine-tuned model at 1 unit with 92% accuracy. Volume is 5 million calls a month. What is the main engineering argument for the small model?

  1. Large models cannot do classification tasks
  2. The small model will always be more accurate later
  3. Fine-tuned models never need any evaluation
  4. A 90% cost cut for a one-point accuracy drop

Answer: D. A 90% cost cut for a one-point accuracy drop

Explanation

At 5 million calls the saving is 45 million units a month; whether one point of accuracy is worth that is the business decision.

Step-by-step solution

  1. Cost for large model = 10 * 5,000,000 = 50,000,000.
  2. Cost for small model = 1 * 5,000,000 = 5,000,000.
  3. Savings = 50,000,000 - 5,000,000 = 45,000,000.
  4. Accuracy drops by 1%, but cost is cut by 90%.
  5. Main argument is a 90% cost cut for a one-point accuracy drop.

Why the other options are wrong

  • A. Large models can do classification; the point is the cost gap, not an inability to classify.
  • B. Nothing guarantees the small model stays more accurate later; the numbers do not support that claim.
  • C. Fine-tuned models still need evaluation; the cost cut is the main argument, not skipping tests.

Tip: Calculate cost difference first; accuracy trade-offs are business decisions.

Practise all 21 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all AI Engineering (LLM Apps) topics · All topics