arXiv:2606.09707cs.LGcs.CL2026-06

用声明式配置实现模型权重的可复现修改,避免脚本出错。

BrainSurgery: Reproducible and Reliable Declarative Weight Manipulations for Model Editing and Upcycling

论文配图:BrainSurgery: Reproducible and Reliable Declarative Weight Manipulations for Model Editing and Upcycling
图 1 · 摘自论文原文
  • 通过YAML配置文件定义权重操作,自动处理存储与内存。
  • 支持结构修改、数学变换和张量重塑,保障操作正确性。
  • 适合需要调试或升级模型的研究者,提升实验可复现性。

随着深度学习模型规模扩大,管理、检查和修改大型模型检查点变得愈发困难。研究者常需调整模型权重以实现层重组、精度转换、低秩分解和架构调试,但这些流程通常依赖脆弱的临时脚本。本文提出BrainSurgery,一种用于神经网络检查点的鲁棒且可复现的“张量手术”工具,通过声明式YAML计划执行复杂变换。它抽象了存储格式与内存管理,支持结构修改、数学运算和张量重塑,采用表达式匹配与结构定位,内置断言验证张量形状、数据类型和数值,防止隐性错误。系统演示涵盖四个示例和三个案例研究,涵盖模型升级至LoRA提取。我们相信,BrainSurgery将为未来研究提供可复现且经过验证的操作基础。

原文摘要 · Abstract (English)

As deep learning models scale, managing, inspecting, and modifying large checkpoints has become increasingly challenging. Researchers often need to alter model weights for layer restructuring, precision casting, low-rank factorization, and architectural debugging, yet these workflows often rely on fragile ad-hoc Python scripts. Here, we introduce BrainSurgery, a tool for robust and reproducible "tensor surgery" on neural network checkpoints, and provide a system demonstration covering four examples and three case studies from model upcycling to LoRA extraction. By abstracting storage formats and memory management, BrainSurgery executes complex transformations through declarative YAML plans. It supports structural modifications, mathematical transformations, and tensor reshaping through expressive regex and structural targeting, while built-in assertions validate tensor shapes, data types, and values to prevent silent errors. We envision that BrainSurgery will provide a strong foundation for future research through its reproducible and validated operations.

模型编辑权重修改可复现性

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。