Instructions to use qubicomchat/Qubi-LLM-9B-Distill with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use qubicomchat/Qubi-LLM-9B-Distill with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="qubicomchat/Qubi-LLM-9B-Distill") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("qubicomchat/Qubi-LLM-9B-Distill") model = AutoModelForMultimodalLM.from_pretrained("qubicomchat/Qubi-LLM-9B-Distill", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use qubicomchat/Qubi-LLM-9B-Distill with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "qubicomchat/Qubi-LLM-9B-Distill" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qubicomchat/Qubi-LLM-9B-Distill", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/qubicomchat/Qubi-LLM-9B-Distill
- SGLang
How to use qubicomchat/Qubi-LLM-9B-Distill with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "qubicomchat/Qubi-LLM-9B-Distill" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qubicomchat/Qubi-LLM-9B-Distill", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "qubicomchat/Qubi-LLM-9B-Distill" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qubicomchat/Qubi-LLM-9B-Distill", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use qubicomchat/Qubi-LLM-9B-Distill with Docker Model Runner:
docker model run hf.co/qubicomchat/Qubi-LLM-9B-Distill
Qubi-LLM 9B Distill
ํ๊ตญ์ด ์์ฝ ยท Code: https://github.com/qubicom1/qubi-llm
A Korean telecom-domain answer model for retrieval-augmented generation (RAG). It is Qwen/Qwen3.5-9B fine-tuned (SFT) on answers from Qwen/Qwen3.8-27B, keeping only teacher answers that a local judge rated as grounded in the retrieved documents. It was trained in exactly the prompt format of the Qubi-LLM RAG service.
Status: experimental. This version has not been deployed in production. Read Limitations before use.
Intended use
- Answering telecom questions (3GPP ยท IETF RFC ยท ITU ยท O-RAN ยท 6G research) from documents you retrieve and put in the prompt, in Korean, with
[์ถ์ฒ N]citation labels. - Use it inside a RAG pipeline such as Qubi-LLM (retrieval + reranker grounding gate + refusal guard).
Out of scope: closed-book use without documents. Like the base model, it can state spec numbers and figures that do not exist when no documents are given. Do not use its answers as authoritative standards text without checking the cited sources.
Prompt format
The model was trained with the Qubi-LLM production messages:
- System:
SYSTEM_PROMPTinsrc/qubi/core/api/rag_service.py(friendly Korean tone, cite[์ถ์ฒ N], say "์ ๊ณต๋ ๋ฌธ์์์ ํ์ธ์ด ์ด๋ ค์์" for anything not in the documents, end with a<<RELATED>>line). - User:
์ฐธ์กฐ ๋ฌธ์:
[์ถ์ฒ 1]
Spec : TS 38.300 ...
<document text>
[์ถ์ฒ 2]
...
์ง๋ฌธ: <question>
์ ์ฐธ์กฐ ๋ฌธ์๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์ ํํ๊ฒ ๋ต๋ณํด์ฃผ์ธ์.
๐ ์ธ์ฉ ๊ท์น(ํ์): ...
- Output: the answer, followed by one line of related follow-up questions that the service strips before display:
<answer with [์ถ์ฒ N] labels>
<<RELATED>>["follow-up 1", "follow-up 2", "follow-up 3"]
Thinking is off: render the chat template with enable_thinking=False.
Usage
vLLM (OpenAI-compatible):
vllm serve <this-repo> --max-model-len 16384 --gpu-memory-utilization 0.25
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
resp = client.chat.completions.create(
model="<this-repo>",
messages=[{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message_with_documents}],
temperature=0.1, max_tokens=1024,
extra_body={"chat_template_kwargs": {"enable_thinking": False}},
)
Transformers:
from transformers import AutoTokenizer, AutoModelForImageTextToText
tok = AutoTokenizer.from_pretrained("<this-repo>")
model = AutoModelForImageTextToText.from_pretrained("<this-repo>", dtype="bfloat16", device_map="auto")
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
The checkpoint keeps the base model's architecture (Qwen3_5ForConditionalGeneration). Only the language model was fine-tuned; the vision encoder is unchanged from Qwen3.5-9B and was not evaluated.
Training
| Base model | Qwen/Qwen3.5-9B |
| Teacher | Qwen/Qwen3.8-27B (thinking off for answers) |
| Method | QLoRA SFT (4-bit NF4, double quantization), merged into BF16 |
| LoRA | r 32, ฮฑ 64, dropout 0.05; language-model attention (incl. linear-attention in_proj_* / out_proj) and MLP projections |
| Optimization | lr 5e-5, cosine, warmup 5 %, 2 epochs, batch 1 ร grad. accum. 8, 292 steps, bf16 |
| Sequence | max length 6,144; loss on the answer tokens only (prompt masked) |
| Chat template | enable_thinking=False for both training and serving |
| Eval loss | 0.629 โ 0.572 (held-out 58 examples; no overfitting) |
Data (not released): 1,165 training examples (1,091 answers + 74 refusals) and 58 eval examples.
- Prompts: Qubi-LLM production messages. Each prompt holds a question plus documents retrieved from our standards knowledge base: 3GPP, IETF RFC, ITU, O-RAN, arXiv, textbook-style notes, synthetic troubleshooting cases and Korean telecom news.
- Answer filter: teacher answers were kept only if they passed all of the following.
- The local judge (Qwen3.8-27B, thinking on) rated them core PASS, i.e. the core claims are supported by the documents.
- They contain citations, and every
[์ถ์ฒ N]points to a provided document. - They have a valid
<<RELATED>>line and are not truncated.
- Choosing one answer per question: answers that also passed the strict rule were preferred, then lower temperature.
- Refusals: correct teacher refusals on questions without supporting documents, capped at 10 % of the set.
- No benchmark overlap: questions overlapping our evaluation sets were excluded.
- Company content: a small number of examples (14) are about the developer company itself (a short company / product introduction).
- No Claude outputs: Anthropic Claude was used only as an independent evaluation judge, never for training data.
Evaluation
Internal evaluation sets (not released): 300 general questions, 88 held-out answerable questions and 48 questions with no supporting documents. Every item ran in a fresh session through the Qubi-LLM pipeline. "No guard" means the pipeline with refusal guards off; "with guard" is the full system.
Local judge (Qwen3.8-27B, thinking on; core ฮบ 0.47 vs Claude)
| Base Qwen3.5-9B | This model | Paired test | |
|---|---|---|---|
| No guard: core (grounded) โ | 24.2 % | 35.8 % | p=0.005 |
| No guard: general answer rate | 88.5 % | 76.8 % | p<0.001 |
| No guard: refusing answerable questions โ | 13.3 % | 26.6 % | p=0.007 |
| No guard: refusing questions with no documents โ | 82.6 % | 87.2 % | n.s. |
| With guard: core โ | 28.2 % | 35.9 % | p=0.071 |
| With guard: refusing answerable questions โ | 48.7 % | 52.0 % | n.s. |
Independent check (Claude, core rule, 150 questions both models answered)
| Base Qwen3.5-9B | This model | Paired test (base-only : this-only PASS) | |
|---|---|---|---|
| No guard: core โ | 28.0 % | 46.0 % | 17 : 44, p=0.001 |
| With guard: core โ | 22.7 % | 37.3 % | 13 : 35, p=0.002 |
Claude confirms the improvement. The local judge agreed with Claude on 65โ68 % of this model's answers, against 79โ85 % of the base model's answers. Treat the local-judge numbers above as approximate.
For scale: on the same rule, the 27B teacher itself scores about 52 % core by Claude, against 22 % for the base 9B. Model size is the largest factor.
How the evaluation was built, its pitfalls, and all other results: development history.
Limitations
- Partial answers. Like its teacher, the model often answers only the part the documents support and says the rest cannot be confirmed. Our judge counts many of these as refusals, which is why the answer rate drops.
- Refusal phrasing differs from the fixed phrase in the system prompt. A keyword-based refusal detector undercounts its refusals: it counted 27 % refusals on no-document questions where the judge counted 87 %. Detect refusals by judgment, not keywords.
- Faithfulness is still far from perfect. Even the teacher is about 52 % core by Claude. Always show the cited sources to users.
- No knowledge gain. Domain fine-tuning did not raise closed-book knowledge scores in our earlier tests (TeleQnA). Value comes from grounded answering inside RAG.
- Mostly Korean. It was trained and evaluated mainly on Korean questions over English documents.
- Company content. It may answer basic questions about the developer company.
License
Apache-2.0. The model is a derivative of Qwen/Qwen3.5-9B (Apache-2.0), fine-tuned with answers generated by Qwen/Qwen3.8-27B (Apache-2.0). The modifications are described above. The code is in the GitHub repository under MIT.
ํ๊ตญ์ด ์์ฝ
ํต์ ํ์ค ๋ฌธ์ RAG์ฉ ํ๊ตญ์ด ๋ต๋ณ ๋ชจ๋ธ์ ๋๋ค. Qwen3.5-9B๋ฅผ Qwen3.8-27B์ ๋ต์ผ๋ก SFTํ ์ฆ๋ฅํ์ด๊ณ , 27B ์ฑ์ ๊ด์ด "๋ฌธ์์ ๊ทผ๊ฑฐํจ(core PASS)"์ผ๋ก ํ์ ํ ๋ต๋ง ํ์ต์ ์ผ์ต๋๋ค. ํ์ต ๋ฐ์ดํฐ๋ Qubi-LLM ์ด์ ํ๋กฌํํธ ํ์์ ๊ทธ๋๋ก ๋ฐ๋์ต๋๋ค.
- ์ฉ๋: ๊ฒ์ํ ๋ฌธ์๋ฅผ ํ๋กฌํํธ์ ๋ฃ๊ณ ์ฐ๋ RAG ์์์ ์๋๋ค. ๋ฌธ์ ์์ด ํผ์ ์ฐ๋ฉด ๊ท๊ฒฉ์ ์ง์ด๋ผ ์ ์์ต๋๋ค.
- ๊ฒฐ๊ณผ(27B ์ฑ์ ๊ด): ๊ฐ๋ ๋ core 24.2 โ 35.8 %(p=0.005), ๊ฐ๋ ์ผฌ 28.2 โ 35.9 %(p=0.071). ๋์ ์ผ๋ฐ ์ง๋ฌธ ๋ต๋ณ์จ์ด 88.5 โ 76.8 %๋ก ๋ฎ์์ก์ต๋๋ค. ๋ฌธ์๋ก ๋๋ ๋ถ๋ถ๋ง ๋ตํ๋ ๋ถ๋ถ ๋ต์ด ๋์ด์์ ๋๋ค.
- Claude ๊ต์ฐจ ํ์ธ(๋ ๋ชจ๋ธ์ด ๋ชจ๋ ๋ตํ 150๋ฌธํญ, core): ๊ฐ๋ ๋ 28.0 โ 46.0 %(p=0.001), ๊ฐ๋ ์ผฌ 22.7 โ 37.3 %(p=0.002).
- ์ฃผ์:
- ๊ฑฐ์ ๋ฌธ๊ตฌ๊ฐ ๊ณ ์ ๋ฌธ๊ตฌ์ ๋ฌ๋ผ ํค์๋ ๊ฒ์ถ๊ธฐ๊ฐ ๊ฑฐ์ ์ ๋์นฉ๋๋ค.
- ์คํํ์ด๋ผ ์ด์์ ๋ฐฐํฌํ ์ ์ด ์์ต๋๋ค.
- ํ์ต ๋ฐ์ดํฐ์ ํ๊ฐ์ ์ ๊ณต๊ฐํ์ง ์์ต๋๋ค. Claude๋ ํ๊ฐ์๋ง ์ผ๊ณ ํ์ต ๋ฐ์ดํฐ์๋ ์ฐ์ง ์์์ต๋๋ค.
- ๋ผ์ด์ ์ค: Apache-2.0
- Downloads last month
- 227