Token budget
Python Token Budget Interview Questions
A token budget is the hard limit on how much text fits into one model call, and the work is deciding what to leave out. The instructions, the retrieved passages and the conversation so far all compete for the same window, so something has to be dropped on purpose rather than cut off at the end.
What token budget questions ask you to do
Across the questions here, these are the shapes that come up:
- Fit the highest scoring passages into a fixed number of tokens
- Drop the oldest turns of a conversation while keeping the instructions
- Skip an item that does not fit and carry on to a smaller one
- Reserve room for the answer as well as for the question
- Count what a message costs rather than guessing from its length
Common mistakes with token budget
Stopping at the first item that does not fit, which throws away every smaller one behind it. The other is trimming a conversation from the front, which removes the instructions the model needs on every call and leaves it answering without them. Decide what must survive, subtract it first, and spend what is left.
Questions to practice
Questions last reviewed 19 October 2026.
Roles this comes up in
Companies these come from
Other topics
- Filtering7
- Logical operators4
- Calculations11
- Conditional logic12
- NULL handling9
- Dates16
- Joins15
- Aggregations14
- Subqueries5
- Window functions32
- Reshaping15
- Arrays6
- Strings11
- Hashing8
- Two pointers4
- Sliding window1
- Binary search4
- Sorting1
- Math3
- Lists5
- Tuples3
- Dictionaries3
- Ranking16
- Running totals10
- Deduplication2
- Chunking1
- Similarity1
- Parsing4
- Backoff3
- Agent loop1
- Cost1