By Sagi Shaier · 13 November 2026 · 5 min read
Open-weight vs closed LLMs
How the two compare on data handling, setup, cost and updates, and a simple way to pick one for a project with private data or a short deadline.
An open-weight model is a model whose weight files you can download and run on your own hardware. A closed model is one you reach only through a provider's app or API, where the provider runs the model and sends you the result. Projects that build on a large language model usually start by picking one of the two.
Three ways to get a working model
Most projects that use a transformer do not train one from random weights, because that takes a large dataset and a lot of compute. There are three practical paths instead:
- build a small model yourself, which is useful for learning and narrow experiments
- load an already-trained open model and run its weights yourself
- call a closed model through an app or an API
These are three separate choices, not three stages of one pipeline. The second and third both start from a model someone else already trained.

What open weights means
A model is a large set of numbers, its weights, stored in files. An open-weight model lets you download those files together with three others. The tokenizer files hold the rules that split text into tokens and map each token to an id the model reads. The config file lists the model's sizes, such as how many layers it has. The model card is a page that describes what the model was trained for and what its license allows.
With those files on disk you can run the model on a laptop, a rented GPU or your own server. Depending on the license, you may also be allowed to modify the model, adapt it to a new task or ship it inside a product.
Language models built from transformers come in three shapes. Decoder-only models generate text one token at a time. Encoder-only models turn text into vectors for tasks such as classification, and encoder-decoder models read one text and write another, as in translation. Downloadable decoder-only families include Llama, Mistral and Qwen, and Gemma and Falcon are two more. BERT, RoBERTa and DeBERTa are downloadable encoder-only models, and T5 and BART are encoder-decoder ones.
Open weights still come with rules. Licenses differ between these families and some carry use restrictions, so read the license on the model's page instead of assuming it.
Looking at open weights in code
Hugging Face's transformers library downloads a model's files from the Hugging Face Hub, a website that hosts model repositories. GPT-2 is a small open-weight decoder-only model, and once it is loaded its weights are ordinary PyTorch tensors:
1from transformers import AutoModelForCausalLM
2
3model = AutoModelForCausalLM.from_pretrained("gpt2")
4
5print(sum(p.numel() for p in model.parameters())) # 124439808
6print(model.transformer.wte.weight.shape) # torch.Size([50257, 768])
7print(len(model.transformer.h)) # 12The model has 124,439,808 weights. wte is its token embedding table, with one row of 768 numbers for each of the 50,257 token ids in its vocabulary, and h holds its 12 transformer blocks. You can read, change or save any of these numbers, which a closed model does not let you do.

What a closed model means
A closed model is used through a product or an API. ChatGPT, Claude and hosted model APIs are examples. Your code sends input text over the network and the provider runs the model on its own hardware. You get back text or structured output such as JSON. The weights are not downloaded into your project. The provider handles serving, hardware, scaling and updates.

In Python, a call to a hosted model is usually one function call such as client.responses.create(model="some-hosted-model", input="Classify: the cute axolotl is calm"), where client is the provider's API client. You send text or structured messages and get output back. You usually do not receive the tokenizer, the hidden states, the logits (the raw score the model gives each possible next token) or any weight files.

That makes a closed API easier to start with. The cost is that you see less of what happens inside the model and control less of it.
The tradeoffs
Open weights usually give more control. You choose the hardware, inspect the files, pin one exact version and keep data inside your own environment if you run the model there. You also take on serving, monitoring, upgrades and the hardware bill.
Closed APIs cut setup. The provider runs the model and may offer hosted models larger than what you could run yourself. In exchange, every request leaves your app over the network and you pay per use. The provider can also update the model on its own schedule.

How to choose
A reasonable first question is what you need to control. Open weights usually fit when you need:
- the data to stay on your own servers
- one fixed version of the model that stays the same until you change it
- the model's files and internals, such as its logits
- to adapt the model to your task later, where the license allows it
A closed API usually fits when you need:
- something working quickly, with no model server to run
- managed serving, where the provider handles hardware and scaling
- a large hosted model that would not fit on your hardware
For example, a team that has to keep private support tickets on its own servers would lean toward open weights, since a closed API sends each ticket to the provider. A two-person team testing an idea for a week would lean toward a closed API, since nothing has to be set up.
Neither choice is better in general. The deciding factors for a given project are data sensitivity and latency, plus budget, team skills and the license.

Common mistakes
- Treating "open" as "no rules". The license and the model card still apply, and some licenses carry use restrictions.
- Pairing downloaded weights with another model's tokenizer. The weights were trained on one tokenizer's ids, so a different tokenizer gives ids that point to the wrong rows of the embedding table. The code can still run while the output is nonsense.
- Assuming a closed model stays the same. The provider may update it, so the same input can give a different output later.
- Comparing only per-request prices. Running open weights also costs hardware and the engineering time for serving, monitoring and upgrades.
Related concepts
How to load a model with Hugging Face transformers shows the code side of open weights: the Auto classes, the tokenizer that has to match and how to generate text. Fine-tuning vs transfer learning explained covers what you can do once you have the weights, which is keep training them on your own data. Encoder vs decoder vs encoder-decoder explains the three model shapes that the families above belong to.
QuiddityML teaches open and closed models as their own concept in the Intro to NLP track, right before loading models with Hugging Face. The multiple choice questions on it include picking the right path for a team that has to keep its support tickets on its own servers.