Llama model behaviour
Llama as a weights family rather than an endpoint: tokenizer, chat template, licence terms, context windows and what changes between versions.
Every other model family in this library is a service. You send JSON to a URL, and the shape of the reply is somebody’s contract with you. Llama is not that. Llama is a set of files — weights, a tokenizer, a config, a licence — and the thing that answers your request is whatever runtime you or your provider pointed at those files. That distinction is not pedantry. It is the reason two hosts of “the same” Llama model can disagree about where a message ends, how long an answer may run, and whether a system prompt is honoured at all.
So these pages are written against the artefacts rather than against an API: the special tokens in the tokenizer, the reference prompt format Meta publishes, the fields in config.json, the clauses in the community licence. Where a runtime commonly departs from the reference, that is said explicitly, because the departure is usually what sent you looking. Where a figure is Meta’s, it is attributed and dated; where it is arithmetic, the assumptions are on the page.
Llama 3’s Context Window: From 8K to 128K Across Releases
The documented context length of each Llama 3.x release, where it changed, and why the number your runtime reports may be smaller.
8 min read
Llama 3’s Chat Template and Special Tokens
The reference prompt format Meta publishes, annotated token by token against a fully rendered two-turn conversation.
9 min read
Llama 3’s Tokenizer Vocabulary Size, and What Changed From Llama 2
The documented vocabulary sizes for both generations, what a four-fold vocabulary costs in parameters, and how to reproduce the token-count difference yourself.
8 min read
Llama Guard: Meta’s Separate Moderation Model, Not a Built-In Refusal Layer
Why a downloaded Llama has no moderation endpoint, what Llama Guard is instead, and where it sits in a request.
8 min read
Function Calling With Llama 3: The JSON Convention Meta Documents
How tool calls work on a model with no tool-call API field: the documented prompt convention, the tokens that terminate a call, and what you have to parse.
9 min read
Llama 3’s System Prompt: How the Reference Template Structures It
The system role is a header block inside the prompt string, not an API field — what that changes about position, precedence and the lines the template inserts for you.
8 min read
Does Meta “Deprecate” Llama Models? What That Means for Open Weights
There is no shutdown switch in a file you already have, so deprecation for Llama means something else entirely — and that something else can still break you.
9 min read
Llama 3.2’s Vision Models: Which Sizes Support Image Input
Two of the four Llama 3.2 sizes take images and two do not, and the split is architectural rather than a matter of scale.
8 min read
Llama 3’s Two End Tokens: eot_id and end_of_text
Why Llama 3 has two stop tokens, which model emits which, and the exact generation config that stops on both.
7 min read
Determinism in Self-Hosted Llama: Why the Same Weights Can Still Drift
Temperature 0 removes the sampler as a source of variation and leaves several others, all of them in the arithmetic underneath.
9 min read
Llama’s Output Length: No Hard API Cap, Just max_new_tokens
Open-weight Llama has no provider-imposed output ceiling; the limits are the parameter you set, the context window, and where the model chooses to stop.
8 min read
RoPE Scaling in Llama 3.1: How the Context Window Was Extended Past 8K
The rope_scaling block in Llama 3.1's config, what its four numbers mean, and why factor 8 does not produce a 65K context.
9 min read
Llama 3’s License: What the Terms Actually Permit
The specific obligations in Meta's community licence — attribution, naming, the notice file and the 700-million-user threshold — and what changed at 3.1.
9 min read
Llama 3.1 405B's Context Window: The Documented Number and the Real One
Meta documents 128K tokens for Llama 3.1 405B; the config file says 131,072, and the memory arithmetic decides what you actually get.
8 min read
The Refusal Behaviour Baked Into Llama 3's Instruction Tuning
Why an Instruct checkpoint refuses things the base weights do not, and how that differs from a moderation filter sitting in front of a hosted API.
9 min read
Llama 3.1's Built-In Tools: Brave Search, Wolfram and Code Interpreter
The three tool names Llama 3.1 was tuned to emit, the prompt lines that enable them, and why none of them does anything until you implement it.
9 min read
Why Llama 3's Token Counts Differ From Llama 2's on Identical Text
The same paragraph tokenizes to fewer tokens on Llama 3 than on Llama 2, and the two vocabulary designs explain exactly how much and where.
8 min read
Llama 3's Knowledge Cutoff Date, Model by Model
The cutoff Meta documents for each Llama 3.x and Llama 4 release, why 3 8B and 3 70B differ, and why the prompt template's date line is not evidence.
8 min read
Pinning a Llama Checkpoint by Commit Hash Instead of a Moving Tag
How to load a Hugging Face repository at an exact revision, why main is mutable, and what changes underneath you when it moves.
9 min read
What Happens When You Exceed a Self-Hosted Llama's Context Length
The error vLLM raises, the warning llama.cpp prints, and the silent truncation Ollama performs — three different behaviours from one overflowing prompt.
9 min read
Multi-Turn Tool Results in Llama 3's Chat Template
The ipython role Meta defines for feeding tool output back into the prompt, shown as a complete raw exchange from call to final answer.
9 min read
The Streaming Response Shape a Self-Hosted Llama Server Returns
vLLM, llama.cpp, Ollama and TGI stream the same tokens in four different envelopes; here is each one and what the last event carries.
9 min read
Llama 3.2's 1B and 3B Models: Context Window at the Small End
Meta documents the same 128K window for the 1B and 3B models as for the 405B, and on a small model the cache for it outweighs the weights.
8 min read
Why Llama Sometimes Ignores a Stop Sequence Mid-Generation
Stop tokens and stop strings are two different mechanisms implemented in two different places, and most ignored stop sequences are a mismatch between them.
9 min read
Llama 4's Mixture-of-Experts Routing and What It Changes About Output
Meta's published total and active parameter counts for Scout and Maverick, and what 17B active actually means for a single forward pass.
9 min read
Llama's Context Window Counted in Tokens: Fitting a Document
How to turn a word count into a token budget for a Llama context window, with every term in the arithmetic named and the ratio measured rather than assumed.
8 min read
Other topics
- LLM fundamentals & architecture
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Flaky tests against a model
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Building an extraction pipeline
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Hallucination & failure modes
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- OpenAI model behaviour
- Claude model behaviour
- Gemini model behaviour
- Mistral model behaviour
- Qwen model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Grok model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models