faxenoff commited on
Commit
bf558de
Β·
verified Β·
1 Parent(s): f85b609

replace with the locally built v1: 3 added/updated, 2 superseded removed

Browse files
README.md CHANGED
@@ -8,18 +8,18 @@ tags:
8
  - documentation
9
  - summarization
10
  - distillation
11
- - qwen3
12
  - gguf
13
  - llama.cpp
14
  pipeline_tag: text-generation
15
- base_model: Qwen/Qwen3-4B
16
  library_name: gguf
17
  ---
18
 
19
  # code-daemon-summary-v1
20
 
21
- Compact **bilingual (English / Russian) code-documentation generator** β€” a 4B GGUF model that
22
- writes:
23
 
24
  - **one-sentence entity descriptions** for a source file (functions, classes, fields) as a
25
  clean markdown bullet list;
@@ -27,32 +27,42 @@ writes:
27
  - **hierarchical codebase summaries** β€” subsystem, product-level and whole-project digests
28
  built from smaller summaries.
29
 
30
- Runs anywhere llama.cpp runs. Available quants: `Q5_K_M` (~2.8 GB, highest fidelity),
31
- `Q4_K_M` (~2.4 GB, recommended), `Q3_K_M` (~2.0 GB, for 6 GB-VRAM GPUs). The output
32
- language follows the request β€” both languages were distilled first-class, not translated.
33
 
34
- **`Q3_K_M` is built with an importance matrix**, quantized directly from F16 rather than
35
- re-quantized from a higher width. Measured against a plain direct Q3 on a held-out
36
- slice of this model's own task distribution, that recovers roughly **a third of the
37
- quantization loss at identical file size** β€” worth taking if 6 GB of VRAM is your
38
- ceiling.
39
 
40
- `Q4_K_M` and `Q5_K_M` are deliberately built **without** one: at those bit widths the
41
- same comparison came out a coin flip, because Q4_K_M costs only ~1% perplexity to
42
- begin with. An importance matrix pays where quantization actually breaks weights.
43
 
44
- | Task | Output shape |
45
- |---|---|
46
- | Entity documentation | `- **Name**: one-sentence description.` per entity |
47
- | Module overview | `## Overview` prose + `## Architecture` / `## Flow` ASCII diagrams |
48
- | Hierarchical summaries | paragraph-length subsystem/product/strategy digests |
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  ## Quick start (llama.cpp)
51
 
52
- The bundled chat template already pins the model's **non-thinking mode** β€” use it as a normal
53
- ChatML model. If you build raw prompts yourself, end them with the assistant tag followed by an
54
- empty think block (`<|im_start|>assistant\n<think>\n\n</think>\n\n`) β€” that is the format the
55
- model was trained with. Greedy decoding (temperature 0) recommended; stop on `<|im_end|>`.
 
56
 
57
  ```bash
58
  llama-cli -m code-daemon-summary-v1-Q4_K_M.gguf -c 8192 --temp 0 \
@@ -68,55 +78,98 @@ Entities: parseArray, encodeValue. File excerpt: <...><|im_end|>
68
  '
69
  ```
70
 
71
- ## Evaluation
72
-
73
- Held-out prompts, provably never trained on, sampled across the full bilingual distribution;
74
- reference = the teacher's output on the same prompts.
75
 
76
- | Slice | n | ROUGE-L | sem-cos* | empty outputs |
77
- |---|---|---|---|---|
78
- | Entity docs, mixed EN+RU | 300 | 0.618 | **0.904** | 0 |
79
- | Entity docs, EN-only sample | 300 | 0.636 | 0.897 | 0 |
80
- | Hierarchical summaries | 7 | 0.331 | 0.893 | 0 |
81
 
82
- \* all-MiniLM-L6-v2 cosine between student and teacher outputs β€” the paraphrase-aware signal;
83
- token metrics understate free-form prose.
84
 
85
- **Language fidelity:** 56/57 Russian-reference examples answered in Russian, 242/243 English in
86
- English. Residual gap to the teacher: slightly more verbose (len-ratio ~1.3–1.6).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
  ## Speed
89
 
90
- Measured on a laptop RTX 5060 (8 GB), llama.cpp CUDA, Q4_K_M, `n_ctx=8192`, `n_batch=2048`,
91
- single stream β€” the way this model is actually used, since a hierarchical summary is one prompt
92
- rolling up its children and has nothing to batch against.
 
 
 
 
 
93
 
