Skip to content
RED SAGSkills
easyAI Engineer (LLM & Generative AI) interview question

How do tokens affect the cost and speed of an LLM application?

What the interviewer wants to hear

  • Pricing is usually per input and output token
  • Output tokens are slower and usually cost more
  • Long prompts and history increase cost and latency
  • Trim context, cache, and choose the right model size

Model answer

Most providers charge per token, with separate prices for input and output tokens, and output is usually more expensive. Speed also depends on tokens: the model processes the input first, which affects time to first token, then generates output one token at a time, so long answers take longer. In a chat app, history grows every turn, so cost per message grows unless I trim or summarise old messages. RAG adds retrieved chunks, so sending ten chunks when three are enough wastes money. To control this, I keep system prompts tight, retrieve fewer but better chunks, ask for concise answers or set max tokens, use prompt caching for repeated prefixes, and send simple tasks to smaller, cheaper models. I log token usage per feature so I can see where money goes.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy AI Engineer (LLM & Generative AI) questions