language-models quantization pruning low-rank-factorization circuit-design boltzmann-machine fixed-weight-chips twig
Abstract
We introduce TWIG (Tree-structured Weights with Inherited Gates), a representation in which every weight of a neural network is the end of a path of small discrete decisions: a sign, a shift by a power of two, a zero gate, an index into a shared table. Weights that belong together share the upper part of their paths, and each decision is inherited by every weight below it, so it is stored once and applied once. This simple change has three consequences. Any trained network can be written as a TWIG, and when the decisions are powers of two its weight layers become circuits made almost entirely of wires and adders, suited to chips whose weights are fixed at fabrication. Pruning, quantization, low-rank factorization, codebooks and weight sharing become edits of one object, so a single optimizer can choose among all of them for a whole network. And choosing the decisions is the ground-state problem of a higher-order Boltzmann machine whose interactions follow the paths of the tree, the problem class that annealers and quantum optimizers are built to solve. Today these questions are handled apart: each compression method brings its own format and solver, a circuit with fixed weights needs a dedicated constant multiplier for every weight, and discrete solvers reach only narrow subproblems such as rounding. Weight formats have long been moving toward shared decisions, through group scales, shared exponents, microexponents and sparse weights; TWIG takes this trend to its end, and every common format is a shallow TWIG at no extra cost. On five weight matrices of a large language model, a flat tree whose signed power-of-two terms are chosen per weight for circuit cost, with no group scales, needs 9--15\% fewer additions than GPTQ at equal layer error at 3- and 4-bit accuracy on typical matrices, and 20--55\% fewer on matrices with strong outliers.
한국어 요약
한 줄 요약
TWIG는 신경망 가중치를 공유된 이산 결정 경로로 표현하여 압축, 회로 구현, 최적화 문제를 통합하는 새로운 가중치 표현 방식이다.
핵심 기여도
- TWIG는 가중치를 이진 결정 경로로 표현하여, 가중치 공유, 회로 최적화, 이산 최적화 문제를 통합적으로 처리할 수 있다.
- 3-4비트 정확도에서 GPTQ 대비 9–15% 적은 덧셈 연산으로 동일한 계층 오차를 달성. 이상치가 많은 가중치 행렬에서는 20–55% 적은 덧셈 연산.
- 가중치 압축, 퀀티제이션, 로우랭크 인수분해, 코드북, 가중치 공유를 동일한 객체로 편집 가능.
- 이산 결정 선택 문제는 고차 Boltzmann 기계의 바닥상태 문제로 모델링되어, 어닐러와 퀀텀 최적화기와 호환.
핵심 아이디어
TWIG는 가중치를 이진 결정 경로로 표현하는 새로운 구조를 제안한다. 각 가중치는 부호, 2의 거듭제곱 이동, 제로 게이트, 공유 테이블 인덱스 등 작은 이산 결정의 경로 끝에 위치하며, 공유된 상위 결정은 여러 가중치에 상속된다. 이는 가중치 표현의 중복을 제거하고, 회로 구현, 최적화 문제를 통합적으로 다룰 수 있게 한다. 기존의 가중치 압축 방식(그룹 스케일, 공유 지수, 코드북 등)은 TWIG의 얕은 형태로 포함되며, TWIG는 이러한 트렌드를 극한까지 발전시킨다.
기술적 접근법
- TWIG는 가중치 행렬의 각 항목을 트리 구조로 표현. 트리의 내부 노드는 2의 거듭제곱 이동, 부호, 제로 게이트, 공유 테이블 인덱스 등 작은 결정을 저장.
- 가중치는 경로 상의 결정의 곱으로 표현되며, 공유된 결정은 여러 가중치에 상속되어 저장 및 적용이 단일화됨.
- 회로 구현 시, 2의 거듭제곱 이동은 단순히 와이어 라우팅으로 처리되어, 덧셈기와 와이어로 구성된 회로를 생성.
- 최적화 문제는 고차 Boltzmann 기계의 바닥상태 문제로 모델링되며, 경로 상의 상호작용이 결정됨.
- GPTQ 대비 3-4비트 정확도에서 9–15% 적은 덧셈 연산을 요구하며, 이상치가 많은 행렬에서는 20–55% 적은 덧셈 연산.
주요 결과
- 5개의 대형 언어 모델 가중치 행렬에서, TWIG는 GPTQ 대비 3-4비트 정확도에서 9–15% 적은 덧셈 연산으로 동일한 계층 오차를 달성.
- 이상치가 많은 행렬에서는 20–55% 적은 덧셈 연산.
- TWIG는 기존의 가중치 압축 방식(그룹 스케일, 공유 지수, 코드북 등)을 얕은 트리 형태로 포함하며, 추가 비용 없이 적용 가능.
- 가중치 압축, 퀀티제이션, 로우랭크 인수분해, 코드북, 가중치 공유를 동일한 객체로 편집 가능.
의의 및 한계
TWIG는 가중치 표현의 이산성과 공유 구조를 명시적으로 모델링하여, 압축, 회로 구현, 최적화 문제를 통합적으로 다룰 수 있는 새로운 접근법을 제시한다. 이는 기존의 별도 압축 방식을 통합하고, 회로 구현에서 덧셈기와 와이어로 구성된 효율적인 회로를 생성할 수 있다. 또한, 고차 Boltzmann 기계를 활용한 이산 최적화 문제로 모델링되어, 어닐러와 퀀텀 최적화기와 호환된다. 그러나 TWIG는 아직 대규모 모델에서의 성능 검증이 제한적이며, 트리 구조의 깊이와 복잡도가 증가할 경우 최적화 난이도가 높아질 수 있다.
실용적 활용
TWIG는 고정 가중치 회로(예: 프린트된 분류기, 언어 모델 하드웨어)에서 효율적인 덧셈기 기반 회로 구현에 적합하며, 가중치 압축, 퀀티제이션, 코드북, 가중치 공유를 통합적으로 관리할 수 있어, 모델 압축 및 최적화 연구, FPGA 또는 ASIC 기반의 고정 가중치 회로 설계에 활용 가능하다.