Skip to page content
SAVRN
Search Plan a project

Open-weight model · Text classification

Qwen3.8-27B-Clef-LoRA-GGUF

by Trevest trevest/Qwen3.8-27B-Clef-LoRA-GGUF

Qwen3.8-27B-Clef-LoRA-GGUF is an open-weight model for text classification from Trevest, released under Apache License 2.0. Its published files total 1.6 GB. It draws 71 downloads a month.

One resident copy of Qwen3.8-27B serves two paths from a single llama.cpp server on a 24 GB GPU: - Decide -- Cloudflare Clef: typed questions over a state, a probability for every option of every question in one forward pass, Jev/SystemOne POST /v1/systemone.

Parameters—
Context—
Weights1.6 GB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads71

Model Card

By Trevest, published under apache-2.0, revision 3c26090b3247.

One resident copy of Qwen3.8-27B serves two paths from a single llama.cpp server on a 24 GB GPU: - Decide -- Cloudflare Clef: typed questions over a state, a probability for every option of every question in one forward pass, Jev/SystemOne POST /v1/systemone. - Write -- plain Qwen3.8-27B chat with MTP speculative decoding, POST /v1/chat/completions. The trick: Clef's backbone is Qwen3.8-27B plus a merged LoRA on layers 40-63 only (layers 0-39, embeddings, lmhead and the vision tower are byte-identical to the base). This repo holds that LoRA, recovered from the release, so it rides on the same weights you chat with. llama.cpp keeps it loaded at scale 0; a decision switches it to scale 1 for…

Read Trevest's full model card

Qwen3.8-27B + Cloudflare Clef on one GPU

One resident copy of Qwen3.8-27B serves two paths from a single llama.cpp server on a 24 GB GPU:

  • Decide -- Cloudflare Clef: typed questions over a state, a probability for every option of every question in one forward pass, Jev/SystemOne POST /v1/systemone.
  • Write -- plain Qwen3.8-27B chat with MTP speculative decoding, POST /v1/chat/completions.

The trick: Clef's backbone is Qwen3.8-27B plus a merged LoRA on layers 40-63 only (layers 0-39, embeddings, lm_head and the vision tower are byte-identical to the base). This repo holds that LoRA, recovered from the release, so it rides on the same weights you chat with. llama.cpp keeps it loaded at scale 0; a decision switches it to scale 1 for that request only.

Running both paths together on a 24 GB card is the point: Clef as its own model (including llama.cpp's native clef architecture) is a second ~15 GB model that does not fit beside a chat model.

Files

file what
clef-lora-f16.gguf llama.cpp LoRA adapter, 668M params, f16, per-tensor rank <= 320 (adapter.lora.alpha = 0, scale 1)
joint_head.safetensors, joint_head_config.json Clef's joint schema head, unchanged from Cloudflare/clef
tokenizer.json Clef's tokenizer, unchanged
llama.cpp-patch/0001-embeddings-lora-f16.patch the engine patch (below), against llama.cpp ad1de39e0
llama.cpp-patch/Dockerfile builds the patched llama-server (CUDA 13.0, sm_120)
clefhead/ the CPU sidecar: Clef's head + POST /v1/systemone (server.py, Cloudflare's joint_schema_model.py, Dockerfile)
examples/one_model_demo.mjs decide -> write -> verify pipeline that exercises both paths (Node 20+, no dependencies)

Base model GGUF: trevest/Qwen3.8-27B-Tetris-GGUF (4.41 bpw, 14.03 GiB). The LoRA follows the current convert_hf_to_gguf.py Gated-DeltaNet V-head layout; the Tetris file matches it (828/866 tensors byte-identical to a fresh convert, the rest are ssm_a at 1e-7 relative). Any GGUF converted from Qwen/Qwen3.8-27B revision 1d4bf0f2 with a current converter works.

How it works

client ──POST /v1/systemone──> clefhead (CPU) ──POST /embeddings {lora: [{id:0, scale:1}],
                                    │             encoding: f16_base64}──> llama-server ─┐
                                    │<── final hidden state of every prompt token ───────┤ one copy of
                                    └─ Clef joint head -> P(option) per question         │ Qwen3.8-27B
client ──POST /v1/chat/completions─────────────────────────────────────> llama-server ──┘ (LoRA scale 0,
                                                                                            MTP drafting)

