Autonomía digital y tecnológica

Código e ideas para una internet distribuida

Linkoteca. tokens


Captura de pantalla de platform.openai.com/tokenizer

OpenAI’s large language models (sometimes referred to as GPT’s) process text using tokens, which are common sequences of characters found in a set of text. The models learn to understand the statistical relationships between these tokens, and excel at producing the next token in a sequence of tokens.

You can think of tokens as the “letters” that make up the “words” and “sentences” that AI systems use to communicate.

A helpful rule of thumb is that one token generally corresponds to ~4 characters of text for common English text. This translates to roughly ¾ of a word (so 100 tokens ~= 75 words).

The process of breaking text down into tokens is called tokenization. This allows the AI to analyze and “digest” human language into a form it can understand. Tokens become the data used to train, improve, and run the AI systems.

Why Do Tokens Matter? There are two main reasons tokens are important to understand:

  1. Token Limits: All LLMs have a maximum number of tokens they can handle per input or response. This limit ranges from a few thousand for smaller models up to tens of thousands for large commercial ones. Exceeding the token limit can lead to errors, confusion, and poor quality responses from the AI.
  2. Cost: Companies like OpenAI, Anthropic, Alphabet, and Microsoft charge based on token usage when people access their AI services. Typically pricing is per 1000 tokens. So the more tokens fed into the system, the higher the cost to generate responses. Token limits help control expenses.

Strategies for Managing Tokens

Because tokens are central to how LLMs work, it’s important to learn strategies to make the most of them:

  • Keep prompts concise and focused on a single topic or question. Don’t overload the AI with tangents.
  • Break long conversations into shorter exchanges before hitting token limits.
  • Avoid huge blocks of text. Summarize previous parts of a chat before moving on.
  • Use a tokenizer tool to count tokens and estimate costs.
  • Experiment with different wording to express ideas in fewer tokens.
  • For complex requests, try a step-by-step approach vs. cramming everything into one prompt.