TokenPad

Parameters

Stop sequence

A stop sequence is a string that halts generation the moment the model produces it.

It is the cheapest way to stop a model rambling past the answer you wanted. Generation ends at that point, so nothing after it is produced or billed — unlike trimming in your own code, which costs you the full generation.

The sequence itself is typically not included in the returned text, which surprises people parsing the output for it.

In practice

Useful when the model reliably produces a delimiter you can cut at, and a false economy when it does not — a stop sequence that appears inside legitimate output truncates good answers silently. Check it against a hundred real outputs before shipping, because the failure looks identical to a model that simply stopped early.

Common questions

When should I use a stop sequence?

When the model reliably produces a delimiter you want to cut at, and you have checked that the sequence cannot appear inside legitimate output. A stop sequence that occurs mid-answer truncates silently.

Is the stop sequence included in the output?

Usually not — providers generally strip it. Check the specific API rather than assuming, because code that trims it a second time will start removing real content the day the behaviour differs.

Measure it

More in Parameters