Learn
AI & LLM foundations

What is an Apache-2.0 license in AI?

The short answer

Apache-2.0 is a permissive open-source licence that allows commercial use, modification, distribution and patent use, provided copyright and licence notices are kept and changes are stated. It is common for open-weight models and datasets because it is business-friendly and includes an express patent grant.

On this page

Where it comes from

Apache-2.0 was released by the Apache Software Foundation in 2004 as an update to the earlier Apache-1.1 licence. It was written to solve a specific problem: organisations wanted to contribute to open-source projects without worrying that a contributor's patent would later be used against them. The patent grant and the patent retaliation clause are the features that distinguish it from MIT and BSD, and they are the reason it became the default for corporate-backed open source.

It is approved by the Open Source Initiative, which means it meets the Open Source Definition: free redistribution, source code availability, permission for derived works, no discrimination against persons or fields of use, and no restriction on other software distributed alongside it. It is also recognised by the Free Software Foundation as compatible with version 3 of the GPL, though not with version 2.

In AI it spread because model publishers wanted a licence that enterprises would accept without a legal review cycle. A permissive licence with an explicit patent grant and a clean warranty disclaimer is exactly what a procurement team wants to see.

What it allows

Section 2 of the licence grants a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright licence to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense and distribute the work and such derivative works in source or object form.

In plain terms: you can use it commercially, modify it, combine it with proprietary code, distribute the result, and charge money for it. You do not have to publish your modifications. You do not have to open-source your product. There is no copyleft obligation and no requirement to share revenue.

Section 3 adds a patent licence. Contributors grant you a royalty-free licence to any patents they hold that are necessarily infringed by their contribution. This matters more than it sounds: it means a contributor cannot donate code to a project and then sue users of that project for patent infringement over the same code.

The grant is irrevocable unless you breach it, which in practice means unless you sue someone over the work alleging patent infringement. That retaliation clause is the trade: you get patent peace, and you give up the option of using patents offensively against the project.

What it requires

Section 4 sets the conditions, and they are modest but real. If you redistribute the work or a derivative, you must give recipients a copy of the licence. You must cause any modified files to carry prominent notices stating that you changed the files. You must retain all copyright, patent, trademark and attribution notices from the source form of the work, excluding notices that do not pertain to any part of the derivative. And if the work includes a NOTICE file, any derivative you distribute must include a readable copy of the attribution notices in that file, in at least one of three places: within the NOTICE file of your distribution, within the source form or documentation, or within a display generated by the derivative.

Two nuances trip people up. "Prominent notices" for modified files is a requirement about files, not about the whole repository, so a project that vendors a model into a subdirectory should add a short marker to the files it changed rather than relying on a line in the README. And the NOTICE requirement only activates if the original distribution actually has a NOTICE file; many model repositories do not, in which case there is nothing to propagate beyond the licence and copyright notices.

Section 6 is a clarification rather than a condition: the licence does not grant trademark rights. You cannot use the licensor's name, logo or product names to endorse your derivative without permission. Section 7 disclaims warranty, and Section 8 limits liability. Both are standard and both matter commercially: the model comes with no promise that it works or that it does not infringe anything.

The patent clause in detail

The patent grant is the reason Apache-2.0 exists, so it is worth understanding precisely. Each contributor grants a licence to their own contributions, not to the project as a whole and not to third-party patents. If a contributor's code infringes a patent held by somebody else, Apache-2.0 does nothing about it.

The termination clause is the teeth. If you initiate patent litigation against any entity alleging that the work or a contribution incorporated within it constitutes patent infringement, your patent licence under this licence terminates as of the date the litigation is filed. It is a defensive mechanism: use patents against the project and you lose your own patent cover for it.

For an AI team, the practical implication is modest but worth knowing. Apache-2.0 gives you comfort that a contributor will not turn around and assert a patent over the weights or code they published under it. It gives you no comfort at all about patents held by companies that never contributed, which in machine learning is a live risk. Patent risk in AI comes from a wide field of players, and no model licence can clear it.

How it applies to model weights

Applying a software licence to a binary blob of floating-point numbers is not obviously straightforward, and the law here is still developing. The work being licensed is the model artefact: the weights file, the configuration, the tokenizer and associated documentation. Publishers who release under Apache-2.0 are asserting that they have the rights to license that artefact, and users generally rely on that assertion.

If you fine-tune an Apache-2.0 model and distribute the result, the conventional reading is that the fine-tuned weights are a derivative work, so the licence obligations travel with them: include the licence, keep notices, state significant changes, and do not use the original name in a way that implies endorsement. This is what most practitioners do, and it is the conservative position.

Two practical points. First, keep a copy of the licence text and any NOTICE file in your model directory and in your distribution artefacts, because "we put it in the repo root" is harder to demonstrate two years later. Second, if you distribute a quantised or merged model, document what you changed. The requirement to state changes is trivial to satisfy and awkward to reconstruct afterwards.

How it applies to datasets

Apache-2.0 is also used for datasets, and there the analysis is cleaner because a dataset is a collection of identifiable content. The licence covers the compilation and whatever the publisher owns, but it cannot grant rights over material the publisher did not own.

That is the trap. A dataset released under Apache-2.0 may contain scraped web pages, user reviews, code snippets under various licences, or images with unclear provenance. The licence on the dataset does not launder the rights of the underlying content. If you train a model on it and redistribute the model, you are relying on arguments about fair use, non-expressive use or transformation that are jurisdiction-specific and unsettled.

