File size: 3,580 Bytes
0cbd275
618c7d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0cbd275
618c7d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98011c4
618c7d0
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
language:
- en
license: apache-2.0
task_categories:
- text-classification
tags:
- license-detection
- fossology
- nirjas
- binary-classification
- code
- legal
pretty_name: Nirjas Gate Dataset
size_categories:
- 10K<n<100K
---

# Nirjas Gate Dataset

Binary classification dataset for the **Nirjas gate** — a recall-first classifier that answers:
*"Is this text actual license text worth routing to Atarashi for identification?"*

This is a narrow gate, not a broad "license-related" detector. Its job is to route actual license
bodies (MIT text, GPL headers, Apache notices) to Atarashi while correctly rejecting license
references ("see LICENSE file"), copyright notices, code comments, and package metadata.

## Dataset Summary

| split | total | license_related | not_license_related |
|---|---|---|---|
| train | 55,610 | 30,232 | 25,378 |
| validation | 6,877 | 3,707 | 3,170 |
| test | 6,895 | 3,770 | 3,125 |

Splits are **content-hash frozen** — each text always lands in the same split regardless of
dataset rebuilds, so benchmark deltas are real and duplicates cannot leak across train/test.

## Dataset Structure

### Columns

- `text` — the text fragment (license body, code comment, legal notice, etc.)
- `label` — `0 = license_related`, `1 = not_license_related` (ClassLabel)
- `source` — origin: `scancode`, `fossology`, `generated`, `synthetic`, `shortform`, `augmented`, `code_corpus`
- `negative_type` — for negatives: `generic_code_comment`, `same_register_notice`, `license_discussion`, `copyright_discussion`, `todo_fixme`, `commented_code`

### Label Convention

| label | int | meaning |
|---|---|---|
| `license_related` | 0 | actual license text — route to Atarashi |
| `not_license_related` | 1 | everything else — discard |

### Positive sources (train)

| source | count |
|---|---|
| scancode (ScanCode LicenseDB) | 18,931 |
| shortform (SPDX identifiers + snippets) | 4,820 |
| synthetic/rare (LLM-augmented) | 4,262 |
| fossology (licenseRef.json) | 1,681 |
| augmented | 538 |

### Negative types (train)

| type | count | description |
|---|---|---|
| `generic_code_comment` | 6,324 | real source comments from the-stack-smol |
| `same_register_notice` | 5,177 | boilerplate legal-register non-licenses |
| `todo_fixme` | 4,264 | TODO/FIXME/HACK comments |
| `license_discussion` | 4,232 | commentary about licenses, not license text |
| `copyright_discussion` | 2,769 | copyright attribution, not license grants |
| `commented_code` | 2,612 | commented-out source code |

## Usage

```python
from datasets import load_dataset

ds = load_dataset("rycerzes/nirjas-dataset")
train = ds["train"]
```

## Deployed Gate

The deployed model is `potion-base-32M` (`StaticModelForClassification`) at threshold **0.20**
(recall-first, NOT argmax). At this threshold:

| metric | synthetic test set | real corpus (the-stack-smol + ScanCode, n=600) |
|---|---|---|
| License recall | 0.9952 | 1.0000 |
| FPR | 0.0227 | 0.0133 |

## Generation Pipeline

Built by [`minerva-dataset-pipeline`](https://github.com/fossology/Minerva-Dataset-Generation/pull/6):

1. Fetch license texts from ScanCode LicenseDB + FOSSology licenseRef.json
2. Sliding-window split with junk-fragment filtering
3. LLM-assisted augmentation for rare licenses
4. Hard negative generation (LLM + template-based)
5. Content-hash frozen train/val/test split
6. Class balancing

## Downstream Task

Part of the [FOSSology Nirjas](https://github.com/fossology/Nirjas) ML pipeline:

```
source file → Nirjas gate → [license_related] → Atarashi (which license?)
```