Instructions to use 2264K/Qwen3-32B-KoTokenizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 2264K/Qwen3-32B-KoTokenizer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="2264K/Qwen3-32B-KoTokenizer")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("2264K/Qwen3-32B-KoTokenizer", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 2264K/Qwen3-32B-KoTokenizer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "2264K/Qwen3-32B-KoTokenizer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "2264K/Qwen3-32B-KoTokenizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/2264K/Qwen3-32B-KoTokenizer
- SGLang
How to use 2264K/Qwen3-32B-KoTokenizer 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 "2264K/Qwen3-32B-KoTokenizer" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "2264K/Qwen3-32B-KoTokenizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "2264K/Qwen3-32B-KoTokenizer" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "2264K/Qwen3-32B-KoTokenizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use 2264K/Qwen3-32B-KoTokenizer with Docker Model Runner:
docker model run hf.co/2264K/Qwen3-32B-KoTokenizer
Qwen3-32B-KoTokenizer
Qwen3-32B with 3,682 Korean colloquial tokens added to the vocabulary.
Qwen3-32B's BPE tokenizer over-segments common Korean endings and particles (μ΄λ―Έ/μ‘°μ¬) into 2-4 sub-tokens. This model adds them as single tokens, trained via QLoRA to be natively used during generation.
What was done
| Before | After | |
|---|---|---|
νμμ |
ν + μ + μ (3 tokens) |
νμμ (1 token) |
λ΄€λλ° |
λ΄€ + λλ° (2 tokens) |
λ΄€λλ° (1 token) |
μ£μ‘νμ§λ§ |
μ£ + μ‘ + νμ§λ§ (3 tokens) |
μ£μ‘νμ§λ§ (1 token) |
| Vocab size | 151,669 | 155,351 (+3,682) |
The 3,682 tokens were extracted from HyperCLOVA's Korean-optimized vocabulary β specifically endings (μ΄λ―Έ) and particles (μ‘°μ¬) that Qwen's BPE consistently fragments.
Training
- Method: QLoRA (r=64, alpha=128) on Colab A100
- Key technique: Old embedding freeze β gradient hook zeros out gradients for the original 151K token embeddings, forcing the optimizer to only update the 3,682 new token rows
- Data: ~77K Korean samples filtered for high new-token density (β₯5 target tokens per sample), sourced from KoAlpaca, alpaca-gpt4-korean, KULLM-v2
- Epochs: 1 (with high-density data + freeze, convergence is fast)
- New token initialization: Mean pooling of constituent sub-token embeddings
Training curve
| Step | Loss | Accuracy |
|---|---|---|
| 50 | 1.649 | 65.6% |
| 500 | 1.186 | 70.9% |
| 1000 | 1.140 | 71.8% |
Results
New token adoption rate: 92.9% β when the model generates text containing a string that matches a new token, it uses the single new token ID 92.9% of the time (vs. falling back to the old fragmented sub-tokens).
| Prompt | Adoption | New tokens used |
|---|---|---|
| μ΄μ μΉκ΅¬λ₯Ό λ§λ¬λλ° κ±κ° κ°μκΈ°... | 4/4 = 100% | λ¬μ§λ§, λ¬λΌκ³ , νμ§λ§, κ°μ΅λλ€ |
| μμ§ν 그건 μ’ μλ κ² κ°κ±°λ ? | 1/1 = 100% | μ’μνλ |
| νκ΅μ κ²½μ μ±μ₯μ λν΄ μ€λͺ ν΄μ£ΌμΈμ | 1/1 = 100% | λλ¬Έ |
| μ΄κ±° μ§μ§ λ§μκ±°λ ? λλ νλ² λ¨Ήμ΄λ΄ | 3/3 = 100% | 보μΈμ, μμΌλ©°, νλ€κ³ |
| Write a Python function... | 0/0 = N/A | (no Korean tokens expected) |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
import torch
model_id = "2264K/Qwen3-32B-KoTokenizer"
# NF4 quantization (fits in 24GB VRAM)
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=bnb_config,
device_map="auto",
torch_dtype=torch.bfloat16,
)
# Verify new tokens work
print(tokenizer.encode("νμμ", add_special_tokens=False))
# [155305] β single token (was 3 tokens before)
# Generate
messages = [{"role": "user", "content": "μ΄μ μΉκ΅¬λ₯Ό λ§λ¬λλ° κ±κ° κ°μκΈ° μ΄μν μκΈ°λ₯Ό νλλΌκ³ ."}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, enable_thinking=False)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.7, top_p=0.9)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Important notes
- This is a merged model (not an adapter). Load it directly like any HuggingFace model.
- The tokenizer is included. No need to load the base Qwen3-32B tokenizer separately.
- The model's generation style is unchanged from Qwen3-32B β this modification only affects tokenization efficiency, not the model's personality or capabilities.
- English and code generation are unaffected (0 new tokens in English outputs, as expected).
Files
model-*.safetensorsβ merged model weights (bf16)tokenizer.json,tokenizer_config.jsonβ expanded tokenizertoken_expansion_metadata.jsonβ metadata for all 3,682 added tokens (token strings, IDs, source sub-token IDs used for mean pooling init)
License
Apache 2.0 (same as Qwen3-32B)
- Downloads last month
- 4
Model tree for 2264K/Qwen3-32B-KoTokenizer
Base model
Qwen/Qwen3-32B