Clef reads every prompt token's final (post-norm) hidden state, which llama-server --embeddings --pooling none exports. Stock llama.cpp needs a small patch for this setup:

  1. /embeddings takes a per-request lora (stock only parses it for completions), returns hidden states as one base64 f16 blob (encoding: "f16_base64") instead of a JSON float per value, and last_only.
  2. MTP next to --embeddings. The MTP draft context inherited embeddings mode (a pooling layer its graph cannot feed), the server capped outputs at one per sequence in embeddings mode (MTP verification needs 1 + n_draft), and the draft inherited the large ubatch with its compute buffer (OOM). The patch turns embeddings off for the draft, caps its ubatch at 512 and keeps the speculative output budget. Clef hidden states are bit-identical with and without MTP.

Run it

1. Build the patched server (CUDA shown; Metal below) (or use the prebuilt image ghcr.io/trevestforvor/llamacpp-glimmer:cf-ad1de39-p2, CUDA 13.0, sm_120 / Blackwell only):

git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
git checkout ad1de39e0708e3ced9c71bb3c82d93a2c046a73f
git apply /path/to/llama.cpp-patch/0001-embeddings-lora-f16.patch
cmake -B build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=120 && cmake --build build --target llama-server -j

2. Download the weights

hf download trevest/Qwen3.8-27B-Tetris-GGUF Qwen3.8-27B-Tetris-4.4bpw.gguf --local-dir models
hf download unsloth/Qwen3.8-27B-GGUF mmproj-F16.gguf --local-dir models          # optional, chat vision
hf download trevest/Qwen3.8-27B-Clef-LoRA-GGUF --local-dir clef

3. Start the engine (the exact flags measured below):

llama-server -m models/Qwen3.8-27B-Tetris-4.4bpw.gguf --mmproj models/mmproj-F16.gguf \
  --lora-scaled clef/clef-lora-f16.gguf:0 \
  --embeddings --pooling none -ub 4096 -b 4096 \
  -c 49152 -np 1 -ngl 999 --flash-attn on --cache-type-k q8_0 --cache-type-v q8_0 --jinja \
  --spec-type draft-mtp --spec-draft-n-max 3 --host 0.0.0.0 --port 8080

Use --lora-scaled <file>:0, not --lora-init-without-apply: the latter still applies scale 1 to requests that send no lora field, so plain chat would silently run through Clef's adapter. -ub must cover the longest decision prompt, because llama.cpp never splits an embeddings request.

4. Start the head

docker run --rm -p 8095:8095 -v $PWD:/data \
  -e ENGINE_URL=http://host.docker.internal:8080 -e HF_ROOT=/data -e SENTINEL=/data/clef/tokenizer.json \
  -e MODEL_FILE=Qwen3.8-27B-Tetris-4.4bpw.gguf -e MAX_TOKENS=4096 \
  ghcr.io/trevestforvor/llamacpp-glimmer:clefhead-1.0.1
# or: pip install torch numpy safetensors tokenizers gguf && python clefhead/server.py (same env vars)

HF_ROOT is searched recursively for tokenizer.json, the head files and the base GGUF (lm_head rows for option tokens are dequantized from it on demand). SENTINEL is any file that exists once the downloads are complete.

5. Use both paths

curl -s localhost:8095/v1/systemone -H 'Content-Type: application/json' -d '{
  "model": "clef", "state": "Our checkout started returning errors and orders are blocked.",
  "questions": {
    "team":    {"type": "choice", "instructions": "Who should handle it?",
                "criteria": {"billing": "Payments", "technical": "Bugs or outages"}},
    "urgency": {"type": "score", "criteria": ["Can wait", "This week", "Today"]},
    "outage":  {"type": "noul", "instructions": "Is a service down?"}}}'

curl -s localhost:8080/v1/chat/completions -H 'Content-Type: application/json' \
  -d '{"messages": [{"role": "user", "content": "Hello"}]}'

node examples/one_model_demo.mjs --decide http://127.0.0.1:8095 --chat http://127.0.0.1:8080

Measured (RTX 5090 Laptop GPU, 24 GB, CUDA 13.1 driver, 2026-10-02..04)

Fidelity - Hidden states, base BF16 + this LoRA vs Clef BF16: 0.6% median relative difference, cosine >= 0.9995. The ~3% per-tensor SVD residual is bf16 rounding of Clef's merged weights, not missing rank. - Answers, Tetris 4.4 bpw + LoRA through this stack vs Cloudflare's own BF16 pipeline: 16/16 argmax-equal, per-question max |dp| median 0.012, worst 0.087.

