Skip to content

Commit 96c05c5

Browse files
Merge pull request #2743 from ArmDeveloperEcosystem/main
production update
2 parents fa53c89 + 194cdf9 commit 96c05c5

110 files changed

Lines changed: 1909 additions & 964 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.wordlist.txt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5455,7 +5455,6 @@ MatMul
54555455
MlasConv
54565456
MlasDynamicQGemmBatch
54575457
MlasGemmBatch
5458-
Modescope
54595458
Nascimento
54605459
ParallemOpenMP
54615460
Partitioner
@@ -5473,4 +5472,25 @@ mopa
54735472
perfetto
54745473
translational
54755474
tunable
5476-
vlx
5475+
vlx
5476+
Ack
5477+
Dunkle
5478+
GENPROFILE
5479+
LIBPATH
5480+
LTCG
5481+
OneDrive
5482+
PGD
5483+
ParallelOpenMP
5484+
ParseMessage
5485+
RabbitMQ's
5486+
ReadFromPubSub
5487+
TabSeparated
5488+
USEPROFILE
5489+
WriteToClickHouse
5490+
iCloud
5491+
pgd
5492+
preselected
5493+
reconfiguring
5494+
torchscript
5495+
xxxxxx
5496+
Modescope

content/learning-paths/cross-platform/ernie_moe_v9/1_mixture_of_experts.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ In a typical MoE setup, the model consists of many expert sub-networks (for exam
2020

2121
MoE architecture provides several advantages that make it particularly well-suited for edge deployment and large-scale model development:
2222

23-
**Scalable model size**: You can increase total parameter count without linearly increasing inference cost, allowing for larger, more capable models within the same resource constraints.
23+
Scalable model size: you can increase total parameter count without linearly increasing inference cost, allowing for larger, more capable models within the same resource constraints.
2424

25-
**Efficient inference**: The architecture requires lower memory and FLOPs per input compared to dense models of equivalent capacity, making real-time applications more feasible.
25+
Efficient inference: the architecture requires lower memory and FLOPs per input compared to dense models of equivalent capacity, making real-time applications more feasible.
2626

27-
**Modularity**: Each expert can learn domain-specific patterns such as finance, medicine, or language, enabling the model to handle diverse tasks without retraining the entire network.
27+
Modularity: each expert can learn domain-specific patterns such as finance, medicine, or language, enabling the model to handle diverse tasks without retraining the entire network.
2828

29-
**Specialization**: The architecture encourages the model to learn distinct processing behaviors across different experts, improving performance on specialized tasks while maintaining general capability.
29+
Specialization: the architecture encourages the model to learn distinct processing behaviors across different experts, improving performance on specialized tasks while maintaining general capability.
3030

31-
**Routing flexibility**: The dynamic expert selection makes it easier to adapt to specific tasks using fine-tuned routing strategies, allowing for task-specific optimizations without modifying the core model.
31+
Routing flexibility: the dynamic expert selection makes it easier to adapt to specific tasks using fine-tuned routing strategies, allowing for task-specific optimizations without modifying the core model.
3232

3333
## ERNIE-4.5: An MoE model for Chinese NLP
3434

content/learning-paths/cross-platform/ernie_moe_v9/2_llamacpp_installation.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ weight: 3
44
layout: "learningpathall"
55
---
66

7-
## Set up llama.cpp on an Armv9 development board
7+
## Overview
88

99
In the previous section, you learned how Mixture of Experts (MoE) models reduce resource consumption by activating only a fraction of parameters.
1010
Now, you'll walk through how to prepare your environment to deploy ERNIE-4.5 models on an Armv9 platform using llama.cpp.
@@ -98,10 +98,10 @@ cd $HOME/llama.cpp/build
9898
```
9999

100100
Note the flags:
101-
- `-p`: Passes the input prompt directly as a string.
102-
- `-c 4096`: Sets the context length (in tokens). A longer context allows the model to "remember" more input text, which is crucial for long-form tasks. Here, you use the recommended 4096 tokens.
103-
- `-t 12`: Specifies the number of CPU threads used for inference. You should match this number to the physical cores (or logical threads) available on your system to maximize performance.
104-
- `--jinja`: Enables Jinja-style prompt templates. Many Chinese-oriented MoE models rely on this template format for structured inputs.
101+
- `-p`: passes the input prompt directly as a string.
102+
- `-c 4096`: sets the context length (in tokens). A longer context allows the model to "remember" more input text, which is crucial for long-form tasks. Here, you use the recommended 4096 tokens.
103+
- `-t 12`: specifies the number of CPU threads used for inference. You should match this number to the physical cores (or logical threads) available on your system to maximize performance.
104+
- `--jinja`: enables Jinja-style prompt templates. Many Chinese-oriented MoE models rely on this template format for structured inputs.
105105

106106
If everything is set up correctly, you see metadata output from llama.cpp indicating the model's architecture and size:
107107

@@ -113,12 +113,14 @@ print_info: general.name = Ernie-4.5-21B-A3B-Thinking
113113

114114
Once inference is complete, the expected output looks like this (in Chinese):
115115

116-
![img1 alt-text#center](meo_result.png "Introduce Mixture of Experts in Chinese")
116+
![Terminal output showing ERNIE-4.5 model response in Chinese with structured markdown formatting explaining Mixture of Experts concept alt-txt#center](meo_result.png "Introducing Mixture of Experts in Chinese")
117117

118118
This answer demonstrates the model's multilingual and structured reasoning ability. It begins with a narrative explanation introducing the concept of Mixture of Experts (MoE), followed by a well-organized markdown-style summary with section headers and bullet points. The response describes MoE as a model combining multiple specialized sub-models (experts) and a routing mechanism (gateway) to activate only a few experts per input. It explains how routing selects top experts based on input features and how the system reduces computation by activating only a small number of experts per token. The answer also gives examples such as word segmentation and translation, explaining how different experts might focus on distinct subtasks in Chinese NLP applications.
119119

120120
This confirms the GGUF model is successfully loaded, the llama.cpp build functions as expected, and CPU-only inference on Armv9 is working.
121121

122122
The prompt "Please introduce Mixture of Experts in Chinese." was chosen because it tests two important capabilities. First, it verifies bilingual capability since the instruction is in English but the answer is expected in Chinese, confirming that ERNIE-4.5's multilingual support works correctly. Second, it engages MoE behavior by having the model explain a technical concept in Chinese, which likely activates different experts within the model during inference. Even though routing isn't explicitly logged, the richness and precision of the output suggest that MoE routing functions as designed. This type of prompt increases the likelihood of multiple experts being activated simultaneously, including language generation, machine learning knowledge, and Chinese translation experts.
123123

124-
You've now successfully set up llama.cpp on Armv9 hardware, deployed the ERNIE-4.5 model, and confirmed that multilingual inference works correctly. With this foundation in place, you're ready to explore expert routing behavior and benchmark performance optimizations in the next sections.
124+
## What you've accomplished and what's next
125+
126+
You've successfully set up llama.cpp on Armv9 hardware, deployed the ERNIE-4.5 model, and confirmed that multilingual inference works correctly. With this foundation in place, you're ready to explore expert routing behavior and compare model variants in the next section.

content/learning-paths/cross-platform/ernie_moe_v9/3_erine_moe.md renamed to content/learning-paths/cross-platform/ernie_moe_v9/3_ernie_moe.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Now that both ERNIE-4.5 models are installed and verified, you can compare their
1111
In this section, you compare the inference styles of PT and Thinking models, and learn how to inspect internal MoE expert routing behavior during generation.
1212

1313
Both ERNIE-4.5 models share the same MoE architecture and parameter count (around 21 B total, around 3 B activated at runtime), but they're tuned for different objectives:
14-
- PT: General-purpose model trained on multilingual corpora for versatile tasks
15-
- Thinking: Tuned for multi-step reasoning, long context, and structured response generation
14+
- PT: general-purpose model trained on multilingual corpora for versatile tasks
15+
- Thinking: tuned for multi-step reasoning, long context, and structured response generation
1616

1717
You can now observe how these different tuning objectives affect output behavior.
1818

@@ -41,19 +41,18 @@ Here is the PT variant:
4141
--jinja
4242
```
4343

44-
The answer looks like this:
44+
The output is similar to:
4545

4646
```output
4747
Assistant: 1. **Top Motivation**: Achieving visible results and maintaining progress through efficient recovery nutrition.
4848
**Hidden Pain Point**: Balancing high-intensity training with optimal recovery nutrition during busy workouts.
4949
2. **New Product Line**: *Smart Recovery Meal Kits* – Customizable, nutrient-dense, and easy-to-prepare post-workout meals designed for quick consumption and recovery optimization.
5050
3. **Marketing Tagline**: "Fuel Progress, Recover Faster – Smart Nutrition for the Hard Worker."
5151
```
52-
5352
The answer shows:
54-
- Delivers conclusions directly: motivations and pain points are briefly mentioned with little reasoning.
55-
- Product ideas are sensible but templated: suggestions like "Smart Recovery Meal Kits" are plausible but lack contextual grounding in user behavior.
56-
- Tagline reads like a standard advertisement: for example, "Fuel Progress, Recover Faster" feels promotional rather than personalized.
53+
- Direct conclusions with minimal reasoning
54+
- Sensible but general product suggestions (such as "Smart Recovery Meal Kits")
55+
- Standard advertising tone in the tagline ("Fuel Progress, Recover Faster")
5756

5857
Here is the Thinking variant:
5958

@@ -65,7 +64,7 @@ Here is the Thinking variant:
6564
--jinja
6665
```
6766

68-
You see a more comprehensive answer like this:
67+
The output is similar to:
6968

7069
```output
7170
assistant
@@ -98,9 +97,9 @@ So to sum up:
9897
```
9998

10099
The answer shows:
101-
- Responses show deeper layering: begins with inferring user motivation, iterates through possible product strategies, and only then crafts a refined tagline.
102-
- Transparent reasoning process: the model "thinks out loud" ("let me try again… maybe that's too long…"), mimicking human deliberation.
103-
- Marketing language reflects user mindset: taglines like "Share. Track. Conquer." directly appeal to community sharing and progress motivation.
100+
- Deeper layering: the model begins by inferring user motivation, explores multiple product strategies, and then refines the tagline through iteration.
101+
- Transparent reasoning: the model "thinks out loud" with phrases like "let me try again… maybe that's too long…", mimicking human deliberation.
102+
- User-focused messaging: taglines like "Share. Track. Conquer." directly appeal to the user's community sharing and progress motivation.
104103

105104
### Compare the outputs
106105
After execution, review the responses and compare them along the following dimensions:
@@ -161,18 +160,23 @@ Run inference with the same prompt and monitor the console for lines like this:
161160
---[DEBUG]--- entering build_moe_ffn at layer 27 with 64 experts (use 64)
162161
```
163162

164-
This reveals how many experts (for example, 6) and how many tokens (for example, 16) were routed at that layer.
163+
This output shows that each layer has 64 total experts available. The actual number of experts activated per token (typically 6 for ERNIE-4.5) is determined by the router during inference and isn't directly visible in this debug output.
165164

166165
{{% notice Note %}}
167-
You can also trace the function `llm_graph_context::build_moe_ffn()` in `src/llama-graph.cpp` to see how expert selection works.
166+
You can also trace the function `llm_graph_context::build_moe_ffn()` in `src/llama-graph.cpp` to see how expert selection works at a deeper level.
168167
{{% /notice %}}
169168

170-
Remove the print statement from `src/models/ernie4-5-moe.cpp` before moving to the next section.
169+
Remove the print statement from `src/models/ernie4-5-moe.cpp` and rebuild llama.cpp before moving to the next section.
171170

172171
As you review the debug output, observe whether the number of active experts changes between the PT and Thinking models. Look for patterns in routing, such as different token batches routing to differing expert sets. You can also correlate routing behavior with output differences, as deeper routing variety might align with more detailed responses.
173172

174-
## Summary
173+
## What you've accomplished and what's next
174+
175+
In this section, you:
176+
- Compared ERNIE-4.5 PT and Thinking model outputs on the same task
177+
- Observed how fine-tuning affects reasoning depth and response structure
178+
- Learned how to add debug instrumentation to examine MoE expert routing
175179

176-
This task highlights the advantage of MoE fine-tuning. Even with the same architecture, thoughtful tuning can significantly change a model's reasoning behavior. The Thinking model is better suited for applications that need analytical depth, making it ideal for edge AI scenarios like customer profiling or real-time recommendations.
180+
This comparison highlights the advantage of MoE fine-tuning. Even with the same architecture, thoughtful tuning can significantly change a model's reasoning behavior. The Thinking model is better suited for applications that need analytical depth, making it ideal for edge AI scenarios like customer profiling or real-time recommendations.
177181

178182
In the next section, you switch focus from model behavior to system-level performance by compiling with Armv9 instruction sets and measuring the impact on inference speed.

content/learning-paths/cross-platform/ernie_moe_v9/4_v9_optimization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ After running benchmarks with and without Armv9-specific instructions, the resul
114114

115115
Vectorized kernels (i8mm, dotprod, SVE) drastically improve inference throughput. The pp512 test shows the most significant acceleration with a 2.57× improvement. Other patterns like tg128 and pp128+tg128 also achieve measurable gains. These results demonstrate the broad benefit of hardware-aware builds and show that Armv9 optimization enables practical real-time inference for 21 B models on edge-class hardware.
116116

117-
### Summary
117+
## What you've accomplished
118118

119-
Throughout this Learning Path, you deployed a 21 B parameter Chinese MoE model on edge-class Armv9 hardware. You started by understanding how MoE reduces memory usage by activating only a small subset of parameters per token. After setting up llama.cpp on a Radxa O6 board, you compared ERNIE-4.5 Thinking and PT model behaviors while examining expert routing logic with debug instrumentation. Finally, you applied Armv9 hardware optimizations and achieved over 2.5× speed improvements in token throughput.
119+
Throughout this Learning Path, you deployed a 21-billion-parameter Chinese MoE model on edge-class Armv9 hardware. You started by understanding how MoE reduces memory usage by activating only a small subset of parameters per token. After setting up llama.cpp on a Radxa O6 board, you compared ERNIE-4.5 Thinking and PT model behaviors while examining expert routing logic with debug instrumentation. Finally, you applied Armv9 hardware optimizations and achieved over 2.5× speed improvements in token throughput.
120120

121121
You can now deploy, profile, and tune Chinese LLMs for efficient inference on modern Arm CPUs.

content/learning-paths/cross-platform/ernie_moe_v9/_index.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
---
22
title: Run ERNIE-4.5 Mixture of Experts model on Armv9 with llama.cpp
33

4-
draft: true
5-
cascade:
6-
draft: true
7-
84
minutes_to_complete: 60
95

10-
who_is_this_for: This Learning Path is for developers and engineers who want to deploy Mixture of Experts (MoE) models, such as ERNIE 4.5, on edge devices. MoE architectures allow large LLMs with 21 billion or more parameters to run with only a fraction of their weights active per inference, making them ideal for resource constrained environments.
6+
who_is_this_for: This is an advanced topic for developers and engineers who want to deploy Mixture of Experts (MoE) models, such as ERNIE 4.5, on edge devices. MoE architectures allow large LLMs with 21 billion or more parameters to run with only a fraction of their weights active per inference, making them ideal for resource constrained environments.
117

128
learning_objectives:
139
- Deploy MoE models like ERNIE-4.5 on edge devices using llama.cpp
@@ -20,7 +16,7 @@ prerequisites:
2016
author: Odin Shen
2117

2218
### Tags
23-
skilllevels: Introductory
19+
skilllevels: Advanced
2420
subjects: ML
2521
armips:
2622
- Cortex-A

content/learning-paths/laptops-and-desktops/_index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ operatingsystems_filter:
1111
- ChromeOS: 2
1212
- Linux: 38
1313
- macOS: 10
14-
- Windows: 46
14+
- Windows: 47
1515
subjects_filter:
1616
- CI-CD: 6
1717
- Containers and Virtualization: 7
1818
- Migration to Arm: 30
19-
- ML: 5
19+
- ML: 6
2020
- Performance and Architecture: 28
2121
subtitle: Create and migrate apps for power efficient performance
2222
title: Laptops and Desktops
@@ -43,6 +43,7 @@ tools_software_languages_filter:
4343
- Git: 1
4444
- GitHub: 3
4545
- GitLab: 2
46+
- Google Benchmark: 1
4647
- Google Test: 1
4748
- HTML: 2
4849
- Hugging Face: 1
@@ -73,7 +74,7 @@ tools_software_languages_filter:
7374
- RDP: 1
7475
- Remote.It: 1
7576
- RME: 1
76-
- Runbook: 17
77+
- Runbook: 18
7778
- Rust: 2
7879
- SVE: 1
7980
- SVE2: 1
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Optimize C++ performance with Profile-Guided Optimization and Google Benchmark
3+
4+
draft: true
5+
cascade:
6+
draft: true
7+
8+
minutes_to_complete: 15
9+
10+
who_is_this_for: Developers looking to optimize C++ performance on an Arm-based Windows device, based on runtime behavior.
11+
12+
learning_objectives:
13+
- Microbenchmark a function using Google Benchmark.
14+
- Apply profile-guided optimization to build performance-tuned binaries for Windows on Arm.
15+
16+
prerequisites:
17+
- Basic C++ understanding.
18+
- Access to an Arm-based Windows machine.
19+
20+
author: Tom Dunkle
21+
22+
### Tags
23+
skilllevels: Introductory
24+
subjects: ML
25+
armips:
26+
- Neoverse
27+
tools_software_languages:
28+
- Google Benchmark
29+
- Runbook
30+
operatingsystems:
31+
- Windows
32+
33+
further_reading:
34+
- resource:
35+
title: MSVC profile-guided optimization documentation
36+
link: https://learn.microsoft.com/en-us/cpp/build/profile-guided-optimizations?view=msvc-170
37+
type: documentation
38+
- resource:
39+
title: Google Benchmark Library
40+
link: https://github.com/google/benchmark
41+
type: documentation
42+
43+
44+
45+
### FIXED, DO NOT MODIFY
46+
# ================================================================================
47+
weight: 1 # _index.md always has weight of 1 to order correctly
48+
layout: "learningpathall" # All files under learning paths have this same wrapper
49+
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
50+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---

0 commit comments

Comments
 (0)