pointbreaklab commited on
Commit
7125df4
·
verified ·
1 Parent(s): 11f791b

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +74 -23
README.md CHANGED
@@ -15,6 +15,10 @@ language:
15
  pipeline_tag: text-generation
16
  ---
17
 
 
 
 
 
18
  # Knot AI - Commit Message Model
19
 
20
  **A task-specific model that reads a code diff and writes the commit message.**
@@ -46,7 +50,8 @@ model - feed it a diff, get a message. That focus is the point: a small, private
46
 
47
  - **Method:** QLoRA (4-bit), completion-only supervised fine-tuning (loss on the
48
  commit message only), 2 epochs, ~6h on a single **NVIDIA RTX 3060 (12 GB)**.
49
- - **Data:** 3,227 examples mined from real histories of permissively-licensed OSS - **JavaScript/TypeScript** (vite, vitest, nx, pnpm, rollup, angular, changesets,
 
50
  husky, vitepress), **Python** (poetry, pydantic), **Rust** (starship, tauri),
51
  and **Go** (goreleaser). Type-balanced (fix 27% / feat 19% / refactor 11% /
52
  chore 8% / …).
@@ -54,21 +59,65 @@ model - feed it a diff, get a message. That focus is the point: a small, private
54
 
55
  ## Benchmark
56
 
57
- Evaluated on a held-out **gold set of 60 hand-reviewed cases** the model never saw,
58
- scored through the shipping GGUF path. "v3" is the prior release (trained on
59
- JavaScript/TypeScript only); "Knot AI" is this model, trained with added
60
- Python/Rust/Go diversity.
61
-
62
- | Metric | v3 (prior, JS/TS-only) | **Knot AI** |
63
- |---|---|---|
64
- | Type accuracy | 36.7% | **56.7%** |
65
- | Title word-overlap | 17.1% | **31.1%** |
66
- | Exact full message | 0% | **8.3%** |
67
- | Generation errors | 6 | **0** |
68
-
69
- **Cross-language generalization:** on a separate held-out set of **60 Python/Rust/Go
70
- commits** (languages this version added), Knot AI holds **56.7% type accuracy** - matching its JS/TS score, evidence the diversity generalized rather than
71
- memorized.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
  > Note: these are *single-reference* metrics - they compare to one human label,
74
  > though a commit has many valid messages and a change can honestly be `fix` *or*
@@ -84,6 +133,11 @@ memorized.
84
 
85
  ## Usage
86
 
 
 
 
 
 
87
  ### llama.cpp (base + this LoRA)
88
  ```sh
89
  llama-server --model qwen2.5-coder-7b-instruct-q4_k_m.gguf \
@@ -101,21 +155,18 @@ model = AutoModelForCausalLM.from_pretrained(base, device_map="auto")
101
  model = PeftModel.from_pretrained(model, "pointbreaklab/knot-ai")
102
  ```
103
 
104
- ### Ollama
105
- Coming with the Ollama release: `ollama run pointbreaklab/knot-ai`
106
-
107
  ## Limitations
108
 
109
- - Pattern completion over ~3k examples - it will miss on unusual diffs, and ~57%
110
- type accuracy means it is wrong sometimes.
111
  - Binary-only changes (images, PDFs) have no textual diff to read.
112
  - English commit conventions; not a general assistant.
113
 
114
  ## Roadmap
115
 
