Implementation:Ollama Ollama Llama Model BailingMoE
Appearance
| Knowledge Sources | |
|---|---|
| Domains | LLM Inference, Model Architecture |
| Last Updated | 2025-02-15 00:00 GMT |
Overview
Implements the ggml computation graph builder for the BailingMoE model architecture.
Description
The llm_build_bailingmoe constructor builds a transformer with RoPE-based positional encoding (with rope factor support), RMS-normalized self-attention with Q/K/V projections including optional bias terms, and Mixture-of-Experts feed-forward layers across all transformer blocks. Uses build_moe_ffn for the expert routing and gating.
Usage
Enables Ollama to run BailingMoE models through the llama.cpp inference engine.
Code Reference
Source Location
- Repository: Ollama
- File:
llama/llama.cpp/src/models/bailingmoe.cpp - Lines: 1-144
Signature
llm_build_bailingmoe::llm_build_bailingmoe(
const llama_model & model,
const llm_graph_params & params) : llm_graph_context(params);
Import
#include "models.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| model | const llama_model & | Yes | Loaded model with BailingMoE weights |
| params | const llm_graph_params & | Yes | Graph construction parameters |
Outputs
| Name | Type | Description |
|---|---|---|
| ggml graph | ggml_cgraph | Complete BailingMoE computation graph |
Usage Examples
auto builder = llm_build_bailingmoe(model, params);
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment