What is a token in an LLM?
A token is a unit of text or other input representation processed by a model; it may be a word, word fragment, punctuation mark, or special token.
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 109–120 of 3610 questions
A token is a unit of text or other input representation processed by a model; it may be a word, word fragment, punctuation mark, or special token.
A context window is the amount of tokenized input and output a model can consider for a single request.
Prompting changes instructions and context at inference time, while fine-tuning updates model parameters using training examples.
A backend typically sends a model identifier, messages, generation settings, and optional tool definitions to a provider API, then validates and returns the result.
Temperature controls the randomness of token selection in many generation APIs.
The output-token limit caps how much generated content a model can return.
Store provider API keys in a secrets manager or protected server-side environment configuration, rotate them, and scope access to the minimum required.
Handle rate limits with bounded retries, exponential backoff, jitter, concurrency controls, and provider-specific retry guidance.
A good system prompt clearly states the assistant's role, task boundaries, expected style, tool-use rules, and response format.
Few-shot prompting includes a small number of examples showing the desired input-output pattern.
Chain-of-thought prompting asks a model to reason through a task, but applications should not depend on hidden reasoning being complete or faithful.
Prompt injection is an attempt to make a model ignore intended instructions by placing adversarial directions in user input or retrieved content.