The responsible practice is to read the datasheet, check whether the publisher documents provenance and filtering, and prefer datasets with a clear chain of title when you are building something commercial. Where provenance is unclear, get legal advice rather than assuming the licence settles it.

Outputs are a separate question

A common question is whether model outputs are covered by the model's licence. The general view is that the licence governs the model, not the text the model generates, and that outputs are not automatically derivative works of the weights. Otherwise every user of an open model would be distributing a derivative work with every response.

That said, outputs can be affected by other terms. A provider's terms of service may impose conditions on generated content. Outputs may reproduce training data closely enough to raise copyright issues, particularly for memorised passages. And in some jurisdictions, purely machine-generated content may not attract copyright at all, which affects whether you can enforce rights over it.

The practical position for most products is that you own what you generate, subject to the provider's terms and to the possibility that an output reproduces protected material. Do not treat that as a legal certainty; treat it as the working assumption that most of the industry operates on, and check it against your jurisdiction and your contract.

Apache-2.0 compared with other licences

  • MIT: shorter and simpler, requires only the copyright notice and licence text, but has no express patent grant. Common for small libraries and some models.
  • BSD-3-Clause: similar to MIT plus a no-endorsement clause. Also no express patent grant.
  • Apache-2.0: permissive plus a patent grant, a retaliation clause and a NOTICE mechanism. Slightly more paperwork, materially more comfort for enterprises.
  • GPL-3.0: copyleft. Distributing a derivative requires source under the same licence. Compatible with Apache-2.0 in one direction, which is why Apache code can be used in GPLv3 projects but not the reverse.
  • AGPL-3.0: copyleft with a network clause, so offering the software as a service can trigger source-disclosure obligations. A serious consideration for hosted AI products.
  • Custom model licences: contracts rather than open-source licences. They may add user thresholds, acceptable-use restrictions or naming requirements, and they should be reviewed as contracts.

Compliance in practice

The obligations are light enough that most teams can meet them with a small amount of process. Keep a licence inventory: for every model, dataset and library in your stack, record the name, version, licence, source URL and the date you retrieved it. This is the same discipline as a software bill of materials, and it pays for itself the first time someone asks.

Then make the notices survive the build. A container image should contain the licence texts and NOTICE files for everything it ships. A public model artefact should carry them alongside the weights. A README that says "built on Model X, Apache-2.0" with a link is good practice and useful evidence, but it is not a substitute for including the text.

Finally, review the boundaries. Apache-2.0 on the model does not cover the training data, third-party patents, the outputs, or the trademarks. Those are four separate reviews, and conflating them is how teams end up surprised after launch.

  • Keep a licence inventory with model name, version, licence, source and retrieval date.
  • Include the full licence text and any NOTICE file in distributed artefacts, including container images.
  • Mark modified files when you fine-tune, quantise, merge or convert formats.
  • Do not use the original model or company name in a way that implies endorsement.
  • Attribute in the UI or documentation where the licence or NOTICE requires it.
  • Record the licence version you relied on, because repositories can change terms between revisions.
  • Escalate anything with a custom licence, a user threshold or a non-commercial clause.

Common mistakes

  • Assuming Apache-2.0 covers the training data, and therefore assuming the model is safe to redistribute for any purpose.
  • Dropping the NOTICE file because it seemed like boilerplate.
  • Advertising a fine-tune under the base model's name, which touches the trademark clause.
  • Treating an Apache-2.0 model as free of patent risk from third parties.
  • Forgetting that a quantised or merged artefact is still a derivative and still needs the notices.
  • Confusing "permissive" with "no obligations"; the obligations are small but they are conditions of the grant.
  • Relying on a blog post's summary of the licence instead of the licence text in the repository.
  • Assuming the licence grants rights over outputs, or that it settles ownership of generated content.

If you are releasing under Apache-2.0

The licence is a template you can apply to your own model or dataset, and the mechanics are simple. Include a LICENSE file with the unmodified Apache-2.0 text, and fill in the copyright line in the appendix with your name and the year. Add a NOTICE file if you have attributions to propagate, because downstream users are then obliged to carry it forward, which is how credit survives several layers of redistribution.

Add a model card covering intended use, training data provenance, evaluation results and known limitations. The licence disclaims warranty, but a card is what lets other people judge whether the model is suitable, and it is the difference between a release that gets used and one that gets ignored.

Check your own inputs before you license anything. If your weights derive from a base model under a different licence, or your training data includes material you cannot redistribute, Apache-2.0 on your release cannot cure that. You can only license what you have the rights to license, and the appendix copyright line is a statement that you believe you do.

Key points

  • Apache-2.0 is permissive: commercial use, modification, distribution and sublicensing.
  • It requires the licence text, retained notices, a NOTICE file where one exists, and a statement of changes.
  • It includes an express patent grant with a retaliation clause, which is its main advantage over MIT.
  • It grants no trademark rights and comes with no warranty.
  • It does not cover training data, third-party patents or model outputs.
  • For AI, the practical obligations are light but they must survive your build and distribution process.
  • This is an explanation, not legal advice; get counsel for anything commercially significant.
Page feedback

Was this helpful?

A quick signal helps improve these notes.

Report a mistake Straight to the lab inbox

Put it to work

See the models, datasets and gateway this lab runs.