Repository navigation
gliclass-v4: Knowledgator's GLiClass v4 2B and 9B (Qwen3.5 decoder-KV) as the new family gliclass-kv (COB-564) - #150
Merged
Merged
Conversation
…b, -9b) as a new family gliclass-kv: reference, layout port, export with the recurrent scorer and calibrator in the graph, goldens, export parity, Rust rows, engine and parity example (COB-564) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176yK678pQMu7HqGmfCnDAd
… (COB-564) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176yK678pQMu7HqGmfCnDAd
…y doc and library page (COB-564) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176yK678pQMu7HqGmfCnDAd
…(CUDA and CPU) and the 9b numbers in the docs (COB-564) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176yK678pQMu7HqGmfCnDAd
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176yK678pQMu7HqGmfCnDAd
…section's <<SEP>> ends (COB-564) The row builder gave the context at least one token however long the labels were, so a request with a 50k-token noul instruction or 255 long choices produced a row past the 8,192 window and the graph's section axis. It is now TooManyOptions when the label section is >= max_len, as the uni-encoder family does; the goldens' longest section is 1,917 tokens, so no golden changes. The builder also checks that the section starts and ends with special_tokens.sep instead of assuming it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176yK678pQMu7HqGmfCnDAd
cobanov
force-pushed
the
cob-564-gliclass-v4
branch
from
October 25, 2026 10:44
f368e97 to
ebe194d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Knowledgator's GLiClass v4 (COB-564, item 2) as a new family
gliclass-kvwith the catalog modelgliclass-v4:gliclass-v4:2b(knowledgator/gliclass-v4-2bon Qwen3.5-2B,latest) andgliclass-v4:9b(knowledgator/gliclass-v4-9bon Qwen3.5-9B). Text only. No release from this PR.Why a new family
GLiClass v4 is the decoder-KV architecture (
gliclass0.1.21): a Qwen3.5 decoder readsprompt + state <<SEP>> label₁<<LABEL>> … <<SEP>>in one causal row; the label section's hidden states go through a two-layer bidirectional DeBERTa scorer (text at the final<<SEP>>, labels at their<<LABEL>>s, an MLP per pair), a gated recurrent cell re-runs the scorer for up to three steps and freezes a row once no label's sigmoid probability moves by 0.01, and a learned calibrator rescales every logit (beta · z + bias, beta from the representations and six logit statistics). Nothing of the uni-encodergliclass(DeBERTa, contract M) carries over but Ollaya's question mapping, and the catalog's family is per model, so it is its own entry. The card says the checkpoint ships without the calibrator; the config saysuse_calibrator: trueand the weights are in the checkpoint, so the port follows the code.What is in the PR
convert/ollaya_convert/families/gliclass_kv/:ref.py(thegliclasspackage in fp32; the question mapping is the uni-encoder family's),layout.py(the port: context cut to the window minus the label section, the label section tokenized as one string),export.py(the Qwen3.5 trunk fromllm_common/qwen35.py, upstream's scorer, the recurrence with its halting astorch.where, and the calibrator, all in one graph; every weight referenced in the repo'smodel.safetensors),goldens.py,parity.py.ollaya_decision::gliclass_kv(rows, with tests; reusesgliclass::CallandMode),ollaya_runner::gliclass_kv(the engine: six inputs, calibrated label logits out),examples/parity_gliclass_kv.rs,engine.rsregistration.parity_runmaps the family's hyphen to the example's underscore.docs/families/gliclass-kv.md,site/content/library/gliclass-v4.md, the overlay, a README row.Contract:
input_ids[rows, seq] (a multiple of 64),section_pos/section_mask[rows, len] (the label section),label_pos/label_mask[rows, k] (indices within the section),sep_pos[rows] →logits[rows, k] (calibrated) andsteps[rows].calibration.jsonis the identity. Window 8,192 tokens (the card's usage; the pipeline's default is 1,024).weights_in_memoryisbf16.Gate (K2 for the 2B, K2 with the CPU goldens for the 9B), choso-wsl
The eager graph matches upstream's fp32 model to 9.5e-6 (2B) / 2.0e-6 (9B) on the calibrated logits, with identical halting steps.
Export parity, 2B (
families/gliclass_kv/parity.py, ONNX Runtime CPU vs PyTorch fp32 on the RTX 4090; 127 requests, 633 questions): rows, markers, sections and halting steps identical, 100 % argmax agreement vs fp32 and vs the public pipeline (161 questions, probabilities within 1.0e-7); logits ≤ 1.9e-4, probabilities ≤ 4.8e-5. Not run for the 9B: its fp32 reference (38 GB) and the ONNX session do not fit choso's RAM together; the goldens and the runtime gate below cover it.Runtime (
parity_gliclass_kvthroughparity_run; goldens of 97 requests, 483 questions, the 9B's reference on the CPU):The 2B's CUDA maximum is one noul row whose three recurrent steps compound the fp32 differences of the DeltaNet scan and the calibrator; the decisions are identical and the p99 is 1e-5. Records:
results/runs/2026-10-24-parity-rtx4090-{cuda,cpu}.json(the same files PR #149 adds its strands rows to; whichever merges second needs the file from that branch).cargo test --workspace, clippy and the convert tests pass.Registry
Manifests for
gliclass-v4:2b,:9bandlatestare in the PR. Blobs stay on the parity machine,choso-wsl:~/Developer/ollaya/registry/blobs:sha256-e6c756a8edb33105f48b4120b986ab323cb4fa0865f9b08cf799726813a6d33fsha256-cce70796f1a86a4c58f92bfa203e9b635d5f358754c3f8321ca6448b30a153e3sha256-422d5d5104c9b58861e5ee7d9d519dbb9508fd3225c6e6410494ad00a946ff3bsha256-adff5b1a27453e8af1c026fc3e78cf05f8a7554808fee8b4e4ea573841339389sha256-94fbb5a513de008bdd3a8c15fa7cc7c3545650fe94660a3f09f64a3215497ec5sha256-0d925cb28a846226a16b6fc3f20b5fc3d81f94b2f8d991d5a571c090a8207199sha256-c438ccbc300d85ce504df702cea73f2bb32088d6eda7250665add834fbc7f31bsha256-b4a305e27719318875f8c5998c494105e78fe54f2ea94503c607ca5071dd3e85model.safetensors, 4.73 GB and 17.97 GB).bench_plan(exit 0, nothing blocked) lists both tags as new with the full set,typed public latency-cuda latency-cpu, about 88 minutes each. Not run from this PR (the bench machine is in use).Not in scope
The vision path (images in the context), few-shot
examples, the streaming KV-cache pipeline (an exact-result speedup upstream).🤖 Generated with Claude Code
https://claude.ai/code/session_0176yK678pQMu7HqGmfCnDAd