sparse-quantization

sparse-quantization is a skill for OpenCode from mindspore-ai/akg. It costs 132 tokens per session (3,270 once invoked), scanned A, original, Apache-2.0.

A guide to loading and adapting sparsely quantized models in vLLM-MindSpore. Sparse quantization stores model weights in a smaller numerical format while preserving a sparse structure, and W8A8SC is one such format.

In plain words
What is it for?
It helps implement model loading, weight conversion, quantized linear layers, and fixes for sparse-quantization bugs in vLLM-MindSpore.
Why use it?
It addresses the code and compatibility problems that can prevent these models from loading or running on supported Ascend devices.

Skill for OpenCode

Written for OpenCode: installed under .opencode/.

Good fit It helps implement model loading, weight conversion, quantized linear layers, and fixes for sparse-quantization bugs in vLLM-MindSpore.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mindspore-ai/akg/sparse_quant
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mindspore-ai/akg --skill sparse_quant
Clone the repo
git clone --depth 1 https://github.com/mindspore-ai/akg

Made for: OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sparse-quantization

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindspore-ai/akg/sparse_quant/github.svg)](https://agentmods.dev/skills/mindspore-ai/akg/sparse_quant)
Your own site
<a href="https://agentmods.dev/skills/mindspore-ai/akg/sparse_quant"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/sparse_quant/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sparse-quantization

Your own site · 80×15
<a href="https://agentmods.dev/skills/mindspore-ai/akg/sparse_quant"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/sparse_quant.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 132 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,270 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00132 $0.03270
Opus 5 $0.00066 $0.01635
Sonnet 5 $0.00026 $0.00654
Haiku 4.5 $0.00013 $0.00327

Measured 9d ago against content hash d0fc8ba21012, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

sparse-quantization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

akg_agents/workspace/.opencode/skills/sparse_quant/SKILL.md · 285 lines

How it starts

The opening of the file, as written. The whole thing — 285 lines — stays where its author put it; the contents beside it link to each section on GitHub.

稀疏量化模型加载与适配 Skill


背景知识

vLLM-MindSpore 基于 vLLM 二次开发适配华为昇腾 NPU,稀疏量化(W8A8SC)是一种在 310P 推理机上支持的量化方案,使用 Golden Stick 量化工具链生成量化模型。

实现依据:vllm_mindspore PR !1428(W8A8SC 基础设施)、!1490(310P/910 兼容、权重加载优化、测试样例)

Rule Value
量化格式 W8A8SC(weight 8bit, activation 8bit, sparse compressed)
支持推理机 310P(910 不支持)
核心文件 vllm_mindspore/.../golden_stick/
量化工具 Golden Stick(msModelSlim)

设计方案:vLLM-MindSpore 官方稀疏量化设计文档 → Native 模型支持稀疏量化设计方案与代码改动说明


加载流程架构

文件路径                                                    | 作用                        | 关键函数
vllm_mindspore/.../golden_stick/golden_stick.py            | 量化方法注册与识别           | get_quant_method(), get_config_filenames()
vllm_mindspore/.../golden_stick/a8w8sc.py                  | A8W8SC 线性层实现           | A8W8SCLinearMethod.create_weights()
vllm_mindspore/.../quant_ops.py                            | 稀疏量化算子封装             | QuantLinearSparseOp
vllm_mindspore/.../models/sparse_quant_weight_loader.py    | 权重加载与 310P 格式转换     | load_split_weights(), _param_name_to_weight_key()
vllm_mindspore/.../sparse_quant_loader.py                  | 稀疏量化模型加载器           | SparseQuantModelLoader
vllm_mindspore/config.py                                   | 稀疏量化配置识别             | is_sparse_quantization
vllm_mindspore/.../qwen2.py                                | 模型权重加载                | load_weights()

加载流程详解

模型目录扫描
     │
     ▼
┌─────────────────────────────────────────┐
│ 1. 配置文件识别 (golden_stick.py)        │
│    - quantization_description.json      │
│    - quant_model_description.json       │
│    - quant_model_description_w8a8sc.json│
└─────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────┐
│ 2. 稀疏量化判断 (golden_stick.py)       │
│    - 配置中存在 rank_ 开头的键           │
│    - 设置 load_format=sparse_quant      │
└─────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────┐
│ 3. 推理机校验 (a8w8sc.py)              │
│    - 310P: 支持稀疏量化                 │
│    - 910: 报错 INFERENCE_910_SPARSE_QUANT│
└─────────────────────────────────────────┘
     │
     ▼
┌─────────────────────────────────────────┐
│ 4. 权重加载 (sparse_quant_weight_loader)│
│    - 从 rank_{tp_rank} 目录读取权重      │
│    - deq_scale: float32 → int64(310P)   │
└─────────────────────────────────────────┘
     │
     ▼
   推理就绪

Read the full file on GitHub · 285 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 285 lines · 132 tokens per session scan A d0fc8ba21012

Subscribe to this mod's changes

sparse-quantization is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 132 tokens to every session and 3,270 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

spark-environment-setup

Set up a working ML training/inference environment on NVIDIA DGX Spark (GB10, aarch64, CUDA 13). Use when installing PyTorch/Unsloth/TRL/vLLM on DGX Spark, hitting libcudart or wheel-ABI errors on aarch64, or choosing between NGC containers and bare pip installs.

wshobson/agents · 76 tokens

spark-memory-thermal-ops

Manage unified memory and thermals during long-running ML jobs on NVIDIA DGX Spark. Use when planning memory headroom for a training run on GB10, when a job OOMs on unified memory, or when monitoring temperature and power during multi-hour training.

wshobson/agents · 59 tokens

spark-training-gotchas

Preflight and diagnose the ten known failure modes for ML training on NVIDIA DGX Spark. Use when a training run on DGX Spark fails to start, OOMs below the 128GB limit, slows down mid-run, or before any multi-hour training job on GB10.

wshobson/agents · 63 tokens

llama-cpp

Runs LLM inference on CPU, Apple Silicon, and consumer GPUs without NVIDIA hardware. Use for edge deployment, M1/M2/M3 Macs, AMD/Intel GPUs, or when CUDA is unavailable. Supports GGUF quantization (1.5-8 bit) for reduced memory and 4-10× speedup vs PyTorch on CPU.

davila7/claude-code-templates · 76 tokens

minicpm5-deploy-vllm-ascend

Deploy MiniCPM5-2B with vLLM on Huawei Ascend NPU using vLLM-Ascend. Use when the user mentions vLLM-Ascend, Ascend NPU, Huawei Ascend, CANN, torchnpu, davinci devices, or wants an OpenAI-compatible MiniCPM5 server on Ascend hardware.

OpenBMB/MiniCPM · 87 tokens

minicpm5-deploy-litert

Run MiniCPM5-2B or MiniCPM5-1B on-device with Google's LiteRT-LM runtime — the litert-lm CLI or its OpenAI-compatible server on a desktop, the Kotlin API or the AI Edge Gallery app on Android, the same .litertlm bundle on CPU or GPU. Use when the user says "LiteRT", "LiteRT-LM", "litertlm", ".litertlm", "Android"…

OpenBMB/MiniCPM · 121 tokens