Skip to content
RAG Repo

Data licensing for RAG

A practical guide to licences you will meet, and what they let you actually do.

When you build a Retrieval-Augmented Generation (RAG) system, you feed it a pile of documents to search through and quote from. That pile is your data, and someone made most of it. A licence is the written permission that tells you what you are allowed to do with that data: copy it, store it, show it to your users, or sell a product built on top of it. Get this wrong and you can end up shipping a product on data you were never allowed to use.

This guide walks through the licences you will meet most often. It is practical, not legal advice. When money or real risk is involved, read the actual licence and, if in doubt, ask a lawyer.

Why licensing matters for RAG

RAG copies text. To retrieve a passage and hand it to a language model, you store that text, index it, and often display a chunk of it back to the person asking the question. Every one of those steps is a use the licence has an opinion about. Two questions decide almost everything:

  • Can you use it commercially, meaning inside a product you charge for or a business you run for profit?
  • Does using it force conditions onto whatever you build, such as sharing your own work back?

Keep those two questions in mind and most licences become easy to sort.

Public domain

Public domain means the work belongs to everyone. Copyright has either expired or the creator gave it up, so there is no owner to ask. You can copy it, change it, and sell products built on it, with no strings attached.

A classic example is Project Gutenberg, which offers tens of thousands of older books whose copyright has run out. Some datasets use the CC0 tool, a formal way for a creator to place fresh work into the public domain. If your source is genuinely public domain, you are in the clear.

Creative Commons licences

Creative Commons is a family of ready-made licences, each built from a few reusable conditions. You will see them written as short codes. The conditions are:

  • BY (attribution): you must credit the creator.
  • SA (share-alike): anything you build and share must carry the same licence.
  • NC (non-commercial): you cannot use it for commercial purposes.
  • ND (no derivatives): you cannot share changed versions.

Mix these and you get the common variants:

  • CC BY: use it for anything, including commercial products, as long as you give credit. Friendly for RAG.
  • CC BY-SA: use it and credit it, but share-alike applies (more on that below).
  • CC BY-NC: credit it, but no commercial use. Fine for a research prototype, risky for a paid product.
  • CC BY-ND: you can share the work but not modified versions.

Wikipedia is the best-known CC BY-SA source. For RAG, attribution is usually a matter of storing the source URL and licence alongside each chunk (a passage of text) so you can credit it later.

Share-alike and copyleft

Share-alike, sometimes called copyleft, is the condition that trips people up. It says: if you build on this work and share the result, you must release your result under the same open licence. The goal is to keep open things open.

For a typical RAG setup this is often fine, because you are searching the data privately, not redistributing the dataset itself. The risk appears when you republish the content, bundle it into a downloadable product, or create a new dataset from it. At that point share-alike may reach your output. If your business depends on keeping something proprietary, meaning closed and owned by you, read share-alike terms carefully.

ODC-By and open data licences

Databases are sometimes covered by their own rules, separate from the text inside them. The Open Data Commons Attribution Licence (ODC-By) is a popular one: you can freely use and adapt the database, including commercially, as long as you attribute the source. It is roughly the database-world cousin of CC BY. FineWeb, a large filtered web dataset, is released under ODC-By, so you can build commercial RAG on it while crediting the maintainers.

Open Government Licence and government data

Governments publish enormous amounts of useful data, and many wrap it in a friendly licence. The Open Government Licence (OGL) is the UK standard: you can copy, adapt, and use the data commercially, as long as you credit the source and link back. Data from data.gov.uk typically arrives this way. Other governments have their own equivalents, so check the specific portal rather than assuming.

Non-commercial restrictions

Non-commercial (the NC in CC BY-NC) is the condition most likely to surprise you later. It bars use for commercial purposes, and “commercial” is broader than charging money directly. Running the data inside a product that earns revenue, or using it to promote a paying business, can count.

A research demo, an internal tool, or a personal project is usually safe. The moment you point it at customers, non-commercial data becomes a liability. If you are building something you hope to sell, filter these sources out early.

Next steps

Sorting licences comes down to two habits. First, ask your two questions: can you use it commercially, and does it push conditions onto your own work? Second, read the actual licence on the source, because summaries like this one cannot capture every clause.

You can browse real datasets and their licences in the directory, where every entry lists its licence up front, and look up any unfamiliar term in the glossary. When the stakes are high, treat this guide as a map, not the territory, and get proper legal advice.

← Back to all guides