model-optimize

Orchestrate staged KVCache, fusion, and graph-mode optimizations for NPU inference.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/tuliang1024/cann-recipes-infer --skill model-optimize
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-optimize
Source: https://github.com/tuliang1024/cann-recipes-infer/tree/main/.agent/skills/model-optimize
Command: npx skills add https://github.com/tuliang1024/cann-recipes-infer --skill model-optimize

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a staged, disciplined approach to optimize models for NPU inference, enforcing staged validation between KVCache, fusion, and graph-mode adaptation, and coordinating with subagents to ensure traceable progress and quality.

Core Features & Use Cases

  • KVCache静态化、FA替换、Cache metadata准备等阶段的有序执行
  • 融合算子优化与非 Attention 模块聚焦
  • Graph-mode adaptation is applied only in Decode stage, Prefill remains eager
  • Use Case: Single-card optimization to produce auditable reports and progress records

Quick Start

Start Stage 0 by analyzing the target model and creating a baseline optimization plan

Frequently Asked Questions about model-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize models for NPU inference with staged KVCache and fusion?

To optimize models for NPU inference, you orchestrate a single-card workflow applying staged KVCache staticization, fusion operator optimization, and graph-mode adaptation. This enforces stepwise validation after each stage to ensure traceable performance deltas.

Does graph-mode adaptation work for both Prefill and Decode stages?

Graph-mode adaptation applies only to the Decode stage, while the Prefill stage remains in eager mode. This selective application ensures focused optimization without disrupting the initial processing phase of the inference workflow.

What is the best way to validate model optimization steps on Atlas A2 environments?

The best way to validate model optimization on Atlas A2 environments is by enforcing stepwise validation after each stage of KVCache, fusion, and graph-mode adaptation. This produces precise implementation traces and performance deltas for auditable records.

Can I use subagents to track single-card model optimization progress?

Yes, you can coordinate with subagents to ensure traceable progress and quality during single-card model optimization. They help orchestrate end-to-end tasks and compile precise design decisions and performance deltas into a progress document.

How do I start Stage 0 for end-to-end model optimization?

To start Stage 0 for end-to-end model optimization, analyze the target model and create a baseline optimization plan. This initial assessment establishes the foundation for subsequent KVCache, fusion, and graph-mode adaptations.

What specific problems does staged model optimization solve for non-Attention modules?

Staged model optimization solves the problem of uncoordinated inference improvements by focusing on fusion operator optimization and non-Attention modules. It ensures ordered execution and stepwise validation to produce auditable performance reports.