Quality (BTZSC classification, 500 per dataset; paired bootstrap, * = 95% CI excludes 0)

AG News Emotion Banking77 (77 options)
Clef (this setup) 91.6 50.4 89.6
TypeSafe Jev 1.13 88.2 53.0 82.8
Qwen3.8-27B, constrained-decoding decisions (no Clef) 86.2 49.2 77.6
Clef vs Jev +3.4* -2.6 +6.8*

JevBench public: easy 48/48, standard 71/72, hard 81/111 (Jev 1.13: hard 80/111).

Speed and memory (-c 49152 -ub 4096, MTP n-max 3) - A decision costs one full prefill of its prompt at ~1,100 tok/s with the LoRA on: ~0.3-0.6 s for a few-hundred-token ticket, ~2.3 s for Banking77's 2,360-token prompt. The head adds ~30 ms on CPU. - Chat: 57-95 tok/s with MTP (~40 without). - VRAM: 22,960 MiB including the vision projector.

Apple Silicon (Metal) -- verified

The same patch and flags run on a Mac with llama.cpp's Metal backend. Verified 2026-10-04 on an M1 Ultra (64 GB) from a clean checkout of this repo: examples/one_model_demo.mjs passes 24/24 with the same answers as on CUDA.

cmake -B build -DGGML_METAL=ON && cmake --build build --target llama-server -j
# step 3 above, unchanged (-ngl 999 offloads to Metal); clefhead runs on CPU via python as in step 4
M1 Ultra 64 GB measured
llama-server memory (ctx 49152, no vision projector) 19.4 GB
prompt read (prefill), LoRA on or off ~140 tok/s
one decision, ~460-token prompt ~3.2-4.4 s
chat with MTP 13-17 tok/s

A 32 GB Mac should fit it at a smaller context (macOS gives the GPU ~70-75% of RAM). Decisions are bound by prefill speed, so newer M-series chips will be faster.

