File size: 5,357 Bytes
63ac1c5
aa5c065
 
 
 
 
 
 
 
 
 
 
 
 
 
63ac1c5
aa5c065
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
---
library_name: transformers
license: apache-2.0
base_model:
  - openbmb/MiniCPM5-1B
pipeline_tag: text-generation
tags:
  - minicpm5
  - llm
  - axera
  - ax637
  - text-generation
language:
  - en
  - zh
---

# MiniCPM5-1B on AXERA AX637

Ready-to-run, text-only deployment package for
[`openbmb/MiniCPM5-1B`](https://huggingface.co/openbmb/MiniCPM5-1B) on an
AX637 aarch64 board.

- Runtime: packaged `axllm` binary with OpenAI-compatible HTTP API and CLI.
- Target: AX637.
- Context profile: `kv_cache_len=1024`, `prefill_len=128`, and maximum
  prefill capacity `896` tokens.
- Included assets: 24 decoder `.axmodel` files, post-processing `.axmodel`,
  embedding weights, tokenizer, runtime configuration, and `bin/axllm`.

## Supported Platform

- [x] AX637 aarch64 board with the AXERA runtime installed.

This is a text-only package. The packaged configuration has
`enable_thinking=false`.

## Performance

Measurements below were taken on an AX637 board with the packaged runtime.
`TTFT` means time to first generated token.

| Scenario | Input tokens | Prefill chunks | TTFT | Decode |
|---|---:|---:|---:|---:|
| Long text validation | 846 | 7 | 6600.26 ms | 6.23 tokens/s |

The long validation request generated five tokens and exercised every shipped
prefill history group: `0`, `128`, `256`, `384`, `512`, `640`, and `768`.
Actual latency depends on board memory pressure, prompt length, and output
length.

## Startup Runtime Footprint

| Item | Value |
|---|---:|
| Package size on disk | 1.7 GiB |
| Decoder layers | 24 |
| CMM used after full model startup | 966 MB |
| OS memory used by `axllm` after full model startup (RSS) | 59,856 KiB (58.5 MiB) |
| `axllm` virtual address space (`VmSize`, mostly mmap mappings) | 1,979,888 KiB (1.89 GiB) |

The CMM figure is the AX Engine CMM-pool delta measured from before startup to
after all 24 decoder layers and the post model were loaded. The OS-memory
figure is the board-side process resident set size (`VmRSS`) after the same
startup point. `VmSize` is shown separately because the package uses memory
mapping; it is virtual address space, not physical OS memory. CMM and RSS are
the startup consumption values to use when budgeting a board, while actual
system availability depends on other workloads.

## Context Layout

| Setting | Packaged value |
|---|---:|
| KV cache length | 1024 tokens |
| Prefill chunk length | 128 tokens |
| Maximum prefill length | 896 tokens |
| Prefill history capacities | 0, 128, 256, 384, 512, 640, 768 |

Prompts longer than 128 tokens are split into chunks. The runner selects the
smallest compatible prefill group for each chunk. Leave room inside the
1024-token KV window for generated tokens when sending long prompts.

## Package Layout

```text
.
β”œβ”€β”€ README.md
β”œβ”€β”€ bin/
β”‚   β”œβ”€β”€ axllm
β”‚   └── axllm.version.json
β”œβ”€β”€ config.json
β”œβ”€β”€ post_config.json
β”œβ”€β”€ minicpm5_tokenizer.txt
β”œβ”€β”€ model.embed_tokens.weight.bfloat16.bin
β”œβ”€β”€ llama_p128_l0_together.axmodel
β”œβ”€β”€ ...
β”œβ”€β”€ llama_p128_l23_together.axmodel
└── llama_post.axmodel
```

This is a flat runtime package. Run `axllm` from the package root; it reads the
root-level tokenizer, configuration, embedding, and `.axmodel` files directly.

## Download the Package

Download this repository on the host that will transfer or mount it on the
board:

```shell
mkdir -p AXERA-TECH/MiniCPM5-1B-AX637
cd AXERA-TECH/MiniCPM5-1B-AX637
hf download AXERA-TECH/MiniCPM5-1B-AX637 --local-dir .
```

## Run on the Board

The package includes a validated AX637 `axllm` binary. From the package root:

```bash
chmod +x ./bin/axllm
export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH:-}
./bin/axllm serve . --port 8000
```

The service exposes:

```text
GET  http://<board-ip>:8000/health
GET  http://<board-ip>:8000/v1/models
POST http://<board-ip>:8000/v1/chat/completions
```

Expected model identifier:

```text
AXERA-TECH/MiniCPM5-1B-AX637-C128-P896-CTX1024
```

Verify readiness:

```bash
curl http://127.0.0.1:8000/health
curl http://127.0.0.1:8000/v1/models
```

Example health response:

```json
{
  "concurrency": 0,
  "max_concurrency": 1,
  "status": "healthy"
}
```

### Text Request

```bash
curl http://127.0.0.1:8000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "AXERA-TECH/MiniCPM5-1B-AX637-C128-P896-CTX1024",
    "messages": [
      {
        "role": "user",
        "content": "δΈ­ε›½ηš„ι¦–ιƒ½ζ˜―ε“ͺι‡ŒοΌŸθ―·εͺε›žη­”εŸŽεΈ‚εγ€‚"
      }
    ],
    "max_tokens": 32,
    "temperature": 0
  }'
```

The response uses the standard OpenAI chat-completions JSON shape. Set the
OpenAI client base URL to `http://<board-ip>:8000/v1` and use the model
identifier shown above.

### Interactive CLI

```bash
export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH:-}
./bin/axllm run .
```

Type `/q` or `/exit` to leave the interactive session.

## Conversion References

If you need the original model files or want to rebuild the deployment
artifacts, start with:

- Original Hugging Face model:
  [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)
- AXERA conversion and deployment workflow:
  [AXERA-TECH/MiniCPM5-1B.axera](https://github.com/AXERA-TECH/MiniCPM5-1B.axera)

## Discussion

- [GitHub Issues](https://github.com/AXERA-TECH/ax-llm/issues)
- QQ group: `139953715`