clemsail commited on
Commit
6b87d85
Β·
verified Β·
1 Parent(s): 922c910

Re-license to CC-BY-SA-4.0: training data share-alike inherits

Browse files
Files changed (1) hide show
  1. README.md +35 -72
README.md CHANGED
@@ -1,6 +1,7 @@
1
  ---
2
- license: gemma
3
  base_model: lmstudio-community/gemma-4-E4B-it-MLX-4bit
 
4
  tags:
5
  - mlx
6
  - lora
@@ -10,113 +11,75 @@ tags:
10
  - kicad
11
  - spice
12
  - ailiance
13
- - negative-result
 
14
  language:
15
  - en
16
  - fr
17
  pipeline_tag: text-generation
18
  ---
19
 
20
- # Ailiance β€” gemma-4-E4B kicad9plus LoRA
21
 
22
- > ⚠️ **NEGATIVE RESULT β€” PUBLISHED FOR TRANSPARENCY**
23
- >
24
- > This LoRA exhibits **catastrophic forgetting on SPICE tasks** (-15.7 pts composite vs base)
25
- > and **complete loss of schematic extraction capability** (P3 = 0.000, -30.8 pts vs base).
26
- > Published as a research artifact to document the failure mode, not for production use.
27
- >
28
- > **Hypothesis**: 98 training samples on `kicad9plus-permissive` + rank=8 / scale=20.0 default
29
- > were insufficient for grammar-style learning, and the high `scale=20.0` over-amplified the
30
- > small rank-8 deltas onto the base model, breaking unrelated capabilities.
31
- >
32
- > **Future iterations may revisit** with rank=32, lower scale, and a larger corpus
33
- > (e.g. `Ailiance-fr/kicad9plus-copyleft` adds 209 GPL samples for 307 total).
34
 
35
- LoRA adapter fine-tuned on `lmstudio-community/gemma-4-E4B-it-MLX-4bit` for KiCad 9+ schematic-file (`.kicad_sch`) generation. **Did not converge to useful behaviour.**
36
 
37
- > Maintained by **Ailiance** β€” French AI org building EU AI Act compliant resources for embedded systems and electronics design.
38
-
39
- ## Quick start (for reproduction)
40
 
41
  ```python
42
  from mlx_lm import load, generate
43
 
44
  model, tokenizer = load(
45
  "lmstudio-community/gemma-4-E4B-it-MLX-4bit",
46
- adapter_path="Ailiance-fr/gemma-4-E4B-kicad9plus-lora"
47
  )
48
- # Expect degraded behaviour on SPICE & extraction tasks.
49
- ```
50
-
51
- ## Training
52
 
