跳到正文
Cactus Engineering Blog·· 26 天前精选评分50

Cactus 详解 Needle 的 .cact 单文件格式与 2.125 比特量化

The .cact FormatNeedle ships as one file that the engine maps into memory and reads in place: a 196-byte header with the whole architecture, a nameless tensor directory, and Cactus-Quantised blobs at 2.125 bits per weight. What is in it, how the quantisation works, how the kernel reads it without ever unpacking, and how to parse it yourself in twenty lines.Parkirat Sandhu · September 18, 2026 · 9 min read

导读

Cactus 介绍其端侧模型 Needle 使用的 .cact 单文件格式:196 字节头部携带全部架构几何信息,无名张量目录按前向顺序排列,权重以 128 个一组做 Hadamard 旋转后按 Lloyd-Max 码本量化,CQ2 下每权重 2.125 比特。内核直接读取打包索引做查表与 sdot 累加,不展开权重,20 层 needle3.cact 为 29 MB、581 个张量。文中还给出用 struct 解析头部与目录的二十行 Python 代码,并说明同一容器可承载语音模型 Whistle。

推荐理由

原文拆解了 .cact 单文件格式的头部、目录与分组量化设计,并给出二十行解析代码,可迁移到自研端侧模型加载器。

来源:Cactus Engineering Blog · cactuscompute.com