Introduction
Xing4.1-Preview is an MoE model from the Xingchen Semantic Large Model family designed for agent programming and long-horizon complex tasks. It has a total parameter count of 285B with approximately 17B parameters activated per token and natively supports a 1M context window. Adopting MLA for compressed KV representation and DSA sparse attention, the model uses a 45-layer Transformer backbone, 42 of which are MoE layers. For each token, it selects 8 experts out of 256 routed experts together with 1 shared expert. For practical applications, it supports thinking mode switching, tool calling and structured output, and can be applied to multi-step office workflows, in-depth research, code generation and document-intensive business scenarios. The Xing 4 series was trained on fully domestic computing platforms, and this FlagOS adaptation further broadens the inference deployment options for Xing4.1-Preview.
Integrated Deployment
- Out-of-the-box inference scripts with pre-configured hardware and software parameters
- Released FlagOS-Mthreads container image supporting deployment within minutes
Consistency Validation
- Rigorously evaluated through benchmark testing: Performance and results from the FlagOS software stack are compared against native stacks on multiple public benchmarks.
Evaluation Results
Benchmark Result
| Metrics | Xing4.1-Preview-Nvidia-Origin | Xing4.1-Preview-Mthreads-FlagOS |
|---|---|---|
| Math-500 | 94.19 | 95.20 |
| GPQA_Diamond | 89.58 | 87.37 |
User Guide
Environment Setup
Host Environment
| Item | Version / Spec |
|---|---|
| Hardware (GPU) | MTT S5000 x8ๅก |
| Docker Version | 24.0.9 |
| Operating System | 22.04.4 LTS |
| Driver | 3.3.5-server |
| SDK | 3.3.5-server |
Operation Steps
Download FlagOS Image
docker pull harbor.baai.ac.cn/flagrelease-public/xing4.1-preview-mthreads001-gems5.3.0-tree0.6.1-cx0.13.0-pluginnone-vllm0.10.1-sglang0.5.18-sglangfl0.1.0-cp310-pt29-musa43-x64-3.3.5-server:202611291120
Download Open-source Model Weights
pip install modelscope
modelscope download --model FlagRelease/Xing4.1-Preview-FP8-mthreads-FlagOS
Start the Container
docker run -d \
--name xing4.1-flagos \
--runtime=mthreads \
--network=host \
--ipc=host \
--privileged \
--security-opt=label=disable \
--cgroupns=private \
--shm-size=1g \
--ulimit memlock=-1:-1 \
--ulimit stack=67108864:67108864 \
--restart=no \
--log-driver=json-file \
--log-opt max-size=100m \
--log-opt max-file=3 \
--workdir=/workspace \
--entrypoint=/bin/bash \
-e MTHREADS_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
-e MTHREADS_DRIVER_CAPABILITIES=all \
-e USE_FLAGGEMS=1 \
-e PYTORCH_MUSA_ALLOC_CONF=expandable_segments:True \
-v /data/Xing4.1-Preview:/data/Xing4.1-Preview:ro \
-v /data/adaptation/Xing4.1-flagos/logs:/var/log/hy4 \
-v /etc/localtime:/etc/localtime:ro \
harbor.baai.ac.cn/flagrelease-public/xing4.1-preview-mthreads001-gems5.3.0-tree0.6.1-cx0.13.0-pluginnone-vllm0.10.1-sglang0.5.18-sglangfl0.1.0-cp310-pt29-musa43-x64-3.3.5-server:202611291120 \
-lc "sleep infinity"'
docker exec -it xing4.1-flagos /bin/bash
Start the Inference Server
export PYTHONPATH=/opt/xing4.1/x41_overlay/site:/opt/xing4.1/x41_overlay
export FLAGCX_PATH=/opt/xing4.1/FlagCX
export SGLANG_PLUGINS=sglang_fl
export SGLANG_PLATFORM=sglang_fl
export SGLANG_FL_DIST_BACKEND=flagcx
export USE_FLAGGEMS=1
export USE_FLAGTUNE=0
export PYTORCH_MUSA_ALLOC_CONF=expandable_segments:True
export TELE285B_MUSA_DECODE_BCG=1
export TELE285B_DECODE_WINDOW=2048
export SGLANG_OPT_USE_TOPK_V2=0
export TELE_W8A8_SPLIT_K=64
export TELE_W8A8_SPLIT_K_PREFILL=1024
export TELE_W8A8_BK=64
export SGLANG_FL_FLAGOS_BLACKLIST=count_nonzero,cumsum,mm,unique,_unique2,unique_dim,unique_consecutive,to,copy_,mean,pow,rsqrt,cat,add,mul,sum,neg,silu,stack,linear,expand_as,narrow,alias,unsqueeze,transpose,flatten,lift_fresh,slice,split_with_sizes,chunk,expand,broadcast_to,resize,index,div,sub,abs,clamp,full,mm,bmm,softmax,arange,topk,native_layer_norm,zeros,ones,empty,contiguous,clone,view,reshape,permute,eq,ne,lt,gt,ge,le,where,masked_fill,fill,zeros_like,ones_like,empty_like,dropout,rms_norm,layer_norm,embedding,repeat,repeat_interleave,rotary_embedding,apply_rotary_pos_emb,index_select
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1
export OMP_NUM_THREADS=8
export TRITON_CACHE_DIR=/tmp/triton-xing41-bf16
export TORCH_EXTENSIONS_DIR=/tmp/torch-ext-xing41-bf16
exec /root/.virtualenvs/sglang-0.5.6/bin/python -m sglang.launch_server \
--model-path /data/Xing4.1-Preview \
--tokenizer-path /data/Xing4.1-Preview \
--served-model-name Xing4.1-Preview \
--host 0.0.0.0 \
--port 30130 \
--tp 8 \
--page-size 1 \
--dtype bfloat16 \
--trust-remote-code \
--attention-backend dsa \
--dsa-decode-backend flashmla_sparse \
--reasoning-parser deepseek-v3 \
--mem-fraction-static 0.90 \
--context-length 65536 \
--max-total-tokens 98304 \
--max-running-requests 4 \
--chunked-prefill-size 4096 \
--max-prefill-tokens 8192 \
--cuda-graph-config "{\"decode\":{\"backend\":\"breakable\",\"bs\":[1,2,4]}}" \
--disable-piecewise-cuda-graph \
--disable-radix-cache \
>> /var/log/hy4/server-bf16-30130.log 2>&1
Service Invocation
Invocation Script (Text)
curl -sS -m 600 http://127.0.0.1:30130/v1/chat/completions \
-H "Content-Type: application/json" \
-d '"'"'{
"model": "Xing4.1-Preview",
"messages": [
{
"role": "user",
"content": "What is 17 multiplied by 23? Reply with only the number."
}
],
"max_tokens": 256,
"temperature": 0.0,
"top_p": 1.0,
"chat_template_kwargs": {
"enable_thinking": false
}
}
AnythingLLM Integration Guide
1. Download & Install
- Visit the official site: https://anythingllm.com/
- Choose the appropriate version for your OS (Windows/macOS/Linux)
- Follow the installation wizard to complete the setup
2. Configuration
- Launch AnythingLLM
- Open settings (bottom left, fourth tab)
- Configure core LLM parameters
- Click "Save Settings" to apply changes
3. Model Interaction
- After model loading is complete:
- Click "New Conversation"
- Enter your question (e.g., "Explain the basics of quantum computing")
- Click the send button to get a response
Technical Overview
FlagOS is a fully open-source system software stack designed to unify the "modelโsystemโchip" layers and foster an open, collaborative ecosystem. It enables a "develop once, run anywhere" workflow across diverse AI accelerators, unlocking hardware performance, eliminating fragmentation among vendor-specific software stacks, and substantially lowering the cost of porting and maintaining AI workloads. With core technologies such as the FlagScale, together with vllm-plugin-fl, distributed training/inference framework, FlagGems universal operator library, FlagCX communication library, and FlagTree unified compiler, the FlagRelease platform leverages the FlagOS stack to automatically produce and release various combinations of <chip + open-source model>. This enables efficient and automated model migration across diverse chips, opening a new chapter for large model deployment and application.
FlagGems
FlagGems is a high-performance, generic operator libraryimplemented in Triton language. It is built on a collection of backend-neutralkernels that aims to accelerate LLM (Large-Language Models) training and inference across diverse hardware platforms.
FlagTree
FlagTree is an open source, unified compiler for multipleAI chips project dedicated to developing a diverse ecosystem of AI chip compilers and related tooling platforms, thereby fostering and strengthening the upstream and downstream Triton ecosystem. Currently in its initial phase, the project aims to maintain compatibility with existing adaptation solutions while unifying the codebase to rapidly implement single-repository multi-backend support. Forupstream model users, it provides unified compilation capabilities across multiple backends; for downstream chip manufacturers, it offers examples of Triton ecosystem integration.
FlagScale and vllm-plugin-fl
Flagscale is a comprehensive toolkit designed to supportthe entire lifecycle of large models. It builds on the strengths of several prominent open-source projects, including Megatron-LM and vLLM, to provide a robust, end-to-end solution for managing and scaling large models. vllm-plugin-fl is a vLLM plugin built on the FlagOS unified multi-chip backend, to help flagscale support multi-chip on vllm framework.
FlagCX
FlagCX is a scalable and adaptive cross-chip communication library. It serves as a platform where developers, researchers, and AI engineers can collaborate on various projects, contribute to the development of cutting-edge AI solutions, and share their work with the global community.
FlagEval Evaluation Framework
FlagEval is a comprehensive evaluation system and open platform for large models launched in 2023. It aims to establish scientific, fair, and open benchmarks, methodologies, and tools to help researchers assess model and training algorithm performance. It features:
- Multi-dimensional Evaluation: Supports 800+ modelevaluations across NLP, CV, Audio, and Multimodal fields,covering 20+ downstream tasks including language understanding and image-text generation.
- Industry-Grade Use Cases: Has completed horizonta1 evaluations of mainstream large models, providing authoritative benchmarks for chip-model performance validation.
Contributing
We warmly welcome global developers to join us:
- Submit Issues to report problems
- Create Pull Requests to contribute code
- Improve technical documentation
- Expand hardware adaptation support
License
The model weights are derived from Xing4.1-Preview and are open-sourced under the Apache License 2.0: https://www.apache.org/licenses/LICENSE-2.0.txt
- Downloads last month
- 24