FlagRelease/Xing4.0-29B-A4B-BF16-ascend-FlagOS

🤗 Hugging Face sourceapache-2.031.2B params62 GBsafetensorsHF checksums availableupdated today
No torrent yet

Introduction

China Telecom Artificial Intelligence Technology Co., Ltd. has officially released Xing4.0-29B-A4B, a new-generation Xingchen large model built for the AI agent era. The FlagOS open-source community completed Day-0 multi-chip adaptation in parallel. Xing4.0-29B-A4B has finished multi-chip adaptation, accuracy alignment and deployment verification on nine chip platforms, including T-Head, NVIDIA, Moore Threads, Huawei Ascend, MetaX, Hygon, Iluvatar CoreX, Tsingmicro and ARM, based on the unified FlagOS open-source technology stack. Seven of these AI chips operate at BF16 precision, while the ARM platform offers a W4A8 quantized version. The multi-chip variants have been published on ModelScope and Hugging Face, allowing developers to obtain ready-to-use deployment solutions for respective hardware platforms.

Built upon the TeleChat1-3 series, Xing4.0-29B-A4B is a comprehensively upgraded Xingchen large model. It features a total parameter count of 29B with only 4B activated parameters, adopting the mHC+MLA+MTP architecture. It natively supports a 256K context window, which can be extended to 512K. As China’s first tens-of-billion-parameter large model fully trained on domestic computing power and domestic frameworks, it is deeply optimized for complex engineering tasks. Designed for Agent scenarios, it can efficiently handle long-horizon tasks, support multi-step planning, tool invocation and the execution of complex reasoning chains, delivering powerful agent capabilities at a relatively small parameter scale.

Integrated Deployment

  • Out-of-the-box inference scripts with pre-configured hardware and software parameters
  • Released FlagOS-Ascend 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.

Evaluation Results

Benchmark Result

Metrics Xing4.0-29B-A4B-Nvidia-Origin Xing4.0-29B-A4B-Ascend-FlagOS
GPQA_Diamond 62.23 61.61
Math-500 84.80 85.20

User Guide

Environment Setup

Item Version
Docker Version Docker version 20.10.8
Operating System openEuler 22.03 (LTS-SP4)

Operation Steps

Download FlagOS Image

docker pull harbor.baai.ac.cn/flagrelease-public/xing4.0-29b-a4b-ascend001-gems5.3.0-tree0.6.0-cx0.13.0-pluginnone-vllmnone-sglang0.5.11-sglangfl0.1.0-cp311-ptnpu28-cann85-a64-none:202609181434

Download Open-source Model Weights

pip install modelscope
modelscope download --model FlagRelease/Xing4.0-29B-A4B-BF16-ascend-FlagOS --local_dir /data/Xing4.0-29B-A4B

Start the Container

docker run -d \
  --name flagos \
  --runtime ascend \
  --network host \
  --ipc host \
  --privileged \
  --shm-size 32g \
  --security-opt label=disable \
  -v /public-flash:/public-flash:ro \
  -w /workspace \
  --entrypoint /usr/bin/tail \
  harbor.baai.ac.cn/flagrelease-public/xing4.0-29b-a4b-ascend001-gems5.3.0-tree0.6.0-cx0.13.0-pluginnone-vllmnone-sglang0.5.11-sglangfl0.1.0-cp311-ptnpu28-cann85-a64-none:202609181434 \
  -f /dev/null

Start the Server

set -euo pipefail

export CMAKE_PREFIX_PATH=""

source /usr/local/Ascend/ascend-toolkit/set_env.sh

export ASCEND_RT_VISIBLE_DEVICES=8,9,10,11

export SGLANG_PLUGINS=sglang_fl
export SGLANG_FL_PLATFORM=ascend
export SGLANG_FL_DIST_BACKEND=hccl
export SGLANG_FL_STRICT=0

export SGLANG_FL_FLAGOS_BLACKLIST=full_like,index_copy_,gather,count_nonzero,index_put_,_index_put_impl_,cumsum,fill_scalar_,argmax,index,add_,conv1d,floor_divide,true_divide_,addmm,pow_scalar,pow_tensor_scalar,pow_tensor_tensor,pow_tensor_scalar_,pow_tensor_tensor_,float_power_scalar_tensor,float_power_scalar_tensor_out,float_power_tensor_scalar,float_power_tensor_scalar_out,float_power_tensor_tensor,float_power_tensor_tensor_out,float_power_tensor_scalar_,float_power_tensor_tensor_,ones,zeros,zero_,lift_fresh,add,mul,linear,mean_dim,bmm,masked_fill,masked_fill_,max,index_select,sum_dim,bitwise_and,bitwise_not,bitwise_or,clamp,cos,true_divide,eq,eq_scalar,ge,ge_scalar,lt,lt_scalar,mul_,neg,ne,ne_scalar,pad,reciprocal,remainder,rsqrt,rsub,rsub_scalar,scalar_tensor,sigmoid,silu,sin,square,sub,sum,multinomial,softmax,uniform_