53
- - **Base model**: `lmstudio-community/gemma-4-E4B-it-MLX-4bit`
54
- - **Training data**: [`Ailiance-fr/kicad9plus-permissive`](https://huggingface.co/datasets/Ailiance-fr/kicad9plus-permissive) β€” 98 KiCad 9+ schematic samples under permissive licenses (CC-BY-SA-4.0)
55
- - **Method**: LoRA (PEFT) via `mlx-lm`
56
- - **Iterations**: 1200
57
- - **Rank**: 8 *(low β€” suspected root cause)*
58
- - **Scale**: 20.0 *(high β€” suspected root cause)*
59
- - **Dropout**: 0.0
60
- - **Learning rate**: 1e-5
61
- - **Max seq length**: 4096
62
- - **Layers**: 16 (partial β€” not all)
63
- - **Curriculum**: none β€” single dataset, single pass.
64
-
65
- The `rank=8 / scale=20.0` combination is the `mlx-lm` lora default and was kept unchanged for this experiment. With only 98 samples, rank 8 likely undersampled the schematic grammar's complexity while the high scale propagated noisy deltas into unrelated capability channels β€” hence the broken SPICE + extraction scores.
66
-
67
- ## Benchmark results
68
 
69
- Composite scores from `electron-bench` (see [compare_base_vs_lora.md](https://github.com/ailiance/ailiance-bench/blob/main/bench-results/compare_base_vs_lora.md)). Reference base = `gemma-4-E4B-it-MLX-4bit`.
70
 
71
- | Phase | Dataset | base | this LoRA | Lift |
72
- |------:|--------------------|------:|----------:|-----------:|
73
- | P1 | kicad-dsl | 0.090 | 0.090 | +0.0pts |
74
- | P1 | kicad-pcb | 0.010 | 0.015 | +0.5pts |
75
- | P1 | spice-sim | 0.425 | 0.268 | **-15.7pts** |
76
- | P2 | kicad-sch-gen | 0.420 | 0.180 | **-24.0pts** |
77
- | P3 | kicad-sch-extract | 0.308 | 0.000 | **-30.8pts** |
78
- | P4 | kicad-erc-abs | 0.060 | 0.033 | -2.7pts |
79
- | P5 | kicad-erc-delta | 0.060 | 0.033 | -2.7pts |
80
 
81
- **Verdict**: clear catastrophic forgetting. P3 collapses to zero (the model can no longer produce parseable extraction output), and the *very task this LoRA was trained for* β€” `kicad-sch-gen` (P2) β€” actually got **worse** (-24 pts). Published openly so the community can learn from the failure mode rather than rediscover it.
 
 
 
 
82
 
83
- ## What we learned
84
 
85
- - 98 samples is below the practical floor for grammar-style learning on this base model.
86
- - `rank=8 + scale=20.0` is a dangerous default for narrow corpora; the high scale acts like a learning-rate multiplier and corrupts capabilities outside the training distribution.
87
- - Future runs should use `rank=32, scale=2.0` (same as `eukiki` / `mascarade`) plus a larger corpus.
88
 
89
  ## EU AI Act compliance
90
 
91
- - **Article 53(1)(c) copyright policy**: training data licenses preserved (CC-BY-SA-4.0 from upstream `Ailiance-fr/kicad9plus-permissive`).
92
- - **Article 53(1)(d) training data summary**:
93
- - Publicly available datasets: `Ailiance-fr/kicad9plus-permissive` (98 samples, CC-BY-SA-4.0).
94
- - Web scraping: No.
95
- - Licensed data: None.
96
- - **GPAI Code of Practice (July 2025)**: base model Gemma (Google = signatory).
97
- - **Provenance**: per-sample `metadata.license_spdx` preserved in upstream dataset.
98
 
99
  ## License
100
 
101
- - LoRA adapter weights: released under **Gemma Terms of Use** (inheritance from base model).
102
- - See https://ai.google.dev/gemma/terms
103
 
104
  ## Citation
105
 
106
  ```bibtex
107
- @misc{ailiance_gemma4_e4b_kicad9plus_lora_2026,
108
  author = {Ailiance},
109
- title = {Ailiance β€” gemma-4-E4B kicad9plus LoRA (negative result)},
110
  year = {2026},
111
  publisher = {Hugging Face},
112
- url = {https://huggingface.co/Ailiance-fr/gemma-4-E4B-kicad9plus-lora},
113
- note = {Published for transparency; catastrophic forgetting on SPICE and P3 extraction.}
114
  }
115
  ```
116
 
117
- ## Related models
118
 
119
- - [Ailiance-fr/gemma-4-E4B-eukiki-lora](https://huggingface.co/Ailiance-fr/gemma-4-E4B-eukiki-lora) β€” champion general
120
- - [Ailiance-fr/gemma-4-E4B-mascarade-lora](https://huggingface.co/Ailiance-fr/gemma-4-E4B-mascarade-lora) β€” champion schematic extraction
121
- - [Ailiance-fr/gemma-4-E4B-aggro-test-lora](https://huggingface.co/Ailiance-fr/gemma-4-E4B-aggro-test-lora) β€” sanity-check baseline
122
- - [Ailiance-fr/gemma-4-E4B-kicad9plus-lora](https://huggingface.co/Ailiance-fr/gemma-4-E4B-kicad9plus-lora) β€” negative result (this model, published for transparency)
 
1
  ---
2
+ license: cc-by-sa-4.0
3
  base_model: lmstudio-community/gemma-4-E4B-it-MLX-4bit
4
+ library_name: peft
5
  tags:
6
  - mlx
7
  - lora
 
11
  - kicad
12
  - spice
13
  - ailiance
14
+ - gemma
15
+ - kicad9plus
16
  language:
17
  - en
18
  - fr
19
  pipeline_tag: text-generation
20
  ---
21
 
22
+ # Ailiance β€” Gemma 4 E4B kicad9plus LoRA
23
 
24
+ LoRA adapter fine-tuned on `lmstudio-community/gemma-4-E4B-it-MLX-4bit` for the **kicad9plus** domain (electronics, embedded, KiCad, SPICE).
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ > Maintained by **Ailiance** β€” French AI org publishing EU AI Act aligned LoRA adapters and datasets.
27
 
28
+ ## Quick start (MLX)
 
 
29
 
30
  ```python
31
  from mlx_lm import load, generate
32
 
33
  model, tokenizer = load(
34
  "lmstudio-community/gemma-4-E4B-it-MLX-4bit",
35
+ adapter_path="Ailiance-fr/gemma-4-E4B-kicad9plus-lora",
36
  )
 
 
 
 
37
 
38
+ print(generate(model, tokenizer, prompt="..."))
39
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
+ ## License chain
42
 
43
+ | Component | License |
44
+ |-----------------------------------------------|-------------------------------|
45
+ | Base model weights (`lmstudio-community/gemma-4-E4B-it-MLX-4bit`) | Gemma Terms of Use |
46
+ | Training data ([`Ailiance-fr/kicad9plus-permissive`](https://huggingface.co/datasets/Ailiance-fr/kicad9plus-permissive)) | cc-by-sa-4.0 |
47
+ | **LoRA adapter (this repo)** | **CC-BY-SA-4.0** |
 
 
 
 
48
 
49
+ **Rationale**: weights of the base model inherit from the Gemma Terms of Use, but
50
+ the **LoRA adapter is a derivative of CC-BY-SA-4.0 training data** and is therefore
51
+ released under CC-BY-SA-4.0 (share-alike propagates). Downstream users who load
52
+ this adapter against the Gemma base must comply with **both** licenses
53
+ simultaneously.
54
 
55
+ ## Training data lineage
56
 
57
+ Primary corpus: [`Ailiance-fr/kicad9plus-permissive`](https://huggingface.co/datasets/Ailiance-fr/kicad9plus-permissive) (cc-by-sa-4.0).
58
+ See the [Ailiance-fr catalog](https://huggingface.co/Ailiance-fr) for related cards.
 
59
 
60
  ## EU AI Act compliance
61
 
62
+ - **Article 53(1)(c)**: training data licenses preserved upstream.
63
+ - **Article 53(1)(d)**: training data summary β€” see dataset cards on Ailiance-fr.
64
+ - **GPAI Code of Practice (July 2025)**: base model Gemma (Google is a signatory).
65
+ - **No web scraping by Ailiance**, **no licensed data**, **no PII**.
 
 
 
66
 
67
  ## License
68
 
69
+ LoRA weights: **CC-BY-SA-4.0** (training-data share-alike). Base model weights remain under Gemma Terms of Use.
 
70
 
71
  ## Citation
72
 
73
  ```bibtex
74
+ @misc{ailiance_gemma_4_E4B_kicad9plus_lora_2026,
75
  author = {Ailiance},
76
+ title = {Ailiance β€” Gemma 4 E4B kicad9plus LoRA},
77
  year = {2026},
78
  publisher = {Hugging Face},
79
+ url = {https://huggingface.co/Ailiance-fr/gemma-4-E4B-kicad9plus-lora}
 
80
  }
81
  ```
82
 
83
+ ## Related
84
 
85
+ See the full [Ailiance-fr LoRA collection](https://huggingface.co/Ailiance-fr).