Sub topic 1
Open-Weight Models and What vLLM Loads
Prerequisites
Assume you know basic Python and command-line use, understand prompts and completions, and have a basic idea of GPUs, GPU memory, HTTP APIs, and JSON.
What “open-weight” means
An open-weight model is a language model whose trained numerical parameters are available for download. These parameters are often called weights. You can run inference, which means using the model to produce text, on your own hardware instead of sending prompts to a hosted API.
Open weights do not always mean unrestricted use. A model can have a license that limits commercial use, redistribution, or particular applications. Read the model card and license before deploying it.
vLLM normally loads models published in the Hugging Face model format. A model repository contains more than one large file:
| Repository item | Purpose |
|---|---|
| Weight files | Store the learned parameters |
| `config.json` | Describes the model architecture and dimensions |
| Tokenizer files | Convert text to token IDs and back |
| Generation settings | Provide default generation behavior |
| Model card and license | Document usage, limits, and intended behavior |
The exact filenames vary. Large models may split their weights across several files and include an index that maps parameter names to files.
What vLLM loads
When you create an LLM object, vLLM first identifies the architecture from the configuration. It then loads the tokenizer and model weights, places model data on the selected device, and prepares memory for inference.
The tokenizer is important because the neural network does not receive raw text. It receives integer token IDs. For a request, the tokenizer converts the prompt into IDs. After generation, it converts output IDs back into text.
flowchart TD
A[Hugging Face model repository] --> B[config.json]
A --> C[Tokenizer files]
A --> D[Weight files]
B --> E[vLLM model loader]
C --> E
D --> E
E --> F[GPU model and inference engine]
F --> G[Generated text]The model architecture must be supported by the installed vLLM version. A repository can be valid Hugging Face content and still fail to load if it uses an unsupported architecture, incompatible weight format, or missing tokenizer files.
Loading a model locally
The following example downloads the model on first use, then runs one prompt. The model name identifies a Hugging Face repository.
from vllm import LLM, SamplingParams
llm = LLM(
model="Qwen/Qwen2.5-1.5B-Instruct",
max_model_len=4096,
)
params = SamplingParams(max_tokens=64, temperature=0.2)
outputs = llm.generate("Explain model weights in one sentence.", params)
print(outputs[0].outputs[0].text)vLLM may use a local cache after the first download. In production, pin a specific model revision rather than silently using whatever the repository publishes later. Also verify the license and model provenance.
Choosing a repository
Instruction-tuned models are trained to follow user instructions and usually fit chat applications better than base models. Base models continue text but may not reliably follow conversational prompts. Later chapters cover chat templates and serving interfaces.
Exercise
Which repository components does vLLM need to turn a downloaded model into an inference engine?
Show answer
It needs the architecture configuration, tokenizer files, and model weight files. The model card and license are also needed to evaluate whether and how you may use the model.