Text Generation
Transformers
Safetensors
qwen3
code
reasoning
lora-merged
livecodebench
conversational
text-generation-inference
Instructions to use modrill/code-think-q8b-20260908 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use modrill/code-think-q8b-20260908 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="modrill/code-think-q8b-20260908") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("modrill/code-think-q8b-20260908") model = AutoModelForCausalLM.from_pretrained("modrill/code-think-q8b-20260908", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use modrill/code-think-q8b-20260908 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "modrill/code-think-q8b-20260908" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "modrill/code-think-q8b-20260908", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/modrill/code-think-q8b-20260908
- SGLang
How to use modrill/code-think-q8b-20260908 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 "modrill/code-think-q8b-20260908" \ --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": "modrill/code-think-q8b-20260908", "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 "modrill/code-think-q8b-20260908" \ --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": "modrill/code-think-q8b-20260908", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use modrill/code-think-q8b-20260908 with Docker Model Runner:
docker model run hf.co/modrill/code-think-q8b-20260908
Add README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3-8B-Base
|
| 4 |
+
tags:
|
| 5 |
+
- code
|
| 6 |
+
- reasoning
|
| 7 |
+
- lora-merged
|
| 8 |
+
- livecodebench
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
library_name: transformers
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# CodeThink-V4-Qwen3-8B
|
| 14 |
+
|
| 15 |
+
Research checkpoint: **Qwen/Qwen3-8B-Base** (`49e3418fbbbca6ecbdf9608b4d22e5a407081db4`) after V4 LoRA SFT on Qwen3-30B-A3B-Thinking-2507 traces, then merged to full weights.
|
| 16 |
+
|
| 17 |
+
This is a **research checkpoint, not a product**. Single-seed diagnostic numbers only. Do not treat DEV256 as a leaderboard claim.
|
| 18 |
+
|
| 19 |
+
License: **Apache-2.0**, inherited from [Qwen/Qwen3-8B-Base](https://huggingface.co/Qwen/Qwen3-8B-Base) (verified from the local base `README.md`; Apache-2.0 text bundled from the Qwen3-4B-Base `LICENSE` file on disk).
|
| 20 |
+
|
| 21 |
+
## Base, teacher, and data
|
| 22 |
+
|
| 23 |
+
| | |
|
| 24 |
+
|---|---|
|
| 25 |
+
| Student | `Qwen/Qwen3-8B-Base` revision `49e3418fbbbca6ecbdf9608b4d22e5a407081db4` |
|
| 26 |
+
| Teacher | `Qwen/Qwen3-30B-A3B-Thinking-2507` traces (V4 paired think payload) |
|
| 27 |
+
| Problems | **4715** unique problems (`source_1ep_rows`); physical 2-epoch concat = **9430** rows |
|
| 28 |
+
| Dose | **32,436,894** assistant tokens / epoch; endpoint **64,873,788** assistant tokens (2 epochs) |
|
| 29 |
+
| Train seed | **42** |
|
| 30 |
+
|
| 31 |
+
## Recipe
|
| 32 |
+
|
| 33 |
+
- LoRA **r64 / α128**, dropout 0.0, seven projections: `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`
|
| 34 |
+
- Embeddings / `lm_head` frozen except **two-sided trainable B-rows** for **151643** (`<|endoftext|>`), **151667** (`<think>`), **151668** (`</think>`). Token ids from `adapter/TOKEN_ROWS_META.json`.
|
| 35 |
+
- Assistant supervised tail: `<|endoftext|>` (**151643**)
|
| 36 |
+
- LR **1e-4**, AdamW (β 0.9/0.95), **cosine** over assistant-token dose, **warmup 6%** (3,892,427 / 64,873,788 tokens), weight decay **0.1**
|
| 37 |
+
- **bf16**, no packing, no truncation, context 32768
|
| 38 |
+
- **2 epochs**, physical concat. Endpoint-only score; no checkpoint picking.
|
| 39 |
+
|
| 40 |
+
Merged weights are the 2-epoch endpoint (`step-000921`, 64,873,788 assistant tokens). LoRA + B-rows are under `adapter/`.
|
| 41 |
+
|
| 42 |
+
## Evaluation (DEV256)
|
| 43 |
+
|
| 44 |
+
256-problem LiveCodeBench-derived **dev** split. Seed **3407**, **think** mode, **no `<think>` prefill**, max generation ~32k, sandbox-verified **pass@1**. Temperature 0.6, top-p 0.95, top-k 20.
|
| 45 |
+
|
| 46 |
+
**Cap** = generations that hit the 32k length limit without closing `</think>`.
|
| 47 |
+
|
| 48 |
+
| Model | pass@1 | Cap | Notes |
|
| 49 |
+
|---|---:|---:|---|
|
| 50 |
+
| **CodeThink-V4-Qwen3-8B** | **81/256** | **130** | this repo; seed 3407; V4 think contract |
|
| 51 |
+
| Qwen3-8B-Base | 55/256 | — | **old-contract** historical bare-base number (not a same-contract V4 think-mode re-eval; a same-contract 8B-base think COMPLETE.json was not on disk) |
|
| 52 |
+
|
| 53 |
+
Single seed. These are research checkpoints, not product scores.
|
| 54 |
+
|
| 55 |
+
For context, the same-family 4B base on the **current** V4 think contract is 63/256 (seed 3407), with a 5-seed band 55.2 ± 4.9 on an earlier bare-base protocol.
|
| 56 |
+
|
| 57 |
+
## Usage
|
| 58 |
+
|
| 59 |
+
Merged full weights; no PEFT required at inference. Think mode: `enable_thinking=True`, **do not** prefill `<think>`.
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 63 |
+
|
| 64 |
+
repo = "modrill/CodeThink-V4-Qwen3-8B"
|
| 65 |
+
tokenizer = AutoTokenizer.from_pretrained(repo)
|
| 66 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 67 |
+
repo, torch_dtype="bfloat16", device_map="auto"
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
system = (
|
| 71 |
+
"You are an expert Python programmer. You will be given a question "
|
| 72 |
+
"(problem specification) and will generate a correct Python program that "
|
| 73 |
+
"matches the specification and passes all tests. You will NOT return "
|
| 74 |
+
"anything except for the program."
|
| 75 |
+
)
|
| 76 |
+
messages = [
|
| 77 |
+
{"role": "system", "content": system},
|
| 78 |
+
{"role": "user", "content": problem_statement},
|
| 79 |
+
]
|
| 80 |
+
prompt = tokenizer.apply_chat_template(
|
| 81 |
+
messages,
|
| 82 |
+
tokenize=False,
|
| 83 |
+
add_generation_prompt=True,
|
| 84 |
+
enable_thinking=True,
|
| 85 |
+
)
|
| 86 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 87 |
+
output = model.generate(
|
| 88 |
+
**inputs,
|
| 89 |
+
max_new_tokens=32768,
|
| 90 |
+
do_sample=True,
|
| 91 |
+
temperature=0.6,
|
| 92 |
+
top_p=0.95,
|
| 93 |
+
top_k=20,
|
| 94 |
+
)
|
| 95 |
+
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False))
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
Stop ids used in the official eval: `151643` (`<|endoftext|>`), `151645` (`<|im_end|>`).
|
| 99 |
+
|
| 100 |
+
## Repo layout
|
| 101 |
+
|
| 102 |
+
- Root: merged HF weights plus `OFFICIAL_MERGE_RECEIPT.json`
|
| 103 |
+
- `adapter/`: LoRA, `token_rows_both_sides.safetensors`, `TOKEN_ROWS_META.json`, checkpoint `MANIFEST.json`
|
| 104 |
+
- `provenance/`: train `RUN_IDENTITY.json`, `TRAINING_CONFIG.json`, `POLICY.json`; DEV256 `COMPLETE.json`
|
| 105 |
+
- `MANIFEST.sha256`
|
| 106 |
+
|
| 107 |
+
Optimizer / resume states are **not** included.
|