export SGLANG_FL_PER_OP='mhc_pre=flagos|reference;mhc_post=flagos|reference'
export SGLANG_FL_MHC_CACHE_FN_BF16=1
export SGLANG_FL_MHC_NPU_RMSNORM=1

export SGLANG_FLAGGEMS_RECORD=0
export SGLANG_FLAGGEMS_LOG_PATH=/tmp/flaggems-op-xing4-best.txt

export SGLANG_FL_DISPATCH_DEBUG=0
export SGLANG_FL_DISPATCH_LOG=/tmp/dispatch-xing4-best.log

export SGLANG_MAX_THINK_TOKENS=70000

export FLAGCX_PATH=/opt/xingchen4-adaptation/build/FlagCX

export LD_LIBRARY_PATH=/opt/xingchen4-adaptation/build/FlagCX/build/lib:/opt/xingchen4-adaptation/candidate-venv/lib/python3.11/site-packages/torch/lib:/usr/local/Ascend/cann-8.5.0/lib64:/usr/local/Ascend/cann-8.5.0/lib64/plugin/opskernel:/usr/local/Ascend/cann-8.5.0/lib64/plugin/nnengine:/usr/local/Ascend/cann-8.5.0/opp/built-in/op_impl/ai_core/tbe/op_tiling/lib/linux/aarch64:/usr/local/Ascend/cann-8.5.0/tools/aml/lib64:/usr/local/Ascend/cann-8.5.0/tools/aml/lib64/plugin:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64/common:/usr/local/Ascend/driver/lib64/driver:/usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/lib:/usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/examples:/usr/local/Ascend/nnal/atb/latest/atb/cxx_abi_1/tests/atbopstest:/usr/local/Ascend/ascend-toolkit/latest/tools/aml/lib64:/usr/local/Ascend/ascend-toolkit/latest/tools/aml/lib64/plugin:/usr/local/Ascend/ascend-toolkit/latest/lib64:/usr/local/Ascend/ascend-toolkit/latest/lib64/plugin/opskernel:/usr/local/Ascend/ascend-toolkit/latest/lib64/plugin/nnengine:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling:/usr/local/python3.11.14/lib:

export PYTHONPATH=/opt/xingchen4-adaptation/build/sglang-pr37228-srt-empty/python:/usr/local/Ascend/cann-8.5.0/python/site-packages:/usr/local/Ascend/cann-8.5.0/opp/built-in/op_impl/ai_core/tbe:/usr/local/Ascend/ascend-toolkit/latest/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe:

nohup /opt/xingchen4-adaptation/candidate-venv/bin/python \
  -m sglang.launch_server \
  --model-path /public-flash/models/Xing4.0-29B-A4B \
  --served-model-name Xing4.0-29B-A4B \
  --trust-remote-code \
  --device npu \
  --tp-size 4 \
  --nccl-port 29707 \
  --host 0.0.0.0 \
  --port 31107 \
  --dtype bfloat16 \
  --context-length 102400 \
  --mem-fraction-static 0.80 \
  --attention-backend ascend \
  --sampling-backend ascend \
  --chunked-prefill-size 16384 \
  --max-prefill-tokens 102400 \
  --max-running-requests 65 \
  --num-continuous-decode-steps 4 \
  --cuda-graph-max-bs-decode 64 \
  --disable-piecewise-cuda-graph \
  --disable-shared-experts-fusion \
  --enable-fused-moe-sum-all-reduce \
  --grammar-backend xgrammar \
  --enable-quant-communications \
  > /tmp/xing4-0-tp4-31107.log 2>&1 &

echo $! > /tmp/xing4-0-tp4-31107.pid

Service Invocation

Invocation Script

curl -sS http://127.0.0.1:31107/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "Xing4.0-29B-A4B",
    "messages": [
      {"role": "user", "content": "你好,请用一句话介绍你自己。"}
    ],
    "temperature": 0.7,
    "top_p": 0.9,
    "max_tokens": 256,
    "stream": false
  }' | python3 -m json.tool

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:

  1. Submit Issues to report problems
  2. Create Pull Requests to contribute code
  3. Improve technical documentation
  4. Expand hardware adaptation support

License

The model weights are derived from XingChen-AGI/Xing4.0-29B-A4B and are open‑sourced under the Apache License 2.0: https://www.apache.org/licenses/LICENSE-2.0.txt