Skip to main content

04 · ML and LLM foundations

Models, open weights and Hugging Face

Closed models and models you can download, what their licenses allow, and Hugging Face as the place where models are shared.

13 minCase study: Adapta (opens in new window)

Before anyone writes a , trains an or starts a server, someone picked a model. That choice sets what the system can do, what it costs, where the data travels and what the license allows. It is often made on popularity alone.

This lesson covers how to choose deliberately: closed versus open models and their licenses, how to read what a model is, why downloading one means trusting someone, and how to make the final call. The running example is Adapta, which downloads its from Hugging Face.

Closed models, open models and licenses

There are two ways to use a model. A works like a service: you send text to the provider's API and get an answer, but the model never leaves their servers. An works like software you install: you download its weights, the billions of numbers learned in , and run them wherever you want.

Closed (API) Open weights
Examples OpenAI, Anthropic, Google (Gemini) Meta (Llama), Mistral, Alibaba (Qwen), DeepSeek, Google (Gemma)
Versions The provider updates and retires them You keep the exact version you tested
Adapting it Whatever the API offers Fine-tuning, compression, adapters

Being able to download a model does not make it open source. The OSI's Open Source AI Definition also asks for the full code and enough information about the training data to rebuild something equivalent. Most popular models publish only the weights.

What you may do with them is set by the license, and licenses vary a lot:

  • Permissive (Apache-2.0, MIT): almost any use. DeepSeek-R1 shipped under MIT, some Mistral models under Apache-2.0.
  • Custom community licenses add conditions. The Llama 3.1 license, for example, requires Meta's permission above 700 million monthly active users.
  • Terms with prohibited uses, such as the Gemma Terms of Use.
  • Research or non-commercial licenses rule out use in a product without a separate agreement.

Reading what a model is

A model's name tells you most of what you need. Take Qwen2.5-3B-Instruct-GGUF:

  • Size (3B): three billion parameters. It drives memory, quality and speed. Small models fit on a consumer graphics card and are worth trying first.
  • Base or instruct: a base model only continues text, like autocomplete; an instruct model was further trained to follow instructions. Applications almost always use the latter.
  • Modality: models marked VL (vision-language) accept images as well as text.
  • Format (GGUF): how the weights are stored on disk.

Two formats cover most cases. holds only the numbers and is the standard across Hugging Face. packs them into one file for llama.cpp and similar engines, usually compressed to run on modest hardware (see Serving models). Adapta trains with the first and serves the second, converting its adapters in between (Fine-tuning, LoRA and QLoRA).

In Adapta

  1. Hugging Face Hubone model, published in two formats
    • safetensors
    • GGUF
  2. Trainingloads the safetensors weights
  3. Conversionthe trained adapter becomes GGUF
  4. ServingGGUF base plus the adapter
Adapta uses the same model in both formats: one to train, one to serve. The conversion is where an adapter crosses from one to the other. Source: Stack & decisions

Each model also has a , the page describing intended uses, limitations, data and evaluation, with the license in its metadata. Read it before downloading.

Hugging Face and its alternatives

Hugging Face does for models what npm or PyPI do for code: a public registry where anyone publishes and downloads. Its Hub hosts versioned repositories of models and datasets, and its libraries, led by transformers, load, run and train them. It also offers hosted demos and services; its own inference server, TGI, is in maintenance mode.

Adapta ships no weights: its README tells you to download the base model from the Hub, and the server stops with instructions if the file is missing.

Downloading a model means trusting someone

A model file looks like data, but it can run code. Older PyTorch files use a Python format called pickle, and opening one can execute arbitrary code. safetensors exists to prevent exactly that.

A second door is trust_remote_code, an option that lets a repository run its own code on your machine. When it is truly needed, the documentation recommends pinning the download to one exact version, so nobody can change the code under you.

Choosing a model

Start from what your system needs, not from a ranking:

Criterion The question
Task Text, code, images, tool use, long reasoning?
Speed How long will the user wait? Larger models are slower
Cost Pay per use or your own hardware? At what volume?
Privacy May the data leave your infrastructure?
License Does it allow commercial use at your scale?
Context window Do your instructions and material fit in what the model reads at once?

Read the table as the first filter in a sequence. Each step shortens the list, and the last one decides:

  1. Your needstask, speed, cost, privacy
  2. Licensemay you use it this way?
  3. Shortlistpublic benchmarks help here
  4. Your own testscases taken from your real work
  5. Decisionthe model, pinned to one version
Choosing a model narrows a long list step by step. Public rankings only help in the middle; the final call comes from your own cases.

Public benchmarks help build a shortlist, not make the decision. Test questions may have leaked into training data, so the score measures memory rather than ability; this is called contamination (Xu et al., 2024). And your task does not look like the benchmark's. Hugging Face itself closed its Open LLM Leaderboard in March 2025, saying it pushed people to optimize for things that no longer mattered. The decision belongs to a test set built from your own cases (Evaluating models).

Putting it into practice

  • Check the license before the benchmark. An excellent model under a non-commercial license cannot go into a product.
  • Treat closed versus open as a data and operations decision, not only a quality one. give you version control and privacy, and hand you the infrastructure.
  • Manage weights like any dependency: pinned versions, safe formats and a record of which model runs where.

Sources

Go deeper

Adapta's own documentation covers how it picks, stores and runs its base models:

  • Operations Runbook has a base-model catalog section listing each model with its Hugging Face source, license and the graphics memory it needs to train.
  • Learning the system explains weights, GGUF and from first principles, treating a model file like a compiled program.
  • Stack and decisions explains why Adapta serves GGUF files with llama.cpp rather than vLLM, Hugging Face's own libraries or Ollama.

Key takeaways

  • Open weights are not open source; the license decides what you may do, and it can differ between sizes of one family.
  • The name, the model card and the file format tell you what a model is and how it runs.
  • A downloaded model is a dependency: pin it, prefer safetensors, avoid running repository code you don't need.
  • Benchmarks build the shortlist; your own tests decide.

Check yourself

A model publishes its weights under a non-commercial license. Is it open source?

No. Open source means anyone may use, study, change and share it for any purpose, and it also requires the code and information about the data. The non-commercial restriction alone rules it out.

Why is safetensors safer than an older pickle-based file?

safetensors holds only numbers and their description. Opening a pickle file can run whatever code was hidden inside it.

A model tops a public benchmark. Why is that not enough to choose it?

The score may be inflated by contamination, and the benchmark does not measure your task, speed, cost or license. Confirm the choice on a test set built from your own cases.