BrainSurgery:用于模型编辑和升级的可复现且可靠的声明式权重操作
BrainSurgery: Reproducible and Flexible Declarative Weight Manipulations for Model Editing and Upcycling
AI总结:
提出BrainSurgery工具,通过声明式YAML计划实现神经网络检查点的鲁棒可复现张量操作,支持结构修改、数学变换和张量重塑,内置断言验证防止静默错误。
摘要:
随着深度学习模型规模的扩大,管理、检查和修改大型检查点变得越来越具有挑战性。研究人员经常需要更改模型权重以进行层重构、精度转换、低秩分解和架构调试,但这些工作流程通常依赖于脆弱的临时Python脚本。在这里,我们介绍BrainSurgery,一个用于对神经网络检查点进行鲁棒且可复现的“张量手术”的工具,并提供一个系统演示,涵盖从模型升级到LoRA提取的四个示例和三个案例研究。通过抽象存储格式和内存管理,BrainSurgery通过声明式YAML计划执行复杂的转换。它支持通过表达性正则表达式和结构定位进行结构修改、数学变换和张量重塑,同时内置断言验证张量形状、数据类型和值,以防止静默错误。我们期望BrainSurgery通过其可复现且经过验证的操作,为未来的研究提供坚实的基础。
英文摘要:
Checkpoint transformations such as model merging, precision casting, and low-rank rewriting are commonly implemented through Python code or separate task-specific tools. We present BrainSurgery, a tool that consolidates these operations into reusable declarative YAML plans over checkpoint tensors with built-in targeting, validation, diffing, and sharded export; a Web UI supports interactive inspection and plan construction. We compare BrainSurgery with three specialized systems across 13 settings, 11 benchmarks, 8 models, 4 architectures, and model sizes from 1.7B to 32B parameters. Without use-case-specific framework customization, BrainSurgery reproduces their model edits with comparable run cost, often lower memory usage, and close downstream performance. We further perform correctness, preservation, robustness, and scaling checks. Finally, a coding-agent study shows that agents can reliably generate and review BrainSurgery plans, which are substantially shorter and more structurally consistent than equivalent Python implementations. These results support BrainSurgery as a flexible alternative to maintaining separate tools for heterogeneous checkpoint-editing tasks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。