116
  This is **v1** (built on Knot AI's v4 adapter). A **v5** is planned - a larger,
117
- higher-quality corpus for better accuracy and closer matching. Knot AI improves
118
- in the open.
119
 
120
  ## Citation / attribution
121
 
 
15
  pipeline_tag: text-generation
16
  ---
17
 
18
+ <p align="center">
19
+ <img src="knot-logo.png" width="110" alt="Knot AI">
20
+ </p>
21
+
22
  # Knot AI - Commit Message Model
23
 
24
  **A task-specific model that reads a code diff and writes the commit message.**
 
50
 
51
  - **Method:** QLoRA (4-bit), completion-only supervised fine-tuning (loss on the
52
  commit message only), 2 epochs, ~6h on a single **NVIDIA RTX 3060 (12 GB)**.
53
+ - **Data:** 3,227 examples mined from real histories of permissively-licensed OSS -
54
+ **JavaScript/TypeScript** (vite, vitest, nx, pnpm, rollup, angular, changesets,
55
  husky, vitepress), **Python** (poetry, pydantic), **Rust** (starship, tauri),
56
  and **Go** (goreleaser). Type-balanced (fix 27% / feat 19% / refactor 11% /
57
  chore 8% / …).
 
59
 
60
  ## Benchmark
61
 
62
+ Two held-out **gold sets of 60 hand-reviewed commits each** (the model never saw
63
+ them), scored through the shipping GGUF path. Three models compared under one
64
+ identical harness:
65
+
66
+ - **Base Qwen** - Qwen2.5-Coder-7B, same prompt, no fine-tuning
67
+ - **Knot AI v3** - the prior release (trained on JS/TS only)
68
+ - **Knot AI (v4)** - this model (added Python / Rust / Go)
69
+
70
+ ![Commit-message quality vs baselines](bench-overall.png)
71
+
72
+ ### Full metrics (60 JS/TS gold)
73
+
74
+ | Metric | Base Qwen | Knot AI v3 | **Knot AI (v4)** |
75
+ |---|---|---|---|
76
+ | Type accuracy | 0.0% | 40.0% | **55.0%** |
77
+ | Title word-overlap | 0.4% | 18.3% | **30.3%** |
78
+ | Exact title | 0.0% | 0.0% | **6.7%** |
79
+ | Exact full message | 0.0% | 0.0% | **6.7%** |
80
+ | Scope accuracy | 0.0% | 70.0% | **75.0%** |
81
+ | Unparseable replies / 60 | 59 | 4 | **0** |
82
+
83
+ The base model is not "bad at commits" - zero-shot with the same prompt it
84
+ returns unstructured prose **59 times out of 60**, so it can't be wired into an
85
+ automated pipeline at all. Fine-tuning's first job is to make the reply reliably
86
+ parseable (59 → 4 → **0** errors); its second is to pick the right type.
87
+
88
+ ### By commit type - type accuracy (60 JS/TS gold)
89
+
90
+ | Type | n | Base | v3 | **Knot AI (v4)** |
91
+ |---|---|---|---|---|
92
+ | chore | 6 | 0% | 83% | **100%** |
93
+ | ci | 6 | 0% | 67% | **100%** |
94
+ | feat | 6 | 0% | 33% | **83%** |
95
+ | fix | 6 | 0% | 67% | **83%** |
96
+ | test | 5 | 0% | 80% | **80%** |
97
+ | docs | 6 | 0% | 83% | **67%** |
98
+ | perf | 6 | 0% | 0% | **50%** |
99
+ | build | 5 | 0% | 0% | **0%** |
100
+ | refactor | 6 | 0% | 0% | **0%** |
101
+ | style | 6 | 0% | 0% | **0%** |
102
+ | revert | 2 | 0% | 0% | **0%** |
103
+
104
+ Honest read: strong on the high-signal types (chore, ci, feat, fix, test); still
105
+ developing on the inherently ambiguous ones - refactor vs feat, build vs chore,
106
+ style, revert - which is exactly what v5 targets.
107
+
108
+ ### Generalization across languages - type accuracy (60 Rust / Go / Python gold)
109
+
110
+ ![Generalization across languages](bench-language.png)
111
+
112
+ | Language | n | Base | v3 | **Knot AI (v4)** |
113
+ |---|---|---|---|---|
114
+ | Rust | 20 | 0% | 10% | **55%** |
115
+ | Go | 20 | 0% | 55% | **45%** |
116
+ | Python | 20 | 0% | 55% | **60%** |
117
+
118
+ The added multilingual training pays off: Knot AI holds **~53% type accuracy**
119
+ overall on this separate Rust/Go/Python set - close to its 55% JS/TS score - and
120
+ lifts Rust from 10% → 55%, where the base model still scores 0% (unparseable).
121
 
122
  > Note: these are *single-reference* metrics - they compare to one human label,
123
  > though a commit has many valid messages and a change can honestly be `fix` *or*
 
133
 
134
  ## Usage
135
 
136
+ ### Ollama
137
+ ```sh
138
+ ollama run pointbreaklab/knot-ai "$(git diff --staged)"
139
+ ```
140
+
141
  ### llama.cpp (base + this LoRA)
142
  ```sh
143
  llama-server --model qwen2.5-coder-7b-instruct-q4_k_m.gguf \
 
155
  model = PeftModel.from_pretrained(model, "pointbreaklab/knot-ai")
156
  ```
157
 
 
 
 
158
  ## Limitations
159
 
160
+ - Pattern completion over ~3k examples - it will miss on unusual diffs, and ~55%
161
+ type accuracy means it is wrong sometimes (see the weaker types above).
162
  - Binary-only changes (images, PDFs) have no textual diff to read.
163
  - English commit conventions; not a general assistant.
164
 
165
  ## Roadmap
166
 
167
  This is **v1** (built on Knot AI's v4 adapter). A **v5** is planned - a larger,
168
+ higher-quality corpus for better accuracy and closer matching, with a focus on
169
+ the ambiguous types (refactor / build / style / revert). Knot AI improves in the open.
170
 
171
  ## Citation / attribution
172