← Back to all FAQs
FAQ

What does the stop sequence in few shot learning signify?

In few-shot learning and language model inference, a stop sequence is a specific character string or token that signals the AI model to immediately halt text generation. When constructing a few-shot prompt, you present multiple input-output example pairs separated by a consistent delimiter or structural tag (such as `###`, `---`, or `User:`). By configuring that exact delimiter string as the API's stop sequence parameter, you prevent the model from continuing to generate text endlessly or inventing fake user follow-up questions after completing its designated response. Once the model outputs the specified stop sequence string, the execution engine cuts off generation and returns the completed text. Stop sequences are vital for controlling API costs, ensuring structured parsing (like stopping at closing JSON tags), maintaining precise output boundaries, and preventing models from running endlessly in automated agent loops.

← what is few shot prompting what is chain of thought prompting →