Models, Tokens & Prompts

The vocabulary you need before writing your first line of AI code.

1 min read

Foundation models

A foundation model is a large, pre-trained model that can handle many tasks. Bedrock offers models from several providers, each with strengths in quality, speed, cost, and features such as images or long documents. Every model has a model ID string you pass in code.

Tokens: the unit of everything

Models read and write tokens, chunks of text that are roughly ¾ of an English word on average. Tokens determine:

  • Cost: you pay per input token and per output token
  • Limits: each model has a maximum context window (how much text it can read at once)
  • Speed: more output tokens take longer to generate

Prompts and messages

Chat models take a list of messages, each with a role:

  • user: what the person asks
  • assistant: what the model said earlier (so it remembers the conversation)
  • A system prompt: standing instructions, like "You are a concise assistant. Answer in 2 sentences."
Tip

Better prompts beat bigger models surprisingly often. Be specific about the task, the audience, the format, and the length, and give an example of the output you want.

Key takeaways

  • Each model has an ID, and you can swap models by changing one string.
  • Tokens drive cost, limits, and speed. You pay for both input and output tokens.
  • Conversations are lists of user/assistant messages, plus an optional system prompt.

Check your understanding

Pick an answer to see the explanation.

  1. 1. Which two things are you billed for when calling a text model on Bedrock?