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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3.8-27B
|
| 4 |
+
base_model_relation: finetune
|
| 5 |
+
tags: [genexus, code-generation, qwen3]
|
| 6 |
+
language: [es, en]
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
---
|
| 9 |
+
# KBBridge-v3 (bf16)
|
| 10 |
+
|
| 11 |
+
A fine-tune of [`Qwen/Qwen3.8-27B`](https://huggingface.co/Qwen/Qwen3.8-27B) specialised in
|
| 12 |
+
**GeneXus** programming, in the native `.gxSource` export format.
|
| 13 |
+
|
| 14 |
+
Frontier models do not know this format. Without the GeneXus documentation injected into the
|
| 15 |
+
prompt they produce syntactically invalid output almost every time (parse rate 0.5β3.1%).
|
| 16 |
+
KBBridge writes it natively, runs on your own hardware, and never sends your Knowledge Base
|
| 17 |
+
code to an external API.
|
| 18 |
+
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## β οΈ Read this before your first prompt
|
| 22 |
+
|
| 23 |
+
Two settings, or the model will look broken. Both are measured, not stylistic.
|
| 24 |
+
|
| 25 |
+
### 1. Turn reasoning OFF
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
vllm serve KBBridge/KBBridge-v3 --served-model-name kbbridge-v3 \
|
| 29 |
+
--max-model-len 262144 --reasoning-parser qwen3
|
| 30 |
+
|
| 31 |
+
# and per request:
|
| 32 |
+
# "chat_template_kwargs": {"enable_thinking": false}
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
The Qwen chat template enables a `<think>` block by default. If that block does not close
|
| 36 |
+
within your token budget, the answer comes back **empty or half-finished** β the client sees
|
| 37 |
+
"the model did not respond". Measured on this GGUF: with reasoning on, 300 tokens were not
|
| 38 |
+
enough to even begin the object; with it off, the same prompt returned a complete, valid
|
| 39 |
+
`Procedure`.
|
| 40 |
+
|
| 41 |
+
With vLLM, pass `chat_template_kwargs: {enable_thinking: false}` on every request, or set
|
| 42 |
+
it as a server default.
|
| 43 |
+
|
| 44 |
+
### 2. Ask for the format explicitly
|
| 45 |
+
|
| 46 |
+
Write **"in `.gxSource` format"** in your prompt.
|
| 47 |
+
|
| 48 |
+
Measured on v3: the bare request *"a Procedure that adds two numbers"* returns generic **SQL**.
|
| 49 |
+
Naming the format returns the GeneXus object, consistently. If you use a harness with its own
|
| 50 |
+
system prompt, put the instruction there once.
|
| 51 |
+
|
| 52 |
+
### 3. Give it enough room
|
| 53 |
+
|
| 54 |
+
`max_tokens` β₯ 4096. A `.gxSource` object consumes roughly **340 tokens per KB** of source, and
|
| 55 |
+
most tools default to 512β1024, which truncates the object mid-body.
|
| 56 |
+
|
| 57 |
+
---
|
| 58 |
+
|
| 59 |
+
## Results
|
| 60 |
+
|
| 61 |
+
580 held-out items (191 codegen + 329 MCQ + 60 data-model) that no model saw during training.
|
| 62 |
+
Syntax validated with the official GeneXus ANTLR parser. Same protocol for every model:
|
| 63 |
+
temperature 0.1, reasoning off, concurrency 8.
|
| 64 |
+
|
| 65 |
+
### v3 vs v2 β an honest comparison
|
| 66 |
+
|
| 67 |
+
**v3 is not a clean win over v2.** It gains domain knowledge and loses syntax accuracy:
|
| 68 |
+
|
| 69 |
+
| Metric | v2 | **v3** | |
|
| 70 |
+
|---|---|---|---|
|
| 71 |
+
| parseRate (valid syntax) | **89.0** | 84.8 | β4.2 |
|
| 72 |
+
| parmMatch (exact signature) | 78.6 | 78.6 | = |
|
| 73 |
+
| MCQ (GeneXus knowledge) | 76.0 | **79.0** | +3.0 |
|
| 74 |
+
| methodValidity | 90.0 | **91.1** | +1.1 |
|
| 75 |
+
|
| 76 |
+
**What these numbers do NOT establish.** v3 changed three things at once β the base model
|
| 77 |
+
(Qwen3.6 β 3.8), the corpus (4Γ larger, per-KB cap removed) and the teacher (v1 β v2). The
|
| 78 |
+
parseRate drop **cannot be attributed** to any one of them without a control arm that was never
|
| 79 |
+
run. Anyone reading this table as "the bigger corpus hurt syntax" is over-reading it.
|
| 80 |
+
|
| 81 |
+
Choose v3 if domain knowledge matters more to you; v2 still leads on raw syntax validity.
|
| 82 |
+
|
| 83 |
+
### Generalisation to unseen Knowledge Bases
|
| 84 |
+
|
| 85 |
+
Three entire KBs were held out β different domains, never in the pipeline:
|
| 86 |
+
|
| 87 |
+
| | held-out from training KBs | 3 completely new KBs |
|
| 88 |
+
|---|---|---|
|
| 89 |
+
| v2 | 89.0 | 89.9 |
|
| 90 |
+
| **v3** | 84.8 | **87.4** |
|
| 91 |
+
|
| 92 |
+
v3's *relative* gap to unseen KBs is larger than v2's (+2.6 vs +0.9), i.e. it generalises
|
| 93 |
+
better in relative terms, even though two KBs make up 54.7% of its corpus.
|
| 94 |
+
|
| 95 |
+
### Fairness note on the frontier comparison
|
| 96 |
+
|
| 97 |
+
In our benchmark the frontier models were run **with** ~21,600 tokens of GeneXus documentation
|
| 98 |
+
injected into every request; KBBridge was run **without** any. That is not a handicap we
|
| 99 |
+
imposed β injecting the same documentation into KBBridge makes it *worse* (76.4 β 73.3
|
| 100 |
+
parseRate), because the fine-tune already internalised that knowledge and the extra context
|
| 101 |
+
gets in the way. Still, the setups differ, and you should know that when reading any
|
| 102 |
+
head-to-head number.
|
| 103 |
+
|
| 104 |
+
### Quantised builds
|
| 105 |
+
|
| 106 |
+
We measured the 4-bit build against this one on the same 580 items. **Excluding items where
|
| 107 |
+
either run hit the token ceiling, the two are indistinguishable** (parseRate 93.0 vs 93.6 over
|
| 108 |
+
171 items) β 4-bit costs essentially nothing in output quality here. Details and the full
|
| 109 |
+
comparison are in the
|
| 110 |
+
[GGUF repo's card](https://huggingface.co/KBBridge/KBBridge-v3-GGUF).
|
| 111 |
+
|
| 112 |
+
---
|
| 113 |
+
|
| 114 |
+
## Files
|
| 115 |
+
|
| 116 |
+
Full-precision merged weights, bf16, **51 GB** across 19 shards. This is the master artefact:
|
| 117 |
+
use it to re-quantise, to continue training, or to serve with transformers.
|
| 118 |
+
|
| 119 |
+
```python
|
| 120 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 121 |
+
m = AutoModelForCausalLM.from_pretrained("KBBridge/KBBridge-v3", dtype="bfloat16", device_map="auto")
|
| 122 |
+
t = AutoTokenizer.from_pretrained("KBBridge/KBBridge-v3")
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
For serving, prefer [`KBBridge/KBBridge-v3-FP8`](https://huggingface.co/KBBridge/KBBridge-v3-FP8)
|
| 126 |
+
(29 GB, same quality in our tests) or the
|
| 127 |
+
[GGUF builds](https://huggingface.co/KBBridge/KBBridge-v3-GGUF) for llama.cpp / LM Studio.
|
| 128 |
+
|
| 129 |
+
### What is inside
|
| 130 |
+
|
| 131 |
+
1,199 tensors: the 64-layer hybrid text model (48 Gated DeltaNet + 16 full-attention layers),
|
| 132 |
+
the base model's **vision tower** (333 tensors, carried over unchanged β the fine-tune did not
|
| 133 |
+
touch it) and its **multi-token-prediction head** (15 tensors, likewise unchanged). Context
|
| 134 |
+
262,144 tokens, the base model's native `max_position_embeddings`.
|
| 135 |
+
|
| 136 |
+
## Intended use
|
| 137 |
+
|
| 138 |
+
Assisting GeneXus developers: generating objects (Procedures, Transactions, Data Providers,
|
| 139 |
+
SDTs, WebPanels), explaining existing code, completion, and documentation questions.
|
| 140 |
+
|
| 141 |
+
**Out of scope:** not a general-purpose model, not a replacement for validating in the GeneXus
|
| 142 |
+
IDE, and it does not know any particular Knowledge Base (see *Limitations*).
|
| 143 |
+
|
| 144 |
+
---
|
| 145 |
+
|
| 146 |
+
## Limitations
|
| 147 |
+
|
| 148 |
+
- **It does not know your KB.** It learned the style and syntax of the format, not the contents
|
| 149 |
+
of any specific base. Ask it about a transaction you did not paste in, and it will **invent
|
| 150 |
+
plausible attribute names and present them as fact**. Always give it the context and validate
|
| 151 |
+
the output in the IDE.
|
| 152 |
+
- **Runaway generation on very large objects.** For objects over ~10 KB the model can fall into
|
| 153 |
+
degenerate repetition β the same line hundreds of times without closing the object. Measured
|
| 154 |
+
on v2 at ~1.6% of benchmark items; **not re-measured on v3**. Raising `max_tokens` does not
|
| 155 |
+
fix it. Generate large objects section by section.
|
| 156 |
+
- **Spanish bias** in explanations, reflecting the corpus.
|
| 157 |
+
- **Specialised**: worse than the base model at general tasks.
|
| 158 |
+
- The limitations above other than the first were measured on **v2** and are carried over as
|
| 159 |
+
working assumptions, not verified properties of v3.
|
| 160 |
+
|
| 161 |
+
### If you also use a hosted KBBridge endpoint
|
| 162 |
+
|
| 163 |
+
The raw GGUF and a gateway-fronted deployment **do not behave the same by default**. Our
|
| 164 |
+
gateway applies four corrections the plain model does not have: a `max_tokens` floor, reasoning
|
| 165 |
+
disabled, a `reasoning_content` fallback when `content` comes back empty, and
|
| 166 |
+
`repetition_penalty` 1.05 to suppress runaway. If you compare "what I tried on your server"
|
| 167 |
+
against "what I downloaded", the difference is those four settings, not the weights.
|
| 168 |
+
|
| 169 |
+
---
|
| 170 |
+
|
| 171 |
+
## Training
|
| 172 |
+
|
| 173 |
+
| | |
|
| 174 |
+
|---|---|
|
| 175 |
+
| Method | QLoRA 4-bit (bitsandbytes) + Liger kernel |
|
| 176 |
+
| LoRA | r=64, Ξ±=128, dropout=0.05, all projections |
|
| 177 |
+
| Context | 12,288 tokens |
|
| 178 |
+
| Effective batch | 16 (1 Γ 16 grad accum) |
|
| 179 |
+
| LR | 1.0e-4, cosine, 3% warmup |
|
| 180 |
+
| Epochs | 2 complete (14,108 steps) |
|
| 181 |
+
| Hardware | 1Γ RTX PRO 6000 Blackwell 96 GB |
|
| 182 |
+
| Duration | 7 days 4:41 |
|
| 183 |
+
| Framework | LLaMA-Factory, transformers 5.6.0 |
|
| 184 |
+
|
| 185 |
+
train_loss **0.2618** (v2: 0.3344) Β· eval_loss **0.3723** (v2: 0.4675), minimum at the **last**
|
| 186 |
+
step β no overfitting across 71 evaluations, which suggests there was room for more epochs.
|
| 187 |
+
|
| 188 |
+
Note that these losses are much better than v2's and yet parseRate went *down*: `eval_loss`
|
| 189 |
+
measures fit to the corpus, not GeneXus quality.
|
| 190 |
+
|
| 191 |
+
### Data
|
| 192 |
+
|
| 193 |
+
80,344 examples derived from GeneXus objects across 25 real Knowledge Bases (GX16/17/17U8/18/
|
| 194 |
+
Evo1, multi-domain) β 129% more than v2, with the per-KB cap removed. Sanitised, deduplicated
|
| 195 |
+
and split by deterministic hash. **The datasets are not published**: they contain customer
|
| 196 |
+
proprietary code.
|
| 197 |
+
|
| 198 |
+
---
|
| 199 |
+
|
| 200 |
+
## Training-data privacy
|
| 201 |
+
|
| 202 |
+
The model was trained on real customer Knowledge Bases, so we audited whether it can leak them.
|
| 203 |
+
This is the strongest result of the project.
|
| 204 |
+
|
| 205 |
+
### Canaries: no memorisation threshold found
|
| 206 |
+
|
| 207 |
+
12 synthetic objects containing unguessable 16-character secrets were inserted at four
|
| 208 |
+
frequencies, and verified to have reached `train.jsonl` at exactly those counts:
|
| 209 |
+
|
| 210 |
+
| repetitions | canaries | recovered by name | recovered with literal prefix |
|
| 211 |
+
|---|---|---|---|
|
| 212 |
+
| 1 | 3 | 0/3 | 0/3 |
|
| 213 |
+
| 10 | 3 | 0/3 | 0/3 |
|
| 214 |
+
| 100 | 3 | 0/3 | 0/3 |
|
| 215 |
+
| **1000** | 3 | **0/3** | **0/3** |
|
| 216 |
+
|
| 217 |
+
**Not even at a thousand identical repetitions.** A control rules out a broken probe: asked for
|
| 218 |
+
the canary, the model returns a structurally valid but **empty** object β no token, no secret.
|
| 219 |
+
And it does generate real bodies when the request has content, so the empty skeleton is not an
|
| 220 |
+
inability to generate.
|
| 221 |
+
|
| 222 |
+
### Membership inference: marginal signal
|
| 223 |
+
|
| 224 |
+
| | |
|
| 225 |
+
|---|---|
|
| 226 |
+
| mean loss, seen examples | 3.4130 |
|
| 227 |
+
| mean loss, unseen | 3.7711 |
|
| 228 |
+
| mean length | 3,133 vs 3,117 chars β comparable, so the AUC is meaningful |
|
| 229 |
+
| **AUC** | **0.5539** |
|
| 230 |
+
|
| 231 |
+
0.554 against 0.50 for indistinguishable. There is a statistical trace of having seen the data,
|
| 232 |
+
but the distributions overlap almost entirely.
|
| 233 |
+
|
| 234 |
+
**Conclusion: customer code is not recoverable from the weights.**
|
| 235 |
+
|
| 236 |
+
**Caveat, stated plainly:** absence of evidence is not proof of absence. These audits cover the
|
| 237 |
+
attacks we ran, not every attack that exists.
|
| 238 |
+
|
| 239 |
+
---
|
| 240 |
+
|
| 241 |
+
## Reproducibility
|
| 242 |
+
|
| 243 |
+
Full external reproduction is **not possible**, and it is worth saying so directly:
|
| 244 |
+
|
| 245 |
+
1. The 25 Knowledge Bases are customer code and are not distributed.
|
| 246 |
+
2. The `parseRate` scorer uses the KBEditor's ANTLR parser β proprietary, not distributable.
|
| 247 |
+
3. The teacher that generated v3's data is KBBridge-v2, which is not published.
|
| 248 |
+
|
| 249 |
+
What a third party *can* verify: the raw benchmark outputs (one model response per item) and
|
| 250 |
+
the scoring over them.
|
| 251 |
+
|
| 252 |
+
---
|
| 253 |
+
|
| 254 |
+
## Citation
|
| 255 |
+
|
| 256 |
+
```bibtex
|
| 257 |
+
@misc{kbbridge-v3,
|
| 258 |
+
title = {KBBridge-v3: a GeneXus code assistant fine-tuned from Qwen3.8-27B},
|
| 259 |
+
author = {Nardone, Angelo},
|
| 260 |
+
year = {2026},
|
| 261 |
+
url = {https://huggingface.co/KBBridge/KBBridge-v3}
|
| 262 |
+
}
|
| 263 |
+
```
|
| 264 |
+
|
| 265 |
+
## License
|
| 266 |
+
|
| 267 |
+
Apache 2.0, inherited from the base model `Qwen/Qwen3.8-27B`. This is a modified derivative
|
| 268 |
+
work; see `NOTICE`.
|