RuView Claude Flow V3 性能工程师 Agent 详解:性能目标矩阵、基准套件与优化策略
本篇技术文章围绕 RuView 仓库中 .claude/agents/v3/performance-engineer.md 这一份 Claude Flow V3 性能工程师 Agent 规格文档展开,完整解读其性能目标矩阵、九大核心优化能力(Flash Attention、WASM SIMD、瓶颈检测、Token 削减、延迟分析、内存削减、批处理、并行策略、基准套件)、MCP/CLI 集成方式与 SONA 自适应学习闭环。读完本文,你将掌握如何在一个 Claude Code 多 Agent 开发管线中定义、路由和调用一个专职性能工程 Agent,并理解其 pre/post hooks、基准校验与回归判定的具体实现机制。
一、文档定位:Claude Flow V3 管线中的专职性能 Agent
performance-engineer.md 是 RuView 仓库 .claude/agents/v3/ 目录下的一个 Agent 定义文件(与 security-architect.md、memory-specialist.md、v3-integration-architect.md 等同级)。该目录构成了一个面向 Claude Code 的 V3 Agent 团队,由仓库根目录下的 settings.json 统一驱动。从该配置可以看到几个关键事实:
- 环境变量中声明了
CLAUDE_FLOW_V3_ENABLED: "true"与CLAUDE_FLOW_HOOKS_ENABLED: "true",即 V3 管线与 hooks 机制默认开启; permissions.allow白名单放行了Bash(npx @claude-flow*)、Bash(npx claude-flow*)、Bash(node .claude/*)以及全部mcp__claude-flow__:*工具——这正是本文档中 pre/post hooks 与 CLI 命令能够被 Agent 调用的权限前提;claudeFlow.swarm配置了topology: "hierarchical-mesh"、maxAgents: 15,与文档末尾"与 Swarm 协同"一节相呼应;claudeFlow.memory声明了backend: "hybrid"且enableHNSW: true,为文档中 HNSW 检索优化目标提供了配置层面的落点;claudeFlow.daemon.workers中包含optimize与benchmark两个常驻 worker,optimize的调度间隔为 30 分钟、优先级 high,说明性能优化是管线中周期性自动执行的任务。
此外,仓库中的 guidance-hooks.sh 提供了任务路由机制:当用户提交的任务文本匹配正则 (performance|optimize|benchmark) 时,route 子命令会将其路由到 performance-engineer Agent(第 59-60 行),而 (memory|AgentDB|HNSW|vector) 类任务则路由给 memory-specialist。这说明性能类任务在该管线中是被显式分流的。
在 v3-integration-architect.md 的 Agent 扩展规格中,performance-engineer 被列入了 V3 专属 Agent 类型清单(v3Types),与 security-architect、memory-specialist、sparc-orchestrator 等并列,由 V3AgentSpawner 负责实例化。
二、Frontmatter 规格:能力、优先级与量化指标
文档头部的 YAML frontmatter 是该 Agent 的机器可读规格,字段完整且可直接被编排系统消费:
name: performance-engineer
type: optimization
version: 3.0.0
color: "#FF6B35"
description: V3 Performance Engineering Agent specialized in Flash Attention optimization (2.49x-7.47x speedup), WASM SIMD acceleration, token usage optimization (50-75% reduction), and comprehensive performance profiling with SONA integration.
capabilities:
- flash_attention_optimization
- wasm_simd_acceleration
- performance_profiling
- bottleneck_detection
- token_usage_optimization
- latency_analysis
- memory_footprint_reduction
- batch_processing_optimization
- parallel_execution_strategies
- benchmark_suite_integration
- sona_integration
- hnsw_optimization
- quantization_analysis
priority: critical
metrics:
flash_attention_speedup: "2.49x-7.47x"
hnsw_search_improvement: "150x-12,500x"
memory_reduction: "50-75%"
mcp_response_target: "<100ms"
sona_adaptation: "<0.05ms"
要点说明:
type: optimization将其归入优化类 Agent(仓库中另有 optimization 目录下的performance-monitor.md、benchmark-suite.md等同类角色,二者定位不同:前者是执行优化的工程师,后者侧重监控与资源分配);priority: critical表示该 Agent 在任务调度中拥有最高优先级;metrics字段给出了五个可量化验收指标,后文的基准套件会逐条对这些指标做 PASS/FAIL 判定。
三、V3 性能目标矩阵
文档正文第一张表格定义了该 Agent 的职责边界与量化目标。需要特别说明:这些数值是 Agent 规格中设定的工程目标(target),用于驱动基准校验与回归判定,并非本仓库已实测的结果。
| 指标 | 目标 | 达成手段 |
|---|---|---|
| Flash Attention | 2.49x-7.47x 加速 | 融合算子、内存高效注意力 |
| HNSW Search | 150x-12,500x 提速 | 可导航小世界层级图(Hierarchical Navigable Small World) |
| Memory Reduction | 50-75% | 量化(int4/int8)、剪枝 |
| MCP Response | <100ms | 连接池、批量操作 |
| CLI Startup | <500ms | 懒加载、tree shaking |
| SONA Adaptation | <0.05ms | 亚毫秒级神经自适应 |
这组目标与配套技能 v3-performance-optimization/SKILL.md 中的"Performance Target Matrix"完全一致(该技能同样声明 2.49x-7.47x 的 Flash Attention 目标、150x-12,500x 的检索改进目标、50-75% 的内存削减目标),Agent 与 Skill 构成了"执行者 + 校验器"的配套关系。SKILL 文档还给出了调用范式:通过 Task("Flash Attention", "Validate 2.49x-7.47x speedup target", "v3-performance-engineer") 这样的任务分派语句并行下发多个目标校验任务。
四、会话生命周期 Hooks:基线采集与 SONA 轨迹
frontmatter 中的 hooks.pre / hooks.post 是该 Agent 每次被调度前后自动执行的 shell 脚本,这是"可学习的性能工程"落地的关键机制。
4.1 Pre Hook:会话登记 + 环境基线 + SONA 轨迹启动
# Initialize SONA trajectory for performance learning
PERF_SESSION_ID="perf-$(date +%s)"
export PERF_SESSION_ID
# Store session start in memory
npx claude-flow@v3alpha memory store \
--key "performance-engineer/session/${PERF_SESSION_ID}/start" \
--value "{\"timestamp\": $(date +%s), \"task\": \"$TASK\"}" \
--namespace "v3-performance" 2>/dev/null || true
# CPU baseline
CPU_BASELINE=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo "0")
echo " CPU Cores: $CPU_BASELINE"
# Memory baseline
MEM_TOTAL=$(free -m 2>/dev/null | awk '/^Mem:/{print $2}' || echo "0")
MEM_USED=$(free -m 2>/dev/null | awk '/^Mem:/{print $3}' || echo "0")
echo " Memory: ${MEM_USED}MB / ${MEM_TOTAL}MB"
# Start SONA trajectory
TRAJECTORY_RESULT=$(npx claude-flow@v3alpha hooks intelligence trajectory-start \
--task "performance-analysis" \
--context "performance-engineer" 2>&1 || echo "")
TRAJECTORY_ID=$(echo "$TRAJECTORY_RESULT" | grep -oP '(?<=ID: )[a-f0-9-]+' || echo "")
if [ -n "$TRAJECTORY_ID" ]; then
export TRAJECTORY_ID
echo " SONA Trajectory: $TRAJECTORY_ID"
fi
Pre hook 做了四件事:
- 会话登记:生成
perf-<unix时间戳>形式的PERF_SESSION_ID,并通过claude-flow memory store把会话开始事件写入v3-performance命名空间(key 为performance-engineer/session/${PERF_SESSION_ID}/start)。所有npx调用都带2>/dev/null || true,即外部 CLI 不可用时静默降级而不阻断主流程; - CPU 基线:通过
grep -c ^processor /proc/cpuinfo统计逻辑核数(Linux 专用手段); - 内存基线:通过
free -m解析Mem:行拿到总量与已用量(MB),作为后续"内存削减 50-75%"目标的参照起点; - SONA 轨迹启动:调用
claude-flow hooks intelligence trajectory-start开启一条学习轨迹,并从输出中正则提取ID:后的 UUID 存入TRAJECTORY_ID,供 post hook 收尾时回写质量分。
Pre hook 最后会向终端打印全部五项性能目标,作为本次分析的"验收单"。
4.2 Post Hook:轨迹收尾 + 会话归档 + 报告摘要
END_TIME=$(date +%s)
# End SONA trajectory with quality score
if [ -n "$TRAJECTORY_ID" ]; then
OUTPUT_LENGTH=${#OUTPUT:-0}
# Simple quality score: 0.85 default, higher for longer/more detailed outputs
QUALITY_SCORE="0.85"
npx claude-flow@v3alpha hooks intelligence trajectory-end \
--session-id "$TRAJECTORY_ID" \
--verdict "success" \
--reward "$QUALITY_SCORE" 2>/dev/null || true
echo "SONA Quality Score: $QUALITY_SCORE"
fi
# Store session completion
npx claude-flow@v3alpha memory store \
--key "performance-engineer/session/${PERF_SESSION_ID}/end" \
--value "{\"timestamp\": $END_TIME, \"quality\": \"$QUALITY_SCORE\"}" \
--namespace "v3-performance" 2>/dev/null || true
Post hook 与 pre hook 形成闭环:
- 若
TRAJECTORY_ID存在,则以trajectory-end提交判定结果(verdict: success)与奖励分(reward,此处采用固定 0.85 的简单质量分策略,注释中说明"更长、更详细的输出可得更高分"),这一步是把一次性能分析会话转化为 SONA 可消费的轨迹样本; - 随后把会话结束事件写入同一命名空间(key 以
/end结尾),形成 start/end 成对可审计的会话记录; - 最后打印包含 Session ID、"建议已存入 memory"、"优化模式已通过 SONA 学习"的摘要块。
这套 hooks 设计意味着:每一次性能分析任务都会自动产生一条带时间戳、任务描述与质量分的轨迹记录,无需人工干预即可为后续的模式学习积累语料。
五、核心能力一:Flash Attention 优化
文档将 Flash Attention 列为第一优先优化项,思路是通过内存高效(memory-efficient)的注意力计算换取 2.49x-7.47x 加速区间。规格中给出的参考实现如下(这是文档内的参考实现/伪代码,用于定义 Agent 应输出的优化配置结构,而非仓库中独立运行的模块):
// Flash Attention Configuration
class FlashAttentionOptimizer {
constructor() {
this.config = {
// Block sizes optimized for GPU memory hierarchy
blockSizeQ: 128,
blockSizeKV: 64,
// Memory-efficient forward pass
useCausalMask: true,
dropoutRate: 0.0,
// Fused softmax for reduced memory bandwidth
fusedSoftmax: true,
// Expected speedup range
expectedSpeedup: { min: 2.49, max: 7.47 }
};
}
async optimizeAttention(model, config = {}) {
const optimizations = [];
// 1. Enable flash attention
optimizations.push({
type: 'FLASH_ATTENTION',
enabled: true,
expectedSpeedup: '2.49x-7.47x',
memoryReduction: '50-75%'
});
// 2. Fused operations
optimizations.push({
type: 'FUSED_OPERATIONS',
operations: ['qkv_projection', 'softmax', 'output_projection'],
benefit: 'Reduced memory bandwidth'
});
// 3. Memory-efficient backward pass
optimizations.push({
type: 'MEMORY_EFFICIENT_BACKWARD',
recomputation: 'selective',
checkpointing: 'gradient'
});
return optimizations;
}
// Benchmark flash attention performance
async benchmarkFlashAttention(seqLengths = [512, 1024, 2048, 4096]) {
const results = [];
for (const seqLen of seqLengths) {
const baseline = await this.measureBaselineAttention(seqLen);
const flash = await this.measureFlashAttention(seqLen);
results.push({
sequenceLength: seqLen,
baselineMs: baseline.timeMs,
flashMs: flash.timeMs,
speedup: baseline.timeMs / flash.timeMs,
memoryReduction: 1 - (flash.memoryMB / baseline.memoryMB)
});
}
return results;
}
}
三个可执行要点:
- 分块参数:
blockSizeQ: 128、blockSizeKV: 64,注释明确其依据是"针对 GPU 内存层级的分块尺寸"——即 Q 块取 128、KV 块取 64 的不对称分块,是 Flash Attention 系列算法典型的 SRAM/显存权衡参数; - 优化项输出结构:
optimizeAttention返回三类优化描述(FLASH_ATTENTION 本身、FUSED_OPERATIONS 融合qkv_projection/softmax/output_projection、MEMORY_EFFICIENT_BACKWARD 采用选择性重计算 + 梯度检查点),每个优化项都携带预期收益,方便下游基准套件逐项验证; - 基准方法:
benchmarkFlashAttention在 512/1024/2048/4096 四个序列长度上分别测量 baseline 与 flash 两条路径,输出speedup = baselineMs / flashMs与memoryReduction = 1 - flashMB / baselineMB,这两列正好对应目标表中的两个验收指标。
六、核心能力二:WASM SIMD 加速
第二项能力是 WASM SIMD(128 位向量指令),目标是在 JavaScript 环境中获得接近原生的向量运算速度:
// WASM SIMD Optimization System
class WASMSIMDOptimizer {
constructor() {
this.simdCapabilities = null;
this.wasmModule = null;
}
async initialize() {
// Detect SIMD capabilities
this.simdCapabilities = await this.detectSIMDSupport();
// Load optimized WASM module
this.wasmModule = await this.loadWASMModule();
return {
simdSupported: this.simdCapabilities.supported,
features: this.simdCapabilities.features,
expectedSpeedup: this.calculateExpectedSpeedup()
};
}
async detectSIMDSupport() {
const features = {
supported: false,
simd128: false,
relaxedSimd: false,
vectorOps: []
};
try {
// Test SIMD support
const simdTest = await WebAssembly.validate(
new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11])
);
features.supported = simdTest;
features.simd128 = simdTest;
if (simdTest) {
features.vectorOps = [
'v128.load', 'v128.store',
'f32x4.add', 'f32x4.mul', 'f32x4.sub',
'i32x4.add', 'i32x4.mul',
'f32x4.dot'
];
}
} catch (e) {
console.warn('SIMD detection failed:', e);
}
return features;
}
// Optimized vector operations
async optimizeVectorOperations(operations) {
const optimizations = [];
// Matrix multiplication optimization
if (operations.includes('matmul')) {
optimizations.push({
operation: 'matmul',
simdMethod: 'f32x4_dot_product',
expectedSpeedup: '4-8x',
blockSize: 4
});
}
// Vector addition optimization
if (operations.includes('vecadd')) {
optimizations.push({
operation: 'vecadd',
simdMethod: 'f32x4_add',
expectedSpeedup: '4x',
vectorWidth: 128
});
}
// Embedding lookup optimization
if (operations.includes('embedding')) {
optimizations.push({
operation: 'embedding',
simdMethod: 'gather_scatter',
expectedSpeedup: '2-4x',
cacheOptimized: true
});
}
return optimizations;
}
// Run WASM SIMD benchmark
async runBenchmark(config = {}) {
const results = {
matmul: await this.benchmarkMatmul(config.matrixSize || 1024),
vectorOps: await this.benchmarkVectorOps(config.vectorSize || 10000),
embedding: await this.benchmarkEmbedding(config.vocabSize || 50000)
};
return {
results,
overallSpeedup: this.calculateOverallSpeedup(results),
recommendations: this.generateRecommendations(results)
};
}
}
实现要点:
- 能力探测:
detectSIMDSupport用WebAssembly.validate校验一段内嵌的 WASM 字节码([0, 97, 115, 109, ...]即\0asmmagic 开头、含v128相关操作码的探针模块),以此判断运行时是否支持simd128提案; - 算子映射表:
optimizeVectorOperations把三类热点算子映射到具体 SIMD 方法——matmul映射到f32x4_dot_product(预期 4-8x,blockSize 4)、vecadd映射到f32x4_add(预期 4x,vectorWidth 128)、embedding查表映射到gather_scatter(预期 2-4x,缓存友好); - 基准入口:
runBenchmark以默认参数矩阵规模 1024、向量规模 10000、词表 50000 分别跑三项基准,并汇总整体加速比与优化建议。
七、核心能力三:性能剖析与瓶颈检测
第三项能力是系统级 Profiler。该 Agent 用一张阈值表驱动瓶颈判定,这是文档中非常实用的一处"参数即策略"的设计:
// Comprehensive Performance Profiler
class PerformanceProfiler {
constructor() {
this.profiles = new Map();
this.bottlenecks = [];
this.thresholds = {
cpuUsage: 80,
memoryUsage: 85,
latencyP95: 100, // ms
latencyP99: 200, // ms
gcPause: 50 // ms
};
}
async profileSystem() {
const profile = {
timestamp: Date.now(),
cpu: await this.profileCPU(),
memory: await this.profileMemory(),
latency: await this.profileLatency(),
io: await this.profileIO(),
neural: await this.profileNeuralOps()
};
// Detect bottlenecks
this.bottlenecks = await this.detectBottlenecks(profile);
return {
profile,
bottlenecks: this.bottlenecks,
recommendations: await this.generateOptimizations()
};
}
async profileCPU() {
return {
usage: await this.getCPUUsage(),
cores: await this.getCoreUtilization(),
hotspots: await this.identifyCPUHotspots(),
recommendations: []
};
}
async profileMemory() {
return {
heapUsed: process.memoryUsage().heapUsed,
heapTotal: process.memoryUsage().heapTotal,
external: process.memoryUsage().external,
gcStats: await this.getGCStats(),
leaks: await this.detectMemoryLeaks()
};
}
async profileLatency() {
const measurements = [];
// Measure various operation latencies
const operations = [
{ name: 'mcp_call', fn: this.measureMCPLatency },
{ name: 'memory_store', fn: this.measureMemoryLatency },
{ name: 'neural_inference', fn: this.measureNeuralLatency },
{ name: 'hnsw_search', fn: this.measureHNSWLatency }
];
for (const op of operations) {
const latencies = await op.fn.call(this, 100); // 100 samples
measurements.push({
operation: op.name,
p50: this.percentile(latencies, 50),
p95: this.percentile(latencies, 95),
p99: this.percentile(latencies, 99),
max: Math.max(...latencies),
mean: latencies.reduce((a, b) => a + b, 0) / latencies.length
});
}
return measurements;
}
async detectBottlenecks(profile) {
const bottlenecks = [];
// CPU bottleneck
if (profile.cpu.usage > this.thresholds.cpuUsage) {
bottlenecks.push({
type: 'CPU',
severity: 'HIGH',
current: profile.cpu.usage,
threshold: this.thresholds.cpuUsage,
recommendation: 'Enable batch processing or parallelize operations'
});
}
// Memory bottleneck
const memUsagePercent = (profile.memory.heapUsed / profile.memory.heapTotal) * 100;
if (memUsagePercent > this.thresholds.memoryUsage) {
bottlenecks.push({
type: 'MEMORY',
severity: 'HIGH',
current: memUsagePercent,
threshold: this.thresholds.memoryUsage,
recommendation: 'Apply quantization (50-75% reduction) or increase heap size'
});
}
// Latency bottleneck
for (const measurement of profile.latency) {
if (measurement.p95 > this.thresholds.latencyP95) {
bottlenecks.push({
type: 'LATENCY',
severity: 'MEDIUM',
operation: measurement.operation,
current: measurement.p95,
threshold: this.thresholds.latencyP95,
recommendation: `Optimize ${measurement.operation} - consider caching or batching`
});
}
}
return bottlenecks;
}
}
结构与判定逻辑:
- 阈值表:CPU 占用 80%、内存占用 85%、延迟 P95 100ms、P99 200ms、GC 停顿 50ms。注意
latencyP95: 100与目标表中"MCP Response <100ms"是同一量纲,说明剖析阈值与验收目标是打通的; - 五维采集:
profileSystem依次采集 cpu、memory、latency、io、neural 五个剖面,延迟剖面覆盖mcp_call、memory_store、neural_inference、hnsw_search四个操作,每个操作采样 100 次,统计 p50/p95/p99/max/mean; - 分级建议:CPU 与内存超标判定为
HIGH级(CPU 建议批处理或并行化,内存建议量化或扩堆),延迟超标判定为MEDIUM级并建议缓存/批量化。每个瓶颈对象都携带current/threshold数值对,可直接用于生成报告。
八、核心能力四:Token 用量优化(50-75% 削减)
// Token Usage Optimizer
class TokenOptimizer {
constructor() {
this.strategies = {
quantization: { reduction: '50-75%', methods: ['int8', 'int4', 'mixed'] },
pruning: { reduction: '20-40%', methods: ['magnitude', 'structured'] },
distillation: { reduction: '60-80%', methods: ['student-teacher'] },
caching: { reduction: '30-50%', methods: ['kv-cache', 'prompt-cache'] }
};
}
async optimizeTokenUsage(model, config = {}) {
const optimizations = [];
// 1. Quantization
if (config.enableQuantization !== false) {
optimizations.push(await this.applyQuantization(model, config.quantization));
}
// 2. KV-Cache optimization
if (config.enableKVCache !== false) {
optimizations.push(await this.optimizeKVCache(model, config.kvCache));
}
// 3. Prompt caching
if (config.enablePromptCache !== false) {
optimizations.push(await this.enablePromptCaching(model, config.promptCache));
}
// 4. Attention pruning
if (config.enablePruning !== false) {
optimizations.push(await this.pruneAttention(model, config.pruning));
}
return {
optimizations,
expectedReduction: this.calculateTotalReduction(optimizations),
memoryImpact: this.estimateMemoryImpact(optimizations)
};
}
async applyQuantization(model, config = {}) {
const method = config.method || 'int8';
return {
type: 'QUANTIZATION',
method: method,
reduction: method === 'int4' ? '75%' : '50%',
precision: {
int4: { bits: 4, reduction: 0.75 },
int8: { bits: 8, reduction: 0.50 },
mixed: { bits: 'variable', reduction: 0.60 }
}[method],
layers: config.layers || 'all',
skipLayers: config.skipLayers || ['embedding', 'lm_head']
};
}
async optimizeKVCache(model, config = {}) {
return {
type: 'KV_CACHE',
strategy: config.strategy || 'sliding_window',
windowSize: config.windowSize || 4096,
reduction: '30-40%',
implementations: {
sliding_window: 'Fixed-size attention window',
paged_attention: 'Memory-efficient paged KV storage',
grouped_query: 'Grouped query attention (GQA)'
}
};
}
// Analyze current token usage
async analyzeTokenUsage(operations) {
const analysis = {
totalTokens: 0,
breakdown: [],
inefficiencies: [],
recommendations: []
};
for (const op of operations) {
const tokens = await this.countTokens(op);
analysis.totalTokens += tokens.total;
analysis.breakdown.push({
operation: op.name,
inputTokens: tokens.input,
outputTokens: tokens.output,
cacheHits: tokens.cached || 0
});
// Detect inefficiencies
if (tokens.input > 1000 && tokens.cached === 0) {
analysis.inefficiencies.push({
operation: op.name,
issue: 'Large uncached input',
suggestion: 'Enable prompt caching for repeated patterns'
});
}
}
return analysis;
}
}
四类策略及其削减幅度:量化 50-75%(int8/int4/mixed)、剪枝 20-40%(magnitude/structured)、蒸馏 60-80%(student-teacher)、缓存 30-50%(kv-cache/prompt-cache)。参数细节值得注意:
applyQuantization默认int8,int4对应 75% 削减、int8对应 50%、mixed约 60%;默认skipLayers: ['embedding', 'lm_head']——即嵌入层与语言模型头不参与量化,这是量化实践中常见的"保精度"做法;optimizeKVCache默认策略sliding_window、窗口 4096,并列出sliding_window/paged_attention/grouped_query(GQA)三种实现供选择;analyzeTokenUsage内置一条启发式规则:输入 token 超过 1000 且缓存命中为 0 的操作即判定为"大而未缓存"的浪费,建议启用 prompt caching。
九、核心能力五:延迟分析与优化
// Latency Analyzer and Optimizer
class LatencyOptimizer {
constructor() {
this.targets = {
mcp_response: 100, // ms - V3 target
neural_inference: 50, // ms
memory_search: 10, // ms - HNSW target
sona_adaptation: 0.05 // ms - V3 target
};
}
async analyzeLatency(component) {
const measurements = await this.collectLatencyMeasurements(component, 1000);
return {
component,
statistics: {
mean: this.mean(measurements),
median: this.percentile(measurements, 50),
p90: this.percentile(measurements, 90),
p95: this.percentile(measurements, 95),
p99: this.percentile(measurements, 99),
max: Math.max(...measurements),
min: Math.min(...measurements),
stdDev: this.standardDeviation(measurements)
},
distribution: this.createHistogram(measurements),
meetsTarget: this.checkTarget(component, measurements),
optimizations: await this.suggestOptimizations(component, measurements)
};
}
async suggestOptimizations(component, measurements) {
const optimizations = [];
const p99 = this.percentile(measurements, 99);
const target = this.targets[component];
if (p99 > target) {
// Tail latency is too high
optimizations.push({
type: 'TAIL_LATENCY',
current: p99,
target: target,
suggestions: [
'Enable request hedging for p99 reduction',
'Implement circuit breaker for slow requests',
'Add adaptive timeout based on historical latency'
]
});
}
// Component-specific optimizations
switch (component) {
case 'mcp_response':
optimizations.push({
type: 'MCP_OPTIMIZATION',
suggestions: [
'Enable connection pooling',
'Batch multiple tool calls',
'Use stdio transport for lower latency',
'Implement request pipelining'
]
});
break;
case 'memory_search':
optimizations.push({
type: 'HNSW_OPTIMIZATION',
suggestions: [
'Increase ef_construction for better graph quality',
'Tune M parameter for memory/speed tradeoff',
'Enable SIMD distance calculations',
'Use product quantization for large datasets'
],
expectedImprovement: '150x-12,500x with HNSW'
});
break;
case 'sona_adaptation':
optimizations.push({
type: 'SONA_OPTIMIZATION',
suggestions: [
'Use Micro-LoRA (rank-2) for fastest adaptation',
'Pre-compute pattern embeddings',
'Enable SIMD for vector operations',
'Cache frequently used patterns'
],
target: '<0.05ms'
});
break;
}
return optimizations;
}
}
该能力把目标表中的延迟指标细化到组件级:mcp_response 100ms、neural_inference 50ms、memory_search 10ms(HNSW)、sona_adaptation 0.05ms。分析流程是"1000 次采样 → 八项统计量(mean/median/p90/p95/p99/max/min/stdDev)+ 直方图 → 目标判定 → 建议生成"。
两条建议链值得记住:
- 通用尾延迟链:当 p99 超过目标时,按"请求对冲(request hedging)→ 熔断器(circuit breaker)→ 自适应超时"的顺序给出;
- 组件专属链:MCP 响应建议连接池、工具调用批处理、stdio 传输、请求流水线;内存检索建议调
ef_construction、M参数、SIMD 距离计算、乘积量化(PQ),并明确标注 HNSW 的预期收益区间 150x-12,500x;SONA 适配建议 Micro-LoRA(rank-2)、预计算模式嵌入、SIMD、模式缓存。
十、核心能力六:内存占用削减
// Memory Footprint Optimizer
class MemoryOptimizer {
constructor() {
this.reductionTargets = {
quantization: 0.50, // 50% reduction with int8
pruning: 0.30, // 30% reduction
sharing: 0.20, // 20% reduction with weight sharing
compression: 0.40 // 40% reduction with compression
};
}
async optimizeMemory(model, constraints = {}) {
const currentUsage = await this.measureMemoryUsage(model);
const optimizations = [];
// 1. Weight quantization
if (!constraints.skipQuantization) {
optimizations.push(await this.quantizeWeights(model, {
precision: constraints.precision || 'int8',
calibrationSamples: 100
}));
}
// 2. Activation checkpointing
if (!constraints.skipCheckpointing) {
optimizations.push(await this.enableCheckpointing(model, {
strategy: 'selective', // Only checkpoint large activations
threshold: 1024 * 1024 // 1MB
}));
}
// 3. Memory pooling
optimizations.push(await this.enableMemoryPooling({
poolSize: constraints.poolSize || 100 * 1024 * 1024, // 100MB
blockSize: 4096
}));
// 4. Garbage collection optimization
optimizations.push(await this.optimizeGC({
maxPauseMs: 10,
idleTime: 5000
}));
const newUsage = await this.measureMemoryUsage(model);
return {
before: currentUsage,
after: newUsage,
reduction: 1 - (newUsage.total / currentUsage.total),
optimizations,
meetsTarget: (1 - (newUsage.total / currentUsage.total)) >= 0.50
};
}
async quantizeWeights(model, config) {
const precision = config.precision;
const reductionMap = {
'int4': 0.75,
'int8': 0.50,
'fp16': 0.50,
'bf16': 0.50
};
return {
type: 'WEIGHT_QUANTIZATION',
precision: precision,
expectedReduction: reductionMap[precision] || 0.50,
calibration: config.calibrationSamples > 0,
recommendation: precision === 'int4' ?
'Best memory reduction but may impact quality' :
'Balanced memory/quality tradeoff'
};
}
}
执行管线为四步:权重量化(默认 int8,100 个校准样本)→ 激活检查点(selective 策略,1MB 阈值只检查点大激活)→ 内存池(默认 100MB 池、4096 块)→ GC 调优(最长停顿 10ms、空闲窗口 5000ms)。最终用优化前后的实测用量计算 reduction,并以 >= 0.50 作为 meetsTarget 判定——与 frontmatter 中 memory_reduction: "50-75%" 的下限一致。四种精度的预期削减映射为:int4 0.75、int8/fp16/bf16 各 0.50。
十一、核心能力七:批处理优化
// Batch Processing Optimizer
class BatchOptimizer {
constructor() {
this.optimalBatchSizes = {
embedding: 64,
inference: 32,
training: 16,
search: 100
};
}
async optimizeBatchProcessing(operations, constraints = {}) {
const optimizations = [];
for (const op of operations) {
const optimalBatch = await this.findOptimalBatchSize(op, constraints);
optimizations.push({
operation: op.name,
currentBatchSize: op.batchSize || 1,
optimalBatchSize: optimalBatch.size,
expectedSpeedup: optimalBatch.speedup,
memoryIncrease: optimalBatch.memoryIncrease,
configuration: {
size: optimalBatch.size,
dynamicBatching: optimalBatch.dynamic,
maxWaitMs: optimalBatch.maxWait
}
});
}
return {
optimizations,
totalSpeedup: this.calculateTotalSpeedup(optimizations),
recommendations: this.generateBatchRecommendations(optimizations)
};
}
async findOptimalBatchSize(operation, constraints) {
const baseSize = this.optimalBatchSizes[operation.type] || 32;
const maxMemory = constraints.maxMemory || Infinity;
let optimalSize = baseSize;
let bestThroughput = 0;
// Binary search for optimal batch size
let low = 1, high = baseSize * 4;
while (low <= high) {
const mid = Math.floor((low + high) / 2);
const metrics = await this.benchmarkBatchSize(operation, mid);
if (metrics.memory <= maxMemory && metrics.throughput > bestThroughput) {
bestThroughput = metrics.throughput;
optimalSize = mid;
low = mid + 1;
} else {
high = mid - 1;
}
}
return {
size: optimalSize,
speedup: bestThroughput / (await this.benchmarkBatchSize(operation, 1)).throughput,
memoryIncrease: await this.estimateMemoryIncrease(operation, optimalSize),
dynamic: operation.variableLoad,
maxWait: operation.latencySensitive ? 10 : 100
};
}
}
设计要点:
- 基准批量表:embedding 64、inference 32、training 16、search 100,未命中类型回退 32;
- 二分搜索最优点:在
[1, baseSize*4]区间内对批量做二分,用实测benchmarkBatchSize同时校验"内存不超maxMemory"与"吞吐超过当前最优"两个条件才向右收缩,否则左收; - 动态批处理参数:变负载操作开启
dynamicBatching,延迟敏感操作的maxWait取 10ms,其余取 100ms; - 加速比以 batch=1 的吞吐为分母归一化。
十二、核心能力八:并行执行策略
// Parallel Execution Optimizer
class ParallelExecutionOptimizer {
constructor() {
this.strategies = {
dataParallel: { overhead: 'low', scaling: 'linear' },
modelParallel: { overhead: 'medium', scaling: 'sub-linear' },
pipelineParallel: { overhead: 'high', scaling: 'good' },
tensorParallel: { overhead: 'medium', scaling: 'good' }
};
}
async optimizeParallelization(task, resources) {
const analysis = await this.analyzeParallelizationOpportunities(task);
return {
strategy: await this.selectOptimalStrategy(analysis, resources),
partitioning: await this.createPartitioningPlan(analysis, resources),
synchronization: await this.planSynchronization(analysis),
expectedSpeedup: await this.estimateSpeedup(analysis, resources)
};
}
async analyzeParallelizationOpportunities(task) {
return {
independentOperations: await this.findIndependentOps(task),
dependencyGraph: await this.buildDependencyGraph(task),
criticalPath: await this.findCriticalPath(task),
parallelizableRatio: await this.calculateParallelRatio(task)
};
}
async selectOptimalStrategy(analysis, resources) {
const cpuCores = resources.cpuCores || 8;
const memoryGB = resources.memoryGB || 16;
const gpuCount = resources.gpuCount || 0;
if (gpuCount > 1 && analysis.parallelizableRatio > 0.8) {
return {
type: 'DATA_PARALLEL',
workers: gpuCount,
reason: 'High parallelizable ratio with multiple GPUs',
expectedEfficiency: 0.85
};
}
if (analysis.criticalPath.length > 10 && cpuCores > 4) {
return {
type: 'PIPELINE_PARALLEL',
stages: Math.min(cpuCores, analysis.criticalPath.length),
reason: 'Long critical path benefits from pipelining',
expectedEfficiency: 0.75
};
}
return {
type: 'TASK_PARALLEL',
workers: cpuCores,
reason: 'General task parallelization',
expectedEfficiency: 0.70
};
}
// Amdahl's Law calculation
calculateTheoreticalSpeedup(parallelRatio, workers) {
// S = 1 / ((1 - P) + P/N)
const serialPortion = 1 - parallelRatio;
return 1 / (serialPortion + parallelRatio / workers);
}
}
策略选择是一个明确的决策树:
- 数据并行:GPU 数 >1 且并行化比率 >0.8,期望效率 0.85;
- 流水线并行:关键路径长度 >10 且 CPU 核数 >4,流水级数取
min(cpuCores, 关键路径长度),期望效率 0.75; - 兜底任务并行:按 CPU 核数切分,期望效率 0.70。
理论加速比直接实现了 Amdahl 定律 S = 1 / ((1-P) + P/N),为"期望效率"提供了可校验的上界依据。
十三、核心能力九:基准套件集成与 PASS/FAIL 判定
// V3 Performance Benchmark Suite
class V3BenchmarkSuite {
constructor() {
this.benchmarks = {
flash_attention: new FlashAttentionBenchmark(),
hnsw_search: new HNSWSearchBenchmark(),
wasm_simd: new WASMSIMDBenchmark(),
memory_ops: new MemoryOperationsBenchmark(),
mcp_latency: new MCPLatencyBenchmark(),
sona_adaptation: new SONAAdaptationBenchmark()
};
this.targets = {
flash_attention_speedup: { min: 2.49, max: 7.47 },
hnsw_improvement: { min: 150, max: 12500 },
memory_reduction: { min: 0.50, max: 0.75 },
mcp_response_ms: { max: 100 },
sona_adaptation_ms: { max: 0.05 }
};
}
async runFullSuite(config = {}) {
const results = {
timestamp: Date.now(),
config: config,
benchmarks: {},
summary: {}
};
// Run all benchmarks in parallel
const benchmarkPromises = Object.entries(this.benchmarks).map(
async ([name, benchmark]) => {
const result = await benchmark.run(config);
return [name, result];
}
);
const benchmarkResults = await Promise.all(benchmarkPromises);
for (const [name, result] of benchmarkResults) {
results.benchmarks[name] = result;
}
// Generate summary
results.summary = this.generateSummary(results.benchmarks);
// Store results in memory
await this.storeResults(results);
return results;
}
generateSummary(benchmarks) {
const summary = {
passing: 0,
failing: 0,
warnings: 0,
details: []
};
// Check flash attention
if (benchmarks.flash_attention) {
const speedup = benchmarks.flash_attention.speedup;
if (speedup >= this.targets.flash_attention_speedup.min) {
summary.passing++;
summary.details.push({
benchmark: 'Flash Attention',
status: 'PASS',
value: `${speedup.toFixed(2)}x speedup`,
target: `${this.targets.flash_attention_speedup.min}x-${this.targets.flash_attention_speedup.max}x`
});
} else {
summary.failing++;
summary.details.push({
benchmark: 'Flash Attention',
status: 'FAIL',
value: `${speedup.toFixed(2)}x speedup`,
target: `${this.targets.flash_attention_speedup.min}x minimum`
});
}
}
// Check HNSW search
if (benchmarks.hnsw_search) {
const improvement = benchmarks.hnsw_search.improvement;
if (improvement >= this.targets.hnsw_improvement.min) {
summary.passing++;
summary.details.push({
benchmark: 'HNSW Search',
status: 'PASS',
value: `${improvement}x faster`,
target: `${this.targets.hnsw_improvement.min}x-${this.targets.hnsw_improvement.max}x`
});
}
}
// Check MCP latency
if (benchmarks.mcp_latency) {
const p95 = benchmarks.mcp_latency.p95;
if (p95 <= this.targets.mcp_response_ms.max) {
summary.passing++;
summary.details.push({
benchmark: 'MCP Response',
status: 'PASS',
value: `${p95.toFixed(1)}ms p95`,
target: `<${this.targets.mcp_response_ms.max}ms`
});
}
}
// Check SONA adaptation
if (benchmarks.sona_adaptation) {
const latency = benchmarks.sona_adaptation.latency;
if (latency <= this.targets.sona_adaptation_ms.max) {
summary.passing++;
summary.details.push({
benchmark: 'SONA Adaptation',
status: 'PASS',
value: `${latency.toFixed(3)}ms`,
target: `<${this.targets.sona_adaptation_ms.max}ms`
});
}
}
summary.overallStatus = summary.failing === 0 ? 'PASS' : 'FAIL';
return summary;
}
}
这是整个 Agent 的"验收闸口":
- 六个基准并行执行(
Promise.all):flash_attention、hnsw_search、wasm_simd、memory_ops、mcp_latency、sona_adaptation; - 判定规则逐条对应目标矩阵:Flash Attention 以
>= 2.49x为下限判 PASS、HNSW 以>= 150x判 PASS、MCP 延迟以 p95<= 100ms判 PASS、SONA 以<= 0.05ms判 PASS; - 整体状态:
summary.failing === 0 ? 'PASS' : 'FAIL',任何单项失败即整体失败; - 结果同时
storeResults回 memory,供报告与趋势分析使用。
十四、MCP 集成:性能工具面
文档定义了 performanceMCP 对象,把基准、剖析、报告、Token 分析、WASM 优化、神经模式优化、指标存储七类操作映射到 mcp__claude-flow__* 工具:
// V3 Performance MCP Integration
const performanceMCP = {
// Run benchmark suite
async runBenchmarks(suite = 'all') {
return await mcp__claude-flow__benchmark_run({ suite });
},
// Analyze bottlenecks
async analyzeBottlenecks(component) {
return await mcp__claude-flow__bottleneck_analyze({
component: component,
metrics: ['latency', 'throughput', 'memory', 'cpu']
});
},
// Get performance report
async getPerformanceReport(timeframe = '24h') {
return await mcp__claude-flow__performance_report({
format: 'detailed',
timeframe: timeframe
});
},
// Token usage analysis
async analyzeTokenUsage(operation) {
return await mcp__claude-flow__token_usage({
operation: operation,
timeframe: '24h'
});
},
// WASM optimization
async optimizeWASM(operation) {
return await mcp__claude-flow__wasm_optimize({
operation: operation
});
},
// Neural pattern optimization
async optimizeNeuralPatterns() {
return await mcp__claude-flow__neural_patterns({
action: 'analyze',
metadata: { focus: 'performance' }
});
},
// Store performance metrics
async storeMetrics(key, value) {
return await mcp__claude-flow__memory_usage({
action: 'store',
key: `performance/${key}`,
value: JSON.stringify(value),
namespace: 'v3-performance',
ttl: 604800000 // 7 days
})
}
};
两点与仓库配置互相印证:
- settings.json 中
permissions.allow放行全部mcp__claude-flow__:*工具,即上表所有调用在默认权限策略下是允许的; storeMetrics使用namespace: 'v3-performance'、TTL 7 天(604800000ms),与 pre/post hook 中 memory store 使用的命名空间一致,形成统一的性能指标存储空间。关于工具扩展关系,v3-integration-architect.md 中的 MCP 工具映射表说明memory_usage是在 agentic-flow 的memory_store基础上扩展了 namespace、TTL、HNSW 能力,neural_train扩展了 ReasoningBank——这解释了性能 Agent 为何能通过 memory 工具间接获得 HNSW 检索加速。
仓库中另有配套的 slash 命令目录 commands/analysis/(含 performance-bottlenecks.md、performance-report.md、bottleneck-detect.md、token-usage.md、token-efficiency.md),与 MCP 工具面构成"命令 + 工具"的双入口。
十五、CLI 集成:性能命令集
文档给出的 CLI 命令全部基于 npx claude-flow@v3alpha(settings.json 的 Bash(npx claude-flow*) 权限白名单覆盖这些调用):
# Run full benchmark suite
npx claude-flow@v3alpha performance benchmark --suite all
# Profile specific component
npx claude-flow@v3alpha performance profile --component mcp-server
# Analyze bottlenecks
npx claude-flow@v3alpha performance analyze --target latency
# Generate performance report
npx claude-flow@v3alpha performance report --format detailed
# Optimize specific area
npx claude-flow@v3alpha performance optimize --focus memory
# Real-time metrics
npx claude-flow@v3alpha status --metrics --watch
# WASM SIMD benchmark
npx claude-flow@v3alpha performance benchmark --suite wasm-simd
# Flash attention benchmark
npx claude-flow@v3alpha performance benchmark --suite flash-attention
# Memory reduction analysis
npx claude-flow@v3alpha performance analyze --target memory --quantization int8
命令与能力的一一对应关系:
| 命令 | 对应能力 |
|---|---|
performance benchmark --suite all |
第九节的 V3BenchmarkSuite 全量执行 |
performance benchmark --suite wasm-simd / --suite flash-attention |
单项基准(WASM SIMD / Flash Attention) |
performance profile --component <comp> |
第七节 PerformanceProfiler 的组件级剖析 |
performance analyze --target latency / --target memory --quantization int8 |
延迟分析 / 内存削减分析(可指定量化精度) |
performance optimize --focus memory |
定向优化入口 |
performance report --format detailed |
详细报告生成 |
status --metrics --watch |
实时指标观察 |
十六、SONA 集成:从轨迹到可预测配置
// SONA-powered Performance Learning
class SONAPerformanceOptimizer {
constructor() {
this.trajectories = [];
this.learnedPatterns = new Map();
}
async learnFromOptimization(optimization, result) {
// Record trajectory
const trajectory = {
optimization: optimization,
result: result,
qualityScore: this.calculateQualityScore(result)
};
this.trajectories.push(trajectory);
// Trigger SONA learning if threshold reached
if (this.trajectories.length >= 10) {
await this.triggerSONALearning();
}
}
async triggerSONALearning() {
// Use SONA to learn optimization patterns
await mcp__claude-flow__neural_train({
pattern_type: 'optimization',
training_data: JSON.stringify(this.trajectories),
epochs: 10
});
// Extract learned patterns
const patterns = await mcp__claude-flow__neural_patterns({
action: 'analyze',
metadata: { domain: 'performance' }
});
// Store patterns for future use
for (const pattern of patterns) {
this.learnedPatterns.set(pattern.signature, pattern);
}
// Clear processed trajectories
this.trajectories = [];
}
async predictOptimalSettings(context) {
// Use SONA to predict optimal configuration
const prediction = await mcp__claude-flow__neural_predict({
modelId: 'performance-optimizer',
input: JSON.stringify(context)
});
return {
batchSize: prediction.batch_size,
parallelism: prediction.parallelism,
caching: prediction.caching_strategy,
quantization: prediction.quantization_level,
confidence: prediction.confidence
};
}
}
学习闭环分三步:
- 积累:
learnFromOptimization把每次优化动作与结果(含质量分)记入trajectories,累积到 10 条触发学习; - 训练:
triggerSONALearning调用neural_train(pattern_type: 'optimization',10 epochs),再用neural_patterns抽取domain: 'performance'的已学习模式,按signature建索引存入learnedPatterns,随后清空已处理轨迹; - 预测:
predictOptimalSettings通过neural_predict(modelId: 'performance-optimizer')对给定上下文输出batchSize/parallelism/caching/quantization/confidence五项推荐配置。
这一能力与 pre/post hooks 的 trajectory-start / trajectory-end 共同构成完整闭环:hooks 负责记录轨迹,SONAPerformanceOptimizer 负责消费轨迹。仓库中的 sona-learning-optimizer.md 从 Agent 侧描述了 SONA 机制本身:基于 LoRA 微调(99% 参数削减)、EWC++ 持续学习防止灾难性遗忘、模式检索(k=3 相似模式,761 次决策/秒),并给出了 Micro-LoRA 每向量 0.447ms 的基准特性——与本文档中"SONA 适配 <0.05ms"目标及"Micro-LoRA (rank-2)"建议相互呼应。
十七、最佳实践清单与集成点
文档末尾给出了一份可直接用作验收清单的优化检查表:
- Flash Attention:为所有 transformer 类模型启用;尽可能使用融合算子;以 2.49x-7.47x 为加速目标;
- WASM SIMD:为向量运算启用 SIMD;使用对齐内存访问;批量化操作以提升 SIMD 效率;
- 内存优化:应用 int8/int4 量化(50-75% 削减);启用梯度检查点;使用内存池做分配;
- 延迟削减:保持 MCP 响应 <100ms;使用连接池;尽量批量化工具调用;
- SONA 集成:追踪所有优化轨迹;从成功模式中学习;以 <0.05ms 适配时间为目标。
集成点部分定义了两个协作面:
- 与其他 V3 Agent:与 Memory Specialist 协调内存优化策略;与 Security Architect 确认性能变更不破坏安全性;与 SONA Learning Optimizer 共享已学习的优化模式。这与 guidance-hooks.sh 中"memory 任务归 memory-specialist、security 任务归 security-architect、performance 任务归 performance-engineer"的路由划分完全一致;
- 与 Swarm 协同:向协调器上报性能指标、优化 Agent 间通信模式、在 swarm agents 之间均衡负载。settings.json 中
swarm.topology: "hierarchical-mesh"、maxAgents: 15是该协同面的运行配置;v3-performance-optimization 技能 中的 SwarmBenchmarks 则把"15 Agent 协调"列为独立基准项(协调延迟、任务分解耗时、共识达成耗时三项测量)。
十八、小结:这套规格解决了什么问题
把 performance-engineer.md 放回仓库上下文,可以概括出它作为"Agent 规格"的四个层次:
- 目标层:frontmatter
metrics+ 正文目标表,给出五个可量化指标(Flash Attention 2.49x-7.47x、HNSW 150x-12,500x、内存 50-75%、MCP <100ms、SONA <0.05ms,另有 CLI 启动 <500ms),全部以目标值形式驱动后续校验,而非既成事实的实测数据; - 方法层:九大能力各配一段参考实现,从分块参数(blockSizeQ/KV)、量化策略(int4/int8/mixed 及 skipLayers)到批处理二分搜索、Amdahl 加速比公式,为 Agent 输出"可执行的优化配置"提供了结构约束;
- 验证层:V3BenchmarkSuite 用 PASS/FAIL 语义把基准结果映射回目标矩阵,任何单项失败即整体 FAIL;配套 SKILL 文档补充了 5% 回归阈值的连续回归检测与 500ms 冷启动门槛;
- 学习层:pre/post hooks 自动记录会话与 SONA 轨迹,
SONAPerformanceOptimizer以 10 条轨迹为一批触发训练,最终能对新上下文预测批量、并行度、缓存与量化配置。
对阅读该仓库的开发者而言,这份文档的价值在于展示了一种完整的"性能工程 Agent 化"范式:把性能目标写成可判定的矩阵、把优化手段写成结构化配置、把验收写成基准套件、把经验沉淀写成轨迹学习,并通过 settings.json 的 hooks、权限白名单与 daemon 调度(optimize 每 30 分钟、benchmark worker 常驻)在整个仓库的开发管线中持续运转。
atomcodeClaude Code 的开源替代方案。连接任意大模型,编辑代码,运行命令,自动验证 — 全自动执行。用 Rust 构建,极致性能。 | An open-source alternative to Claude Code. Connect any LLM, edit code, run commands, and verify changes — autonomously. Built in Rust for speed. Get StartedRust0623
Hy4-previewHy4 preview 是由腾讯混元团队研发的新一代混合专家(MoE)旗舰模型。模型总参数量 770B,每个 token 激活 49B,主干共包含78层,第一层采用标准 FFN,其余 77 层均为 MoE 结构,每层包含 256 个路由专家与 1 个共享专家,每个 token 激活 top-8 路由专家及共享专家。主干之外原生内置 1 层 MTP(总参数量 10B,激活 0.7B)以支持投机解码。Python00
GLM-5.3GLM-5.3 与 GLM-5.2 使用相同的基座模型——所有提升均来自后训练。与 GLM-5.2 相比,它在复杂编程和长程任务上的表现显著提升。Jinja00
GLM-5.3-FlashGLM-5.3-Flash (320B-A18B),是GLM-5系列的首个原生多模态模型。320B总参数,能力超过GLM-5.2Jinja00
Spark-X2.5-4BSpark-X2.5-4B 旨在让强大的 AI 更实用、更高效、更易获得。在广泛日常任务中表现强劲,涵盖对话、写作、翻译、推理、编码、工具调用以及智能体工作流,并在同等规模的开源模型中取得领先成绩。Spark-X2.5 将面向效率的架构与最高 1M tokens 的原生上下文窗口相结合,并支持 200 多种语言。Python00
Spark-X2.5-1.7BSpark-X2.5-1.7B 旨在让强大的 AI 更加实用、高效且易于获取。这些模型在广泛的日常任务中表现出色,涵盖对话、写作、翻译、推理、编程、工具调用和智能体工作流,并在同等规模的开源模型中取得领先结果。Spark-X2.5 将面向效率的架构与最高 1M tokens 的原生上下文窗口相结合,并支持 200 多种语言。Python00