Text Generation
PEFT
MLX
English
French
lora
electronics
embedded
kicad
spice
ailiance
gemma
kicad9plus
Instructions to use Ailiance-fr/gemma-4-E4B-kicad9plus-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Ailiance-fr/gemma-4-E4B-kicad9plus-lora with PEFT:
Task type is invalid.
- MLX
How to use Ailiance-fr/gemma-4-E4B-kicad9plus-lora with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("Ailiance-fr/gemma-4-E4B-kicad9plus-lora") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use Ailiance-fr/gemma-4-E4B-kicad9plus-lora with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "Ailiance-fr/gemma-4-E4B-kicad9plus-lora" --prompt "Once upon a time"
- Atomic Chat
Add model card (negative result)
Browse files
README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
base_model: lmstudio-community/gemma-4-E4B-it-MLX-4bit
|
| 4 |
+
tags:
|
| 5 |
+
- mlx
|
| 6 |
+
- lora
|
| 7 |
+
- peft
|
| 8 |
+
- electronics
|
| 9 |
+
- embedded
|
| 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)
|