Limitations

  • Text and JSON states only on /v1/systemone (Clef also takes images; this stack does not yet).
  • One request = one ubatch: 4096 tokens at -ub 4096; clefhead answers 413 above that instead of silently truncating the state (Cloudflare's encode_record truncates).
  • /embeddings never reuses the prompt cache, and Clef's prompt puts the state before the questions, so there is no shared prefix to cache: every decision is a full prefill.
  • The prebuilt images target sm_120 only. The patch is against ad1de39e0; newer llama.cpp also has native Clef (#29831, its own decision-only architecture) and /v1/systemone (#29818). Use those if you want Clef alone; use this setup to keep Clef and chat on one copy of the weights.

Packaged for Olares

The same stack ships as the llamacppqwen3827bdecide app (engine + clefhead + gateway): source.

License

Apache-2.0, following Cloudflare Clef and Qwen3.8-27B. The LoRA is a derivative of the Clef release weights; the head, tokenizer and clefhead/joint_schema_model.py are Cloudflare's, unmodified (see clefhead/NOTICE). The llama.cpp patch is offered under llama.cpp's MIT license.

Identity and Version

Repository
trevest/Qwen3.8-27B-Clef-LoRA-GGUF
Publisher
Trevest
Task
Text classification
Modality
Text
Library
gguf
Parameters
Not stated by the source
Languages
Not stated by the source
Revision
3c26090b3247ef38bee789fd4bffc8689422314c
First published
2026-10-03
Last updated
2026-10-05

Files and Weights

15 files, 1.6 GB in total. The weights are 2 files totalling 1.6 GB in gguf, safetensors.

Weights2 files · 1.6 GB
Configuration3 files · 33.8 KB
Tokenizer1 file · 20.0 MB
Documentation4 files · 34.1 KB
Other4 files · 22.4 KB
Repository1 file · 1.6 KB
Every file
FileTypeSizeSHA-256
clef-lora-f16.ggufWeights1.3 GB 25a811029b5f
joint_head.safetensorsWeights256.1 MB a010ac04f078
clefhead/joint_schema_model.pyConfiguration23.3 KB —
clefhead/server.pyConfiguration10.4 KB —
joint_head_config.jsonConfiguration119 B —
LICENSEDocumentation11.5 KB —
README.mdDocumentation10.5 KB —
clefhead/LICENSEDocumentation11.5 KB —
clefhead/NOTICEDocumentation443 B —
clefhead/DockerfileOther1.6 KB —
examples/one_model_demo.mjsOther9.1 KB —
llama.cpp-patch/0001-embeddings-lora-f16.patchOther6.3 KB —
llama.cpp-patch/DockerfileOther5.4 KB —
.gitattributesRepository1.6 KB —
tokenizer.jsonTokenizer20.0 MB 06b9509352d2

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
1.6 GB
Download from Trevest

Released by Trevest through its official repository on Hugging Face. Read the license.

Built From

  • Adapter of Cloudflare/clef
  • Derived from Cloudflare/clef

Memory Requirements

PrecisionWeights in memory
As published1.6 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About Qwen3.8-27B-Clef-LoRA-GGUF

Can I use Qwen3.8-27B-Clef-LoRA-GGUF commercially?

Yes. Qwen3.8-27B-Clef-LoRA-GGUF is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

Similar Models

Model · Text classification

twitter-roberta-base-sentiment-latest

Cardiff NLP

This is a RoBERTa-base model trained on ~124M tweets from January 2018 to December 2021, and finetuned for sentiment analysis with the TweetEval benchmark. The original Twitter-based RoBERTa model can be found here and the original reference paper is TweetEval. This model is suitable for English. 0 -> Negative; 1 -> Neutral; 2 -> Positive This sentiment analysis model has been integrated into TweetNLP. You can access the demo here.

Open weights cc-by-4.0 514 tokens transformers

Model · Text classification

finbert-tone

Yi

FinBERT is a BERT model pre-trained on financial communication text. The purpose is to enhance financial NLP research and practice. It is trained on the following three financial communication corpus. The total corpora size is 4.9B tokens. More technical details on FinBERT: Click Link This released finbert-tone model is the FinBERT model fine-tuned on 10,000 manually annotated (positive, negative, neutral) sentences from analyst reports. This model achieves superior performance on financial tone analysis task. If you are simply interested in using FinBERT for financial tone analysis, give it a try. If you use the model in your academic work, please cite the following paper: Huang, Allen H.…

Open weights 512 tokens transformers

Model · Text classification

ms-marco-MiniLM-L-6-v2

Joshua

https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-6-v2 with ONNX weights to be compatible with Transformers.js. If you haven't already, you can install the Transformers.js JavaScript library from NPM using: Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using Optimum and structuring your repo like this one (with ONNX weights located in a subfolder named onnx).

Open weights 512 tokens transformers.js

Model · Text classification

twitter-xlm-roberta-base-sentiment

Cardiff NLP

This is a multilingual XLM-roBERTa-base model trained on ~198M tweets and finetuned for sentiment analysis. The sentiment fine-tuning was done on 8 languages (Ar, En, Fr, De, Hi, It, Sp, Pt) but it can be used for more languages (see paper for details). This model has been integrated into the TweetNLP library.

Open weights 514 tokens transformers

Model · Text classification

unbiased-toxic-roberta

Unitary

The huggingface models currently give different results to the detoxify library (see issue here). For the most up to date models we recommend using the models from https://github.com/unitaryai/detoxify Trained models & code to predict toxic comments on 3 Jigsaw challenges: Toxic comment classification, Unintended Bias in Toxic comments, Multilingual toxic comment classification. Built by Laura Hanu at Unitary, where we are working to stop harmful content online by interpreting visual content in context. Score not directly comparable since it is obtained on the validation set provided and not on the test set. To update when the test labels are made available. It is also noteworthy to mention…

Open weights apache-2.0 514 tokens transformers

Model · Text classification

emotion-english-distilroberta-base

Hartmann

With this model, you can classify emotions in English text data. The model was trained on 6 diverse datasets (see Appendix below) and predicts Ekman's 6 basic emotions, plus a neutral class: 1) anger 2) disgust 3) fear 4) joy 5) neutral 6) sadness 7) surprise The model is a fine-tuned checkpoint of DistilRoBERTa-base. For a 'non-distilled' emotion model, please refer to the model card of the RoBERTa-large version. a) Run emotion model with 3 lines of code on single text example using Hugging Face's pipeline command on Google Colab: b) Run emotion model on multiple examples and full datasets (e.g.,.csv files) on Google Colab: Please reach out to [email protected] if you have any…

Open weights 514 tokens transformers