94
- | Workload | Input β†’ output | Rate |
95
- |---|---|---|
96
- | Hierarchical summary | 250 β†’ 250 tok | **103 tok/s** |
97
- | Long-form entity doc | 900 β†’ 1500 tok | **95 tok/s** |
98
- | Prefill (both) | β€” | **~3 300 tok/s** |
99
 
100
- **Memory:** ~4.7 GB resident at `n_ctx=8192` β€” 2.4 GB weights plus KV and compute buffers. On an
101
- 8 GB card that leaves room for one small co-resident model, not two; decode collapses to roughly a
102
- third of these rates if the card is oversubscribed, so give it the headroom rather than the extra
103
- worker.
 
 
 
104
 
105
  ## How it was made
106
 
107
- - **Base:** [`Qwen/Qwen3-4B`](https://huggingface.co/Qwen/Qwen3-4B) (Apache-2.0), 36 layers,
108
- ChatML, 151 936-token vocab.
109
- - **Teacher:** [`Qwen/Qwen2.5-7B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct).
110
- - **Method:** sequence-level knowledge distillation (SeqKD) from the teacher above, bilingual on
111
- the documentation tasks above, merged into the base. An on-policy refinement pass was also tried
112
- and **rejected on evaluation** β€” it degraded long-prompt behaviour β€” so v1 is the SeqKD
113
- checkpoint.
114
- - The model powers the long-output documentation stages of a code-intelligence daemon; it is a
115
- purpose-built component, not a general assistant β€” outside this task distribution its
116
- behaviour is undefined.
117
 
118
  ## License & attribution
119
 
120
- **Apache-2.0** β€” matches the Qwen3-4B base and the Qwen2.5-7B-Instruct teacher (both Alibaba /
121
- Qwen team, Apache-2.0). Not legal advice. Base and teacher Β© the Qwen team; please also honour
122
- their model cards.
 
8
  - documentation
9
  - summarization
10
  - distillation
11
+ - qwen3.5
12
  - gguf
13
  - llama.cpp
14
  pipeline_tag: text-generation
15
+ base_model: Qwen/Qwen3.5-4B
16
  library_name: gguf
17
  ---
18
 
19
  # code-daemon-summary-v1
20
 
21
+ Compact **bilingual (English / Russian) code-documentation generator** β€” a distilled
22
+ **Qwen3.5-4B** in GGUF that writes:
23
 
24
  - **one-sentence entity descriptions** for a source file (functions, classes, fields) as a
25
  clean markdown bullet list;
 
27
  - **hierarchical codebase summaries** β€” subsystem, product-level and whole-project digests
28
  built from smaller summaries.
29
 
30
+ It is the long-output worker of the UltraCode code-intelligence daemon: a purpose-built
31
+ component, not a general assistant. Outside this task distribution its behaviour is undefined.
32
+ The output language follows the request β€” both languages were distilled first-class.
33
 
34
+ > ### ⚠ The weights under this id changed on 2026-09-16
35
+ >
36
+ > Until then this repository served a **Qwen3-4B** distilled from Qwen2.5-7B-Instruct (Q3_K_M,
37
+ > Q4_K_M and Q5_K_M). Everything on this page was measured on the **Qwen3.5-4B** student; the
38
+ > previous card is in this repository's git history. **Do not mix figures across the two.**
39
 
40
+ ## Files
 
 
41
 
42
+ | file | size | use |
43
+ |---|--:|---|
44
+ | `code-daemon-summary-v1-Q4_K_M.gguf` | 2.58 GB | **recommended** |
45
+ | `code-daemon-summary-v1-Q3_K_M.gguf` | 2.16 GB | 6 GB-VRAM cards; quantized with a domain importance matrix |
46
+
47
+ Both need a llama.cpp build with the `qwen35` architecture (b10809 / v0.4.0 or newer).
48
+
49
+ ## Architecture β€” read this before sizing a deployment
50
+
51
+ - **Base:** [`Qwen/Qwen3.5-4B`](https://huggingface.co/Qwen/Qwen3.5-4B), ChatML, 248 320-token
52
+ vocabulary.
53
+ - **Hybrid attention:** 32 blocks, every fourth a full-attention block (8), the rest gated
54
+ DeltaNet (24). The linear blocks carry a **recurrent state per sequence** instead of a growing
55
+ KV cache β€” see *Memory*.
56
+ - **No multi-token-prediction block.** The base checkpoint has one; this export does not, so
57
+ there is no built-in speculative head.
58
 
59
  ## Quick start (llama.cpp)
60
 
61
+ The bundled chat template runs the model in **non-thinking mode** unless `enable_thinking` is
62
+ set β€” use it as a normal ChatML model. If you build raw prompts yourself, end them with the
63
+ assistant tag followed by an empty think block (`<|im_start|>assistant\n<think>\n\n</think>\n\n`);
64
+ that is the shape the model was trained on. Greedy decoding (temperature 0) is recommended; stop
65
+ on `<|im_end|>`.
66
 
67
  ```bash
68
  llama-cli -m code-daemon-summary-v1-Q4_K_M.gguf -c 8192 --temp 0 \
 
78
  '
79
  ```
80
 
81
+ Output formats:
 
 
 
82
 
83
+ - **Entity documentation** β€” `- **Name**: one-sentence description.`, one bullet per entity.
84
+ - **Module overview** β€” `## Overview` prose plus `## Architecture` / `## Flow` ASCII diagrams.
85
+ - **Hierarchical summaries** β€” paragraph-length subsystem / product / strategy digests.
 
 
86
 
87
+ ## Evaluation
 
88
 
89
+ **200 held-out documentation prompts**, never trained on. Reference: the teacher's answer to the
90
+ same prompt. Metrics: ROUGE-L and token F1 against that reference, greedy decoding, 512 new
91
+ tokens, every model scored **as the GGUF file** through llama.cpp's server, with the prompt sent
92
+ as the same token ids.
93
+
94
+ | model (GGUF) | size | ROUGE-L | token F1 | length ratio |
95
+ |---|--:|--:|--:|--:|
96
+ | **this model, Q4_K_M** | 2.58 GB | **0.548** | **0.628** | 0.93 |
97
+ | **this model, Q3_K_M** + importance matrix | 2.16 GB | **0.543** | **0.623** | 0.88 |
98
+ | the same Q3_K_M without the importance matrix | 2.16 GB | 0.530 | 0.612 | 0.88 |
99
+ | stock Qwen3.5-4B, same conversion, Q4_K_M | 2.58 GB | 0.464 | 0.555 | 0.93 |
100
+ | the Qwen3-4B this id served before | 2.38 GB | 0.414 | 0.479 | 0.69 |
101
+
102
+ Paired over the same 200 prompts (4 000 bootstrap resamples):
103
+
104
+ | comparison | ROUGE-L Ξ” | 95 % CI | wins / losses |
105
+ |---|--:|---|--:|
106
+ | **stock Qwen3.5-4B β†’ this model** | **+0.084** | [+0.066, +0.101] | 156 / 42 |
107
+ | this model: Q4_K_M β†’ Q3_K_M + importance matrix | βˆ’0.004 | [βˆ’0.020, +0.011] | 92 / 102 |
108
+ | Q3_K_M: plain β†’ with importance matrix | +0.013 | [+0.002, +0.026] | 110 / 83 |
109
+
110
+ - **The Q3 tier keeps the gain.** It is indistinguishable from the Q4_K_M here, and the
111
+ importance matrix earns its place at that width.
112
+ - **The previous row is not a verdict on the previous model.** The references come from the new
113
+ teacher; the Qwen3-4B was distilled from a smaller one and writes shorter answers in its style
114
+ (length ratio 0.69), which this ruler penalises β€” even the untouched Qwen3.5-4B scores above it.
115
+ - **The gain shrinks with prompt length** and stays positive: +0.117 ROUGE-L for prompts under 512
116
+ tokens (57 prompts), +0.104 at 512–1 024 (50), +0.056 at 1 024–2 048 (72), +0.041 above 2 048
117
+ (21).
118
+
119
+ ### Inside a real index
120
+
121
+ All three models in the same llama.cpp slot of the UltraCode daemon, each writing a **first**
122
+ documentation pass over the same 18 directories of a Go repository, everything else unchanged:
123
+
124
+ | | this model | stock Qwen3.5-4B | the previous Qwen3-4B |
125
+ |---|--:|--:|--:|
126
+ | sections missing after the output guards | 2 | 0 | 14 |
127
+ | duplicate entity descriptions | **0.4 %** | 0.3 % | 4.8 % |
128
+ | bullets that only restate the entity name | **1.7 %** | 2.3 % | 3.5 % |
129
+ | description words, median | 14 | 14 | 8 |
130
+ | diagram lines repeating an earlier line | **26 %** | 42 % | 39 % |
131
+ | tokens generated | 168 427 | 161 166 | 124 408 |
132
+ | decode, 1 slot / 4 slots | 86 / 154 tok/s | 85 / 153 tok/s | β€” |
133
+
134
+ Against its base the student is **tidier, not longer**: its diagrams loop less and its bullets
135
+ restate names less at the same description length β€” but it dropped two sections the stock model
136
+ kept. One repository, one run per model: a direction, not a verdict. (The previous model's speed
137
+ is omitted: another workload shared the GPU during its run.)
138
 
139
  ## Speed
140
 
141
+ Laptop RTX 5060 (8 GB), llama.cpp CUDA, one server slot, `n_ctx=4096`, median decode over answers
142
+ of 16+ tokens: **88.6 tok/s** for the Q4_K_M, **77.0 tok/s** for the Q3_K_M. Inside the daemon,
143
+ sharing the GPU with its embedding and classification workers: **86 tok/s** single-stream and
144
+ **154 tok/s** across four concurrent slots.
145
+
146
+ ## Memory
147
+
148
+ Measured through llama.cpp's server with **one logits row per sequence**:
149
 
150
+ | file | sequences | dedicated VRAM |
151
+ |---|--:|--:|
152
+ | Q4_K_M | 28 | **4 710 MiB** |
153
+ | Q3_K_M | 28 | 4 284 MiB |
154
+ | Q3_K_M | 12 | **3 408 MiB** |
155
 
156
+ - **The recurrent state costs 50.25 MiB per sequence** (1 407 MiB at 28) whatever the context
157
+ length. It scales with the number of parallel sequences, not with `n_ctx` β€” cut sequences,
158
+ not context, to fit a small card.
159
+ - **If you embed llama.cpp yourself, set `n_outputs_max`.** Its default reserves logits for a
160
+ whole `n_batch`: with a 248 320-token vocabulary that is ~1.9 GB at `n_batch=2048`, allocated
161
+ and never used by a generator that reads one logits row per sequence. llama-server sets it to
162
+ its slot count; a library caller gets the default. The same model measured 6 341 MiB that way.
163
 
164
  ## How it was made
165
 
166
+ - **Base:** [`Qwen/Qwen3.5-4B`](https://huggingface.co/Qwen/Qwen3.5-4B) (Apache-2.0).
167
+ - **Teacher:** `Qwen3.8-27B`.
168
+ - **Method:** sequence-level knowledge distillation (SeqKD) on the bilingual documentation tasks
169
+ above; the adapter was merged into the base in full precision and converted to GGUF.
 
 
 
 
 
 
170
 
171
  ## License & attribution
172
 
173
+ **Apache-2.0**, matching the [`Qwen/Qwen3.5-4B`](https://huggingface.co/Qwen/Qwen3.5-4B) base.
174
+ Not legal advice β€” check the base and teacher model cards before redistributing. Base and teacher
175
+ Β© the Qwen team; please also honour their cards.
code-daemon-summary-v1-Q3_K_M.gguf CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c71b764c563deb25a8a2e99c88246c6099a078b9069f1b4fb314672b3ee11ffe
3
- size 2075617920
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dc19ace856f72b24b6d1daad2c02733d5589f050a5b58504accc890200420b54
3
+ size 2262063680
code-daemon-summary-v1-Q4_K_M.gguf CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:45985958352406a48da4a739c35af343581e720f892dbb23378f1cb2d7a9ee6c
3
- size 2497280384
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1b61e53d733409c7b9987c9ac619f0ef4737773c3a31ad8a1eb4908d5d6c0fa
3
+ size 2708803968
code-daemon-summary-v1-Q5_K_M.gguf DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d0e281062bf9b7559c7f61fe06c096adb3e42f3517b0112111b94e9d18a68a2d
3
- size 2889513344
 
 
 
 
manifest.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "model_id": "code-daemon-summary-v1",
3
- "dimension": 0,
4
- "max_tokens": 4096,
5
- "quantization": "int8",
6
- "targets": [
7
- "openvino"
8
- ],
9
- "runtime_tags": {
10
- "trt": "trt11.0",
11
- "ov": "ov2026.3",
12
- "tvm": "tvm0.25",
13
- "mlx_dir": "model_gpu_mlx0.22"
14
- },
15
- "compiled_at": "2026-08-04T19:13:23Z",
16
- "compiled_by": "models/_compile"
17
- }