What it is
A model reads text as tokens, and training processes each example as one sequence of tokens. Providers set a per-example token limit: the longest sequence a single training record may contain. It is often smaller than the model's context window in normal use, because training needs memory not only for reading the tokens but also for computing how every weight should change.
Most support chats fit easily. The ones that don't are long troubleshooting threads, conversations where someone pasted a log file, or chats that carried on for an afternoon. Each of those needs a decision.
How it works
record tokens = system prompt + every earlier turn + the target reply
fits = record tokens ≤ per-example limit
rough estimate: tokens ≈ characters ÷ 4 (English text)Trim works backwards from the target reply. The system prompt and the target are always kept, then exchanges are removed starting from the beginning of the conversation until the total fits. Exchanges are removed whole — a user message together with the reply to it — so the record never starts with a dangling answer to a question that has gone.
Why the oldest end? For most chats the most relevant context is the most recent: the question being answered, the error message just quoted, the last thing the assistant suggested. Research on long inputs also shows models use information at the start and end of their context better than material buried in the middle (Liu et al., 2023), so a shorter, focused record loses less than the token count suggests.
Drop excludes the record. Use it when the early part of a conversation is essential to the answer — for example, when the user states their account type or a key constraint in the first message and the target reply depends on it. A trimmed version of such a chat would teach the model to answer without information it actually needed, which is a quiet way to teach it to guess.
Remove the oldest exchanges until the record fits, keeping the system prompt, the latest context and the target. Keeps every example in the dataset.
Exclude any record that is over the limit. Choose it when answers depend on details given early in long conversations, or when only a handful of records are affected.
- The record holds a 250-token system prompt, three earlier exchanges of 1,500, 1,300 and 1,200 tokens, the user's question (350) and the target reply (600): 5,200 tokens.
- Remove exchange 1: 3,700 tokens. Still over.
- Remove exchange 2: 2,400 tokens. It fits, with 600 to spare.
- The trained-on record keeps the system prompt, exchange 3 (where the import error was quoted), the question and the answer — everything the target actually refers to.
- Had the user said “I'm on the legacy plan” in exchange 1 and the answer depended on it, Drop would have been the safer choice.
Why counts are estimates
Each model family has its own tokenizer, so the same sentence can be 20 tokens for one model and 24 for another. Counts shown before training are therefore estimates (English averages roughly four characters per token); the provider counts exactly when it receives the file. Code, numbers, URLs and non-English text usually take more tokens per character than plain English, so leave headroom when your data is heavy on any of those.
Common mistakes
- Forgetting the system prompt is counted in every record: a 600-token prompt leaves 600 fewer tokens for the conversation.
- Trimming chats whose answer depends on something said at the start, then wondering why the model invents account details.
- Assuming the estimate is exact and running right up to the limit with code- or number-heavy data.
- Ignoring how many records were trimmed: if it is most of them, the dataset may suit a model with a higher limit better.
References and further reading
External sources open in a new tab.
- 01Lost in the Middle: How Language Models Use Long ContextsLiu et al., 2023 · arXiv · arxiv.orgModels use information at the start and end of long inputs better than in the middle.
- 02Prepare data for fine-tuning your modelsAmazon Bedrock User Guide · docs.aws.amazon.comReal per-example token limits for several models, side by side.
- 03Prepare supervised fine-tuning data for Gemini modelsGoogle Cloud documentation · docs.cloud.google.comAnother provider's dataset requirements, including size limits.