> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scanoss.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Provenance

> How Earnie identifies the AI models in a repository or added from the Models page, what it records about each one, how AI-usage findings differ, and how to write policies against both.

**AI provenance** is Earnie's third domain, alongside open source and cryptography. It finds the AI models your project ships and the AI services, SDKs, and dataset-loading libraries your code uses. It's available where your organisation has AI provenance enabled.

When it's enabled, every scan runs it unless you turn it off: clear **AI provenance** under **Scanners** on the **New scan** page, or leave `ai` out of `--scanners` in the [Earnie CLI](https://docs.scanoss.com/en/latest/earnie/using-earnie/earnie-cli.md#choosing-scanners).

## Two Kinds of AI Finding

The AI provenance scanner produces two kinds of finding, and you decide each kind with its own decisions:

| Kind | What it is | Decisions |
| - | - | - |
| **Model finding** | An AI model file in your repository, or one added from the project's **Models** page, with what's known about its licence, lineage, and declared training datasets. | **Approve model**, **Reject model**, **Wrong identification** |
| **AI-usage finding** | Code or a manifest that uses AI: an AI SDK, AI dependency, agent, tool, embedding model, vector store, or dataset loader. | **Confirm AI usage**, **Not AI usage**, **Approve AI usage** |

A model finding always needs a decision. An AI-usage finding is **inventory** until a policy flags it: it stays visible in Review, but it isn't counted as work. See [AI model findings](https://docs.scanoss.com/en/latest/earnie/using-earnie/triaging-findings.md#ai-model-findings) and [Inventory](https://docs.scanoss.com/en/latest/earnie/using-earnie/triaging-findings.md#inventory-findings-that-need-no-decision) in Triaging findings.

Most of this page is about model findings.

## Identifying a Model File

The scanner treats these files as model weights, instead of skipping them as binaries: `.safetensors`, `.gguf`, `.bin`, `.pt`, `.pth`, `.pkl`, `.onnx`, `.tflite`, `.mlmodel`, `.h5`, `.keras`, and `.pb`.

For each one, Earnie matches the file against the SCANOSS model knowledge base. A model finding shows:

* the **Candidate component**, a purl that identifies the model
* **Matched by**, how Earnie matched it, from **Exact file hash** down to **File name only**
* **Confidence**, shown as **High**, **Medium**, or **Low**, never as a raw score
* **Related candidates**, the known models the match couldn't fully separate it from, when there are any
* what the knowledge base records about the model: its **Model license**, its **Lineage** (the base models it was derived from), its **Datasets** (the training datasets the model's authors declare on its model card, which Earnie records but doesn't verify), and its **Model card**

### Model Status

Every model file produces a finding, even when Earnie can't identify it. Its status says what happened:

| Status | Meaning |
| - | - |
| **Identified** | Earnie matched the file against the model knowledge base. |
| **Not identified** | Matching ran but found nothing. |
| **Declared, not verified** | The knowledge base knows the model's Hugging Face repository, such as one you added **From Hugging Face** on the Models page, but Earnie couldn't prove that the files are that model's. For example, the file hashes didn't match, or the repository is gated and hides its hashes. |
| **Matching unavailable** | Matching couldn't run this time, because there's no SCANOSS API key, the key was refused, the matching quota is used up, or the service couldn't be reached. |
| **Too large to fingerprint** | The file is over the model size cap. See [Uploading a Model](#uploading-a-model). |
| **Git LFS pointer** | The repository keeps this model in Git LFS, and Earnie has only the pointer, with no weights. See [Git LFS Models](#git-lfs-models). |

When the matching service doesn't answer, Earnie can still guess the model from its file name. The status is then **Identified**, but **Matched by** reads **File name only**, there's no confidence band, and the finding says the identification is a guess from the file name alone. The **Require review of unidentified AI models** template catches these guesses too. See [Starter Templates](#starter-templates).

> [!NOTE]
>
> A model that Earnie couldn't match doesn't fail the scan, and Earnie counts it as scanned, not
> skipped. Coverage stays full, and the file still appears as a finding.

## The Models Page

A project's **Models** page lists every model file the project knows about: the files Earnie found in repository scans and source archives, plus the models you added by upload or from Hugging Face. Under the title, a line reads **From** the scan the list reflects, the newest completed scan that ran AI provenance, with its commit and when it finished. **Export** opens the export menu on the AIBOM preset. See [In the SBOM](#in-the-sbom).

Above the table, two panels count the same models:

* **Identified models** says how many are identified, for example "7 of 13", and lists under it the other states that have a model, such as **Low confidence**, **Not identified**, and **Failed**, each with its count.
* **License category** splits the models into **Permissive**, **Copyleft**, **Use restricted**, **Non-commercial**, **Proprietary**, and **Unknown license** (a model with no licence on record). Only identified models have a licence category, so the panel says how many models it covers, and it's left out when none has one.

The identified count, each state, and each part of the split is a link that opens the table filtered to it, keeping the other filters you've set, and the one in force is marked. A model whose files are in more than one state, or that's identified with low confidence, counts in each of them; a model with files in two licence categories counts in each.

Each row shows the model file, how Earnie identified it, its **Source** (**Repository**, **Source archive**, **Model upload**, or **Hugging Face**), and its **Decision**. Search by file name, path, candidate, or licence, and filter by decision, source, identification, or licence category. The filters offer only values that some model carries. The filters and the open model are kept in the page address, so a link shares exactly what you see.

Select a model to open it beside the table, or in a panel on the right on a narrower screen. It shows how the model was identified, the match, the evidence, the file, its policy results, and its activity.

You don't decide model findings on this page. The model's decision appears as read-only text marked **Made in Review**, and **Decide in Review** opens the finding in the Review workspace, where you approve, reject, or reopen it. The only action on the list is **Delete**, for uploaded models. To delete several at once, select their rows and choose **Delete**. Repository and source archive files have no checkbox, because their repository or archive owns them.

While uploads are running or paused, a line above the filters says so, for example "1 upload in progress · 2 paused". **Details** opens the **Uploads** panel with their progress and the paused uploads.

When there's nothing to list, the page says why: **No completed scan yet**, **No models in this project**, or, if your organisation doesn't have AI provenance, "This organization does not run AI model detection." If the filters match nothing, the page shows **Nothing matches these filters** and offers **Clear filters**.

## Uploading a Model

Some models your organisation uses don't live in a scanned repository. You can add one from a project's **Models** page. Select **Add model**, then choose the source:

* **Upload a file.** Upload one model file, or a Hugging Face snapshot as a `.tar`, `.tar.gz`, or `.tgz` archive, so you don't have to upload each file of a model by hand. If your connection drops or the page closes, choose the same file again and Earnie **resumes** the upload from where it stopped.
* **From Hugging Face.** Identify a model from its Hugging Face repository, without uploading anything.

To upload from a script or a pipeline instead, use `earnie model scan <file>`. It resumes an interrupted upload the same way and waits for the result. See [Scanning an AI Model](https://docs.scanoss.com/en/latest/earnie/using-earnie/earnie-cli.md#scanning-an-ai-model) in the Earnie CLI.

The upload limit is the model size cap, which is **3 GB** unless your Earnie deployment sets another. Earnie checks the size before the upload starts, and refuses a larger file with a note that fingerprinting larger models where they live isn't available yet.

Each uploaded model gets its own scan. Earnie identifies the model, looks up its licence and lineage, and evaluates the project's model policies against it. You triage the finding like any other, and an identified model goes into the SBOM. The model appears on the Models page, linked to the scan that identified it. To delete it later, open it and choose **Delete upload**, or select its row and choose **Delete**.

> [!NOTE]
>
> **Earnie doesn't keep the weights.** It deletes an uploaded file once its scan ends, whatever
> the outcome. It keeps the file's SHA-256 hash, so it can recognise the same file if you upload
> it again.

When you delete a model from the Models page, Earnie removes the model and any weights still stored. Its findings are marked resolved and keep their triage, so uploading the same file again reopens them.

## Git LFS Models

A repository that keeps its models in Git LFS commits only pointers. By default, an AI provenance scan reports each one as **Git LFS pointer** and can't fingerprint it.

To fetch the models instead, an Operator or Admin turns on **Fetch Git LFS models** in the **AI provenance** section of the project's [Scan Configuration](https://docs.scanoss.com/en/latest/earnie/using-earnie/scan-configuration.md). After that, a repository scan that runs AI provenance downloads each model a pointer refers to, up to the model size cap, and identifies it like a committed file. To decide for one scan only, use **Download Git LFS models** on the **New scan** page.

Fetching works only on scans of a Git repository. If a model fails to fetch, Earnie leaves it as a pointer and the scan continues.

> [!NOTE]
>
> **Off by default.** Fetching an LFS object counts against the repository owner's Git LFS
> bandwidth quota, so Earnie fetches only for projects that opt in.

## Writing Policies Against AI Findings

Every finding carries an **AI Provenance** field group, `finding.ai`. Its **AI Finding Kind** field, `finding.ai.kind`, tells a model finding (`model`) from an AI-usage finding (`usage`). On a finding that a field doesn't apply to, such as an open-source match, the field is empty, so a rule that reads it evaluates to false instead of raising an error.

These are the model fields most policies need:

| Field | CEL path | Meaning |
| - | - | - |
| **AI Model Status** | `finding.ai.model_status` | `identified`, `unidentified`, `declared`, `matching_unavailable`, `too_large`, or `lfs_pointer`. |
| **AI Model License** | `finding.ai.model_license` | The licence the knowledge base records for the model. |
| **AI Model License Category** | `finding.ai.model_license_category` | `permissive`, `copyleft`, `use_restricted`, `non_commercial`, `proprietary`, or `unknown`. |
| **AI Model Publisher** | `finding.ai.model_publisher` | The organisation that published the model. **AI Model Lineage Publishers** lists the publishers of the models it was derived from. |
| **AI Model File Format** | `finding.ai.model_format` | `safetensors`, `gguf`, `onnx`, `pickle`, `keras`, `tflite`, or `other`. `.pt`, `.pth`, `.bin`, and `.pkl` files are `pickle`. |
| **AI Model Transform** | `finding.ai.model_transform_kind` | `fine_tuned`, `quantized`, `merged`, `distilled`, or `adapter`. **AI Model Is Adapter** (`finding.ai.model_is_adapter`) is true for an adapter. |
| **AI Model Match Method** and **AI Model Confidence Band** | `finding.ai.match_method`, `finding.ai.confidence_band` | How Earnie made the match, and how confident it is: `high`, `medium`, or `low`. |

An AI-usage finding has its own fields instead, such as **AI Detection Type** (`finding.ai.detection_type`), **AI Vendor** (`finding.ai.vendor`), **AI SDK** (`finding.ai.sdk`), and **AI Provider** (`finding.ai.provider`). They identify what the code uses and who provides it.

A dataset finding (**AI Detection Type** `dataset`) means Python code loads data with Hugging Face `datasets`, PyTorch, or TensorFlow. **Dataset Source** (`finding.ai.dataset_source`) names that library as `huggingface`, `pytorch`, or `tensorflow`. The finding doesn't name the dataset the code loads.

The Sentence builder offers no negation on AI fields, because "AI SDK is not openai" would also match every finding that isn't an AI usage. **AI Vendor** is the exception. It also offers **is not** and **is not one of**, so you can keep a list of approved vendors. Put a negated vendor condition next to **AI Finding Kind is usage** and **AI Vendor is not empty**, as the **Enforce approved AI vendors** template does. Without them, the rule also matches every finding that names no vendor.

> [!NOTE]
>
> An AI policy needs the AI provenance scanner to have run. If a scan skipped it, Earnie reports
> the policy as **Not evaluated**, never as a pass.

### Starter Templates

Earnie has seven built-in AI templates. Add them from the template picker on a project's **Policies** page, like any other template. See [Starting from templates](https://docs.scanoss.com/en/latest/earnie/using-earnie/setting-policies.md#starting-from-templates).

| Template | Action | Evaluates | Matches by default |
| - | - | - | - |
| **Require review of unidentified AI models** | Require approval | Model findings | Any status except Identified, or a model matched by file name only |
| **Block non-commercial AI model licenses** | Block | Model findings | Non-commercial licences |
| **Require review of restricted or unknown AI model licenses** | Require approval | Model findings | Use-restricted or unknown licences |
| **Block model formats that run code on load** | Block | Model findings | Pickle-based formats |
| **Require review of models from restricted publishers** | Require approval | Model findings | A list of publishers you set, checked against the model's lineage. It starts empty. |
| **Warn on derived AI models** | Warn | Model findings | Fine-tuned, adapter, merged, or distilled models |
| **Enforce approved AI vendors** | Require approval | AI-usage findings | Any vendor not on an allowlist you set. The list starts empty, so the first evaluation flags every vendor in use. |

The **CRA — Annex I Part II(1)** regulatory template set adds the unidentified-model and restricted-licence templates in one action. It works the same way as the [cryptography regulatory template sets](https://docs.scanoss.com/en/latest/earnie/using-earnie/setting-policies.md#regulatory-template-sets). See [Setting policies](https://docs.scanoss.com/en/latest/earnie/using-earnie/setting-policies.md) for how templates, the rule builder, and template sets work in general.

## In the SBOM

Earnie exports each identified model as a CycloneDX `machine-learning-model` component, with its purl, SHA-256 hash, licence, lineage (as pedigree ancestors), and model card. Models that aren't identified aren't exported. SPDX can't describe AI models, so they appear only in the CycloneDX document.

To include models, choose **AIBOM** in the New export sheet, or turn on **AI models** under **Customize contents**. See [Exporting SBOMs](https://docs.scanoss.com/en/latest/earnie/evidence/exporting-sboms.md#making-a-new-export).

## Reporting on AI Provenance

Two views summarise what the AI provenance scanner found:

* **For one project**, the Dashboard's **AI provenance** tab has five panels: **AI usage**, **Models**, **AI vendors**, **Model licenses**, and **AI trend**. See [The AI provenance tab](https://docs.scanoss.com/en/latest/earnie/using-earnie/dashboard.md#the-ai-provenance-tab).
* **Across every project**, the **Exposure** section on All projects has an **AI usages to review** panel with the open AI usages across the scope over the period. See [Exposure](https://docs.scanoss.com/en/latest/earnie/using-earnie/all-projects.md#exposure).

If the scanner has never run, both views say **Not scanned**, never zero. If it ran and found nothing, they say **Clean**.

## AI Findings on Pull Requests

Earnie reports AI provenance findings at **Info** severity. On a pull request, inline comments start at **Medium** severity by default, so Earnie doesn't post inline comments for AI findings that no policy flagged. A finding that a policy flagged still gets a comment. See [Inline comments on the changed lines](https://docs.scanoss.com/en/latest/earnie/using-earnie/merge-gate.md#inline-comments-on-the-changed-lines).

## What's Next

You triage, review, and gate an AI finding the same way as an open-source or cryptography finding. See [Triaging findings](https://docs.scanoss.com/en/latest/earnie/using-earnie/triaging-findings.md) for what happens after Earnie finds one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.