Instructions to use KRAFTON/Raon-1-mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KRAFTON/Raon-1-mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KRAFTON/Raon-1-mini", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("KRAFTON/Raon-1-mini", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KRAFTON/Raon-1-mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KRAFTON/Raon-1-mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KRAFTON/Raon-1-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KRAFTON/Raon-1-mini
- SGLang
How to use KRAFTON/Raon-1-mini 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 "KRAFTON/Raon-1-mini" \ --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": "KRAFTON/Raon-1-mini", "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 "KRAFTON/Raon-1-mini" \ --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": "KRAFTON/Raon-1-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use KRAFTON/Raon-1-mini with Docker Model Runner:
docker model run hf.co/KRAFTON/Raon-1-mini
Model card: release wording, six reasoning effort levels
Browse files- Remove every preview reference: llama.cpp (KRAFTON/Raon-1-mini-gguf, branch raon-1-mini), MLX (KRAFTON/Raon-1-mini-mlx), logo links (krafton-ai/Raon-1-mini).
- Highlights: six reasoning effort levels (none, low, medium, high, xhigh, max).
- Reasoning effort: how to set the level per runtime (vLLM, llama.cpp, Transformers, MLX) and how to turn thinking off with none; default high.
- Sampling parameters: point to the none level for thinking off.
- vLLM: build requirements; MLX section and the agentic MLX note follow the MLX repository README.
- Speculative decoding: drop the pending results line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ToBEpXARMkesJYKvCj1ssQ
|
@@ -9,8 +9,8 @@ tags:
|
|
| 9 |
# Raon-1 mini
|
| 10 |
|
| 11 |
<div align="center">
|
| 12 |
-
<img class="block dark:hidden" src="https://raw.githubusercontent.com/krafton-ai/Raon-1-mini
|
| 13 |
-
<img class="hidden dark:block" src="https://raw.githubusercontent.com/krafton-ai/Raon-1-mini
|
| 14 |
</div>
|
| 15 |
|
| 16 |
<p align="center">
|
|
@@ -30,7 +30,7 @@ Raon-1 mini is a 30B-A4B Mixture-of-Experts (MoE) language model, designed and *
|
|
| 30 |
|
| 31 |
## Highlights
|
| 32 |
|
| 33 |
-
- **Reasoning**: Built-in thinking
|
| 34 |
- **Instruction following and search**: (Benchmark results: pending)
|
| 35 |
- **Multilingual capabilities**: Trained on Korean, English, Japanese, Chinese, Spanish, French, and Thai. Demonstrates strong Korean performance and solid English capabilities.
|
| 36 |
- **Agent execution**: Tool calling for agentic workflows, with support for Hermes Agent, Pi and OpenCode.
|
|
@@ -78,7 +78,7 @@ Evaluation results for the final release: (pending)
|
|
| 78 |
## Sampling parameters
|
| 79 |
|
| 80 |
> [!Important]
|
| 81 |
-
> Raon-1 mini is designed for thinking mode
|
| 82 |
|
| 83 |
Settings shared by all tasks:
|
| 84 |
|
|
@@ -109,27 +109,17 @@ sampling = dict(temperature=1.0, top_p=0.95, top_k=20, presence_penalty=1.5, rep
|
|
| 109 |
|
| 110 |
## Reasoning effort
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
| `low` | 0.3 | |
|
| 120 |
-
| `medium` | 0.1 | |
|
| 121 |
-
| `high` | 0.05 | Default when unset |
|
| 122 |
-
| `xhigh` | 0.02 | |
|
| 123 |
-
| `max` | 0 | Unsteered model |
|
| 124 |
|
| 125 |
-
|
| 126 |
|
| 127 |
-
|
| 128 |
-
- Responses API: `reasoning.effort`
|
| 129 |
-
|
| 130 |
-
`minimal` and any other value not in the table are rejected with HTTP 400.
|
| 131 |
-
Steering is applied by the Raon vLLM fork and by the included Transformers code;
|
| 132 |
-
the chat template does not use `reasoning_effort`, so other engines ignore it.
|
| 133 |
|
| 134 |
```bash
|
| 135 |
curl http://localhost:8000/v1/chat/completions \
|
|
@@ -137,12 +127,9 @@ curl http://localhost:8000/v1/chat/completions \
|
|
| 137 |
-d '{
|
| 138 |
"model": "Raon-1-mini",
|
| 139 |
"messages": [
|
| 140 |
-
{
|
| 141 |
-
"role": "user",
|
| 142 |
-
"content": "Tell me about KRAFTON AI."
|
| 143 |
-
}
|
| 144 |
],
|
| 145 |
-
"reasoning_effort": "
|
| 146 |
"max_tokens": 8192,
|
| 147 |
"temperature": 1.0,
|
| 148 |
"top_p": 0.95,
|
|
@@ -151,16 +138,57 @@ curl http://localhost:8000/v1/chat/completions \
|
|
| 151 |
}'
|
| 152 |
```
|
| 153 |
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
## Speculative Decoding
|
| 159 |
|
| 160 |
We release a [DFlash2](https://github.com/z-lab/dflash) draft model, [KRAFTON/Raon-1-mini-dflash2](https://huggingface.co/KRAFTON/Raon-1-mini-dflash2), alongside Raon-1 mini to accelerate inference through speculative decoding. Speedups vary by hardware and workload.
|
| 161 |
|
| 162 |
-
Speculative decoding results for the final release: (pending)
|
| 163 |
-
|
| 164 |
## Quickstart
|
| 165 |
|
| 166 |
Raon-1 mini supports inference with Transformers, vLLM, llama.cpp,
|
|
@@ -256,7 +284,9 @@ Use vLLM to serve Raon-1 mini through an OpenAI-compatible API
|
|
| 256 |
with tool calling and DFlash2 speculative decoding.
|
| 257 |
Tested on NVIDIA B300. The RTX 5090 NVFP4 profile is documented below.
|
| 258 |
|
| 259 |
-
Install from our fork and start the server
|
|
|
|
|
|
|
| 260 |
|
| 261 |
```bash
|
| 262 |
VLLM_REF="raon"
|
|
@@ -326,19 +356,19 @@ vllm serve KRAFTON/Raon-1-mini-nvfp4 \
|
|
| 326 |
</details>
|
| 327 |
|
| 328 |
<details>
|
| 329 |
-
<summary><strong>llama.cpp
|
| 330 |
|
| 331 |
Use llama.cpp to run the GGUF checkpoint locally in a terminal
|
| 332 |
or through an OpenAI-compatible API, with optional DFlash2
|
| 333 |
speculative decoding.
|
| 334 |
|
| 335 |
-
Checkpoint: [KRAFTON/Raon-1-mini-
|
| 336 |
|
| 337 |
-
Build from our `raon-1-mini
|
| 338 |
On Windows, see the [build guide](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md).
|
| 339 |
|
| 340 |
```bash
|
| 341 |
-
git clone -b raon-1-mini
|
| 342 |
https://github.com/krafton-ai/llama.cpp
|
| 343 |
cd llama.cpp
|
| 344 |
|
|
@@ -351,7 +381,7 @@ Start a terminal chat. The model downloads automatically.
|
|
| 351 |
|
| 352 |
```bash
|
| 353 |
./build/bin/llama-cli \
|
| 354 |
-
-hf KRAFTON/Raon-1-mini-
|
| 355 |
--ctx-size 262144 \
|
| 356 |
--n-predict 32768 \
|
| 357 |
--temp 1.0 \
|
|
@@ -372,7 +402,7 @@ Or start an OpenAI-compatible server:
|
|
| 372 |
|
| 373 |
```bash
|
| 374 |
./build/bin/llama-server \
|
| 375 |
-
-hf KRAFTON/Raon-1-mini-
|
| 376 |
--host 127.0.0.1 \
|
| 377 |
--port 8000 \
|
| 378 |
--alias Raon-1-mini \
|
|
@@ -440,17 +470,17 @@ For coding and math, set `presence_penalty` to `0`.
|
|
| 440 |
</details>
|
| 441 |
|
| 442 |
<details>
|
| 443 |
-
<summary><strong>MLX (Apple silicon
|
| 444 |
|
| 445 |
Use MLX to run Raon-1 mini locally on Apple silicon,
|
| 446 |
either directly in Python or through an OpenAI-compatible API.
|
| 447 |
|
| 448 |
-
Checkpoint: [KRAFTON/Raon-1-mini-
|
| 449 |
|
| 450 |
-
Install the dependencies with Python 3.11+:
|
| 451 |
|
| 452 |
```bash
|
| 453 |
-
|
| 454 |
source .venv/bin/activate
|
| 455 |
|
| 456 |
python -m pip install \
|
|
@@ -459,6 +489,12 @@ python -m pip install \
|
|
| 459 |
"transformers==5.20.1"
|
| 460 |
```
|
| 461 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
Run in Python:
|
| 463 |
|
| 464 |
```python
|
|
@@ -469,7 +505,7 @@ from mlx_lm.sample_utils import (
|
|
| 469 |
)
|
| 470 |
|
| 471 |
model, tokenizer = load(
|
| 472 |
-
"
|
| 473 |
trust_remote_code=True,
|
| 474 |
)
|
| 475 |
|
|
@@ -504,11 +540,14 @@ response = generate(
|
|
| 504 |
print(response)
|
| 505 |
```
|
| 506 |
|
|
|
|
|
|
|
|
|
|
| 507 |
Or start an OpenAI-compatible server:
|
| 508 |
|
| 509 |
```bash
|
| 510 |
python -m mlx_lm server \
|
| 511 |
-
--model
|
| 512 |
--trust-remote-code \
|
| 513 |
--host 127.0.0.1 \
|
| 514 |
--port 8000 \
|
|
@@ -551,15 +590,99 @@ curl http://localhost:8000/v1/chat/completions \
|
|
| 551 |
|
| 552 |
Use `http://localhost:8000/v1` as the base URL
|
| 553 |
and `default_model` as the model name.
|
|
|
|
| 554 |
For coding and math, set `presence_penalty` to `0`.
|
| 555 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 556 |
</details>
|
| 557 |
|
| 558 |
## Agentic Use
|
| 559 |
|
| 560 |
Raon-1 mini can be used with agent harnesses such as [Hermes Agent](https://github.com/NousResearch/hermes-agent), [Pi](https://pi.dev), and [OpenCode](https://opencode.ai) through an OpenAI-compatible API. The examples below assume an endpoint at `http://localhost:8000/v1` with the model ID `Raon-1-mini`. Adjust these settings to match your server, ensuring that tool calling and reasoning are properly supported.
|
| 561 |
> [!NOTE]
|
| 562 |
-
> With MLX, use `
|
| 563 |
|
| 564 |
### Hermes Agent
|
| 565 |
|
|
|
|
| 9 |
# Raon-1 mini
|
| 10 |
|
| 11 |
<div align="center">
|
| 12 |
+
<img class="block dark:hidden" src="https://raw.githubusercontent.com/krafton-ai/Raon-1-mini/main/assets/raon-1-mini-logo.png" alt="Raon-1 mini" width="400">
|
| 13 |
+
<img class="hidden dark:block" src="https://raw.githubusercontent.com/krafton-ai/Raon-1-mini/main/assets/raon-1-mini-logo-dark.png" alt="Raon-1 mini" width="400">
|
| 14 |
</div>
|
| 15 |
|
| 16 |
<p align="center">
|
|
|
|
| 30 |
|
| 31 |
## Highlights
|
| 32 |
|
| 33 |
+
- **Reasoning**: Built-in thinking with six [reasoning effort](#reasoning-effort) levels (`none`, `low`, `medium`, `high`, `xhigh` and `max`), selectable per request. (Benchmark results: pending)
|
| 34 |
- **Instruction following and search**: (Benchmark results: pending)
|
| 35 |
- **Multilingual capabilities**: Trained on Korean, English, Japanese, Chinese, Spanish, French, and Thai. Demonstrates strong Korean performance and solid English capabilities.
|
| 36 |
- **Agent execution**: Tool calling for agentic workflows, with support for Hermes Agent, Pi and OpenCode.
|
|
|
|
| 78 |
## Sampling parameters
|
| 79 |
|
| 80 |
> [!Important]
|
| 81 |
+
> Raon-1 mini is designed for thinking mode. To turn thinking off, use the `none` [reasoning effort](#reasoning-effort).
|
| 82 |
|
| 83 |
Settings shared by all tasks:
|
| 84 |
|
|
|
|
| 109 |
|
| 110 |
## Reasoning effort
|
| 111 |
|
| 112 |
+
Raon-1 mini has six reasoning effort levels: `none`, `low`, `medium`, `high`, `xhigh` and `max`.
|
| 113 |
+
`low` thinks the least and `max` the most; `none` turns thinking off and answers directly.
|
| 114 |
+
Requests that do not set a level use `high`.
|
| 115 |
|
| 116 |
+
The levels from `low` to `max` are applied with steering vectors that ship with the checkpoint, so the
|
| 117 |
+
prompt stays the same. They are supported by the Raon vLLM and llama.cpp forks, the included Transformers
|
| 118 |
+
code and the MLX repository's `raon_mlx_model.py`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
### OpenAI-compatible server (vLLM, llama.cpp)
|
| 121 |
|
| 122 |
+
Set `reasoning_effort` in the request:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
```bash
|
| 125 |
curl http://localhost:8000/v1/chat/completions \
|
|
|
|
| 127 |
-d '{
|
| 128 |
"model": "Raon-1-mini",
|
| 129 |
"messages": [
|
| 130 |
+
{"role": "user", "content": "Tell me about KRAFTON AI."}
|
|
|
|
|
|
|
|
|
|
| 131 |
],
|
| 132 |
+
"reasoning_effort": "max",
|
| 133 |
"max_tokens": 8192,
|
| 134 |
"temperature": 1.0,
|
| 135 |
"top_p": 0.95,
|
|
|
|
| 138 |
}'
|
| 139 |
```
|
| 140 |
|
| 141 |
+
`chat_template_kwargs.reasoning_effort` also works, and the Responses API takes `reasoning.effort`.
|
| 142 |
+
Any other value is rejected with HTTP 400.
|
| 143 |
+
|
| 144 |
+
In `llama-cli`, add `--reasoning-effort low` (or another level). In `llama-server`, the same option sets
|
| 145 |
+
the level for requests that do not set one.
|
| 146 |
+
|
| 147 |
+
### Turning thinking off (`none`)
|
| 148 |
+
|
| 149 |
+
Send `"reasoning_effort": "none"` as a top-level field (`reasoning.effort` in the Responses API).
|
| 150 |
+
The thinking block is then closed in the prompt (`<think></think>`), and the model answers directly,
|
| 151 |
+
without steering.
|
| 152 |
+
|
| 153 |
+
- `"reasoning_effort": "none"` inside `chat_template_kwargs` keeps thinking on unless you also set
|
| 154 |
+
`"enable_thinking": false` there.
|
| 155 |
+
- `"enable_thinking": false` alone turns thinking off but keeps the default level's steering (`high`).
|
| 156 |
+
- In `llama-cli`, use `--reasoning off --reasoning-effort none` and set `"enable_thinking": false`
|
| 157 |
+
in `--chat-template-kwargs`.
|
| 158 |
+
|
| 159 |
+
### Transformers
|
| 160 |
+
|
| 161 |
+
The included model code applies one level to every `generate()` call. It starts at `high`:
|
| 162 |
+
|
| 163 |
+
```python
|
| 164 |
+
model.set_reasoning_effort("low") # none, low, medium, high, xhigh or max
|
| 165 |
+
outputs = model.generate(**inputs, max_new_tokens=32768)
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
For `none`, also pass `enable_thinking=False` to the chat template:
|
| 169 |
+
|
| 170 |
+
```python
|
| 171 |
+
model.set_reasoning_effort("none")
|
| 172 |
+
inputs = tokenizer.apply_chat_template(
|
| 173 |
+
messages,
|
| 174 |
+
add_generation_prompt=True,
|
| 175 |
+
tokenize=True,
|
| 176 |
+
return_dict=True,
|
| 177 |
+
return_tensors="pt",
|
| 178 |
+
enable_thinking=False,
|
| 179 |
+
).to(model.device)
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
### MLX
|
| 183 |
+
|
| 184 |
+
Use the bundled `raon_mlx_model.py`: add `--reasoning-effort low` to `generate` or `serve`, or send
|
| 185 |
+
`reasoning_effort` in a `raon_mlx_model.py serve` request. `mlx_lm` ignores the level. See the MLX
|
| 186 |
+
section of the [Quickstart](#quickstart).
|
| 187 |
|
| 188 |
## Speculative Decoding
|
| 189 |
|
| 190 |
We release a [DFlash2](https://github.com/z-lab/dflash) draft model, [KRAFTON/Raon-1-mini-dflash2](https://huggingface.co/KRAFTON/Raon-1-mini-dflash2), alongside Raon-1 mini to accelerate inference through speculative decoding. Speedups vary by hardware and workload.
|
| 191 |
|
|
|
|
|
|
|
| 192 |
## Quickstart
|
| 193 |
|
| 194 |
Raon-1 mini supports inference with Transformers, vLLM, llama.cpp,
|
|
|
|
| 284 |
with tool calling and DFlash2 speculative decoding.
|
| 285 |
Tested on NVIDIA B300. The RTX 5090 NVFP4 profile is documented below.
|
| 286 |
|
| 287 |
+
Install from our fork and start the server. The install and the first start need git,
|
| 288 |
+
CUDA Toolkit 13 with `nvcc` on `PATH`, and a C/C++ compiler (`gcc`/`g++`),
|
| 289 |
+
because the model's kernels are compiled on the first start:
|
| 290 |
|
| 291 |
```bash
|
| 292 |
VLLM_REF="raon"
|
|
|
|
| 356 |
</details>
|
| 357 |
|
| 358 |
<details>
|
| 359 |
+
<summary><strong>llama.cpp</strong></summary>
|
| 360 |
|
| 361 |
Use llama.cpp to run the GGUF checkpoint locally in a terminal
|
| 362 |
or through an OpenAI-compatible API, with optional DFlash2
|
| 363 |
speculative decoding.
|
| 364 |
|
| 365 |
+
Checkpoint: [KRAFTON/Raon-1-mini-gguf](https://huggingface.co/KRAFTON/Raon-1-mini-gguf)
|
| 366 |
|
| 367 |
+
Build from our `raon-1-mini` branch; upstream support is pending.
|
| 368 |
On Windows, see the [build guide](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md).
|
| 369 |
|
| 370 |
```bash
|
| 371 |
+
git clone -b raon-1-mini \
|
| 372 |
https://github.com/krafton-ai/llama.cpp
|
| 373 |
cd llama.cpp
|
| 374 |
|
|
|
|
| 381 |
|
| 382 |
```bash
|
| 383 |
./build/bin/llama-cli \
|
| 384 |
+
-hf KRAFTON/Raon-1-mini-gguf:Q4_K_M \
|
| 385 |
--ctx-size 262144 \
|
| 386 |
--n-predict 32768 \
|
| 387 |
--temp 1.0 \
|
|
|
|
| 402 |
|
| 403 |
```bash
|
| 404 |
./build/bin/llama-server \
|
| 405 |
+
-hf KRAFTON/Raon-1-mini-gguf:Q4_K_M \
|
| 406 |
--host 127.0.0.1 \
|
| 407 |
--port 8000 \
|
| 408 |
--alias Raon-1-mini \
|
|
|
|
| 470 |
</details>
|
| 471 |
|
| 472 |
<details>
|
| 473 |
+
<summary><strong>MLX (Apple silicon)</strong></summary>
|
| 474 |
|
| 475 |
Use MLX to run Raon-1 mini locally on Apple silicon,
|
| 476 |
either directly in Python or through an OpenAI-compatible API.
|
| 477 |
|
| 478 |
+
Checkpoint: [KRAFTON/Raon-1-mini-mlx](https://huggingface.co/KRAFTON/Raon-1-mini-mlx)
|
| 479 |
|
| 480 |
+
Install the dependencies with Python 3.11+ (the macOS system `python3` is older, so create the environment with uv):
|
| 481 |
|
| 482 |
```bash
|
| 483 |
+
uv venv --python 3.12 --seed
|
| 484 |
source .venv/bin/activate
|
| 485 |
|
| 486 |
python -m pip install \
|
|
|
|
| 489 |
"transformers==5.20.1"
|
| 490 |
```
|
| 491 |
|
| 492 |
+
Download the model once. All MLX examples below use this one download.
|
| 493 |
+
|
| 494 |
+
```bash
|
| 495 |
+
hf download KRAFTON/Raon-1-mini-mlx --local-dir Raon-1-mini-mlx
|
| 496 |
+
```
|
| 497 |
+
|
| 498 |
Run in Python:
|
| 499 |
|
| 500 |
```python
|
|
|
|
| 505 |
)
|
| 506 |
|
| 507 |
model, tokenizer = load(
|
| 508 |
+
"Raon-1-mini-mlx",
|
| 509 |
trust_remote_code=True,
|
| 510 |
)
|
| 511 |
|
|
|
|
| 540 |
print(response)
|
| 541 |
```
|
| 542 |
|
| 543 |
+
Loading the model prints a `[transformers] You are using a model of type raon1_mini to instantiate a model of type ...`
|
| 544 |
+
warning. It is expected and can be ignored.
|
| 545 |
+
|
| 546 |
Or start an OpenAI-compatible server:
|
| 547 |
|
| 548 |
```bash
|
| 549 |
python -m mlx_lm server \
|
| 550 |
+
--model Raon-1-mini-mlx \
|
| 551 |
--trust-remote-code \
|
| 552 |
--host 127.0.0.1 \
|
| 553 |
--port 8000 \
|
|
|
|
| 590 |
|
| 591 |
Use `http://localhost:8000/v1` as the base URL
|
| 592 |
and `default_model` as the model name.
|
| 593 |
+
`mlx_lm server` returns the reasoning in the `reasoning` field of the message and the answer in `content`.
|
| 594 |
For coding and math, set `presence_penalty` to `0`.
|
| 595 |
|
| 596 |
+
**Faster generation with DFlash2 (speculative decoding).** `raon_mlx_model.py` can also run the bundled DFlash2 draft
|
| 597 |
+
model (`dflash2/`). Run the commands using the folder downloaded above:
|
| 598 |
+
|
| 599 |
+
```bash
|
| 600 |
+
cd Raon-1-mini-mlx
|
| 601 |
+
```
|
| 602 |
+
|
| 603 |
+
DFlash2 on (default):
|
| 604 |
+
|
| 605 |
+
```bash
|
| 606 |
+
python raon_mlx_model.py generate \
|
| 607 |
+
--prompt "Tell me about KRAFTON AI." \
|
| 608 |
+
--max-tokens 32768 \
|
| 609 |
+
--temp 1.0 --top-p 0.95 --top-k 20 --presence-penalty 1.5
|
| 610 |
+
```
|
| 611 |
+
|
| 612 |
+
DFlash2 off (plain MLX-LM generation): add `--no-dflash`.
|
| 613 |
+
|
| 614 |
+
```bash
|
| 615 |
+
python raon_mlx_model.py generate --no-dflash \
|
| 616 |
+
--prompt "Tell me about KRAFTON AI." \
|
| 617 |
+
--max-tokens 32768 \
|
| 618 |
+
--temp 1.0 --top-p 0.95 --top-k 20 --presence-penalty 1.5
|
| 619 |
+
```
|
| 620 |
+
|
| 621 |
+
Or start an OpenAI-compatible server (`/v1/chat/completions`, streaming, `/v1/models`), with DFlash2 on or off:
|
| 622 |
+
|
| 623 |
+
```bash
|
| 624 |
+
python raon_mlx_model.py serve --host 127.0.0.1 --port 8000 # DFlash2 on
|
| 625 |
+
python raon_mlx_model.py serve --host 127.0.0.1 --port 8000 --no-dflash # DFlash2 off
|
| 626 |
+
```
|
| 627 |
+
|
| 628 |
+
The server reads `temperature`, `top_p`, `top_k`, `presence_penalty`, `seed`, `max_tokens`, `stop`, `stream` and
|
| 629 |
+
`chat_template_kwargs` from each request, and its defaults are temperature 1.0, top-p 0.95, top-k 20 and
|
| 630 |
+
presence penalty 0. Thinking is on unless a request sets `"enable_thinking": false`. The reasoning is returned in
|
| 631 |
+
`reasoning_content` and the answer in `content`. Tool calling is not supported by this server; use `mlx_lm server`
|
| 632 |
+
above for it.
|
| 633 |
+
|
| 634 |
+
Options for both commands:
|
| 635 |
+
|
| 636 |
+
- `--no-dflash`: turn DFlash2 off (plain MLX-LM generation).
|
| 637 |
+
- `--draft-tokens`: draft length. The default is 5, raised to 7 automatically while acceptance is high.
|
| 638 |
+
- `--draft`: another draft folder or repo id.
|
| 639 |
+
- `--max-tokens`, `--temp`, `--top-p`, `--top-k`, `--presence-penalty`, `--seed`.
|
| 640 |
+
|
| 641 |
+
`generate` also takes `--system` and `--no-thinking`; `serve` takes `--host`, `--port`, `--model-id` and
|
| 642 |
+
`--no-thinking`, which changes the default for requests that do not set it.
|
| 643 |
+
|
| 644 |
+
To set the reasoning effort (`none`, `low`, `medium`, `high`, `xhigh` or `max`; default `high`), add `--reasoning-effort`:
|
| 645 |
+
|
| 646 |
+
```bash
|
| 647 |
+
python raon_mlx_model.py generate --prompt "Tell me about KRAFTON AI." --reasoning-effort low
|
| 648 |
+
```
|
| 649 |
+
|
| 650 |
+
The `raon_mlx_model.py serve` server accepts `"reasoning_effort"` in each chat request; `mlx_lm server` and `mlx_lm.generate` ignore it.
|
| 651 |
+
|
| 652 |
+
DFlash2 needs `mlx==0.32.4` and `mlx-lm` 0.32.x as installed above. With other versions it prints a warning and
|
| 653 |
+
generates without the draft. While it is on, the module wraps `mx.quantized_matmul` and a few of its own layer
|
| 654 |
+
methods in the running process; outside the draft check they call the original code.
|
| 655 |
+
|
| 656 |
+
The presence penalty counts all generated tokens, as in vLLM. MLX-LM's penalty, used with `--no-dflash`, counts
|
| 657 |
+
the last 20 tokens including the prompt.
|
| 658 |
+
|
| 659 |
+
The draft adds about 1 GB of memory.
|
| 660 |
+
|
| 661 |
+
**Quick option guide.** These options apply to the bundled `raon_mlx_model.py` commands above:
|
| 662 |
+
|
| 663 |
+
- **DFlash2:** on by default; add `--no-dflash` to turn it off. Speed depends on how many draft tokens the model accepts.
|
| 664 |
+
- **Two-stage output head:** off by default; prefix the command with `RAON_HEAD_MODE=on` to enable it (`off` disables it). It automatically uses greedy selection for `--temp 0` (or less) and sampling for a positive temperature; the server uses each request's `temperature`. This is approximate and can change the output. DFlash2 draft verification always uses the full output head.
|
| 665 |
+
- **Work overlap:** on by default; prefix the command with `RAON_DFLASH2_OVERLAP=0` to disable overlapping CPU preparation with GPU work. This changes scheduling, not the sampling mode; the speed effect depends on the workload.
|
| 666 |
+
|
| 667 |
+
For example, enable the two-stage head with DFlash2 and greedy decoding:
|
| 668 |
+
|
| 669 |
+
```bash
|
| 670 |
+
RAON_HEAD_MODE=on python raon_mlx_model.py generate \
|
| 671 |
+
--prompt "Tell me about KRAFTON AI." --max-tokens 1024 --temp 0
|
| 672 |
+
```
|
| 673 |
+
|
| 674 |
+
Add `--no-dflash` to use the same head option without DFlash2. The included
|
| 675 |
+
`head_stage1_a2g64gm.safetensors` adds about 208 MB; a missing or invalid file causes a warning and fallback
|
| 676 |
+
to the full head. The MLX repository does not include `head_stage1_a2g64gm.safetensors` yet, so `RAON_HEAD_MODE=on` prints the warning and uses the full head. Direct native `mlx_lm.generate` calls use the full head.
|
| 677 |
+
|
| 678 |
+
|
| 679 |
</details>
|
| 680 |
|
| 681 |
## Agentic Use
|
| 682 |
|
| 683 |
Raon-1 mini can be used with agent harnesses such as [Hermes Agent](https://github.com/NousResearch/hermes-agent), [Pi](https://pi.dev), and [OpenCode](https://opencode.ai) through an OpenAI-compatible API. The examples below assume an endpoint at `http://localhost:8000/v1` with the model ID `Raon-1-mini`. Adjust these settings to match your server, ensuring that tool calling and reasoning are properly supported.
|
| 684 |
> [!NOTE]
|
| 685 |
+
> With MLX, use `Raon-1-mini-mlx` (the folder passed to `--model`) as the model ID instead of `Raon-1-mini`; `mlx_lm server` loads the model named in each request.
|
| 686 |
|
| 687 |
### Hermes Agent
|
| 688 |
|