HyperAIHyperAI

Command Palette

Search for a command to run...

LLM
تونغي تشيانوين

Tree-Ising: إصلاح نماذج اللغة بتعديلات آيزينغ على مستوى البت

Hadi Salloum Ammar Ali

الملخص

تتيح البرمجة في فضاء الأوزان، التي استُحدثت في عمل حديث من MIT لـ Takehi وآخرين، لوكيل متقدم من نماذج اللغة الكبيرة قراءة أوزان الشبكة وكتابة إصلاح لها. وقد صحّح وكيلهم GPT-6 Astra حلقات الاستدلال في النموذج Qwen3.5-0.8B دون استخدام التدرجات، مستخدماً 158 دورة للوكيل و89.7 مليون رمز و50 طلب تمرير أمامي. يعيد أسلوبنا TREE-ISING صياغة هذا الإصلاح بوصفه مسألة استمثال متقطعة متفرقة على الأوزان الأصلية للنموذج بصيغة BF16. ونستفيد من إحصاءات التمرير الأمامي لتعريف دالة هدف تُضعف اتجاه الحلقة، وتقوّي اتجاه الخاتمة، وتحافظ على خرج الطبقة عند الرموز المنتجة. وضمن تمثيل شجرة الحالات، حيث يُمثل التخزين غير المنقوص بصيغة BF16 حالةً خاصة، تتكون التعديلات المسموحة من قلبات إشارة وإزاحات أُسّية تحافظ على جميع الأسس المشتركة للمجموعات وأجزاء المانتيسا. ونُحلل دالة الهدف هذه تحليلاً تاماً إلى مسائل QUBO (آيزينغ) مستقلة، مسألة لكل صف من صفوف الخرج، ونحلها على وحدة معالجة رسوميات باستخدام التلدين المحاكى أو طريقة التشعب المحاكى المستوحاة من الحوسبة الكمومية. عند التقييم على الطبقتين اللتين استهدفهما الوكيل، يحقق TREE-ISING دقة 54.6% على MATH-500، متفوقاً على تعديل الوكيل (51.7%) وفق بروتوكول التقييم نفسه، في حين لا يحقق النموذج الأساسي سوى 7.9%. علاوة على ذلك، يُنتج حلّ طريقة التشعب المحاكى إصلاحاً غير قابل للتمييز إحصائياً عند 55.1%. والأهم أن كلا الحلّين يتفوقان على تعديل الوكيل عبر جميع المعايير الرياضية الخمسة، مع تحسينات ذات دلالة إحصائية على MATH-500 وGSM8K بعد تصحيح المقارنات المتعددة. إضافة إلى ذلك، يقلل نهجنا عدد الأوزان المعدلة بنسبة تتراوح بين 13% و17%، ويخفض قلبات البتات في BF16 بمعامل يتراوح بين 2.2 و2.3. وهو يتطلب أربعة طلبات تمرير أمامي فقط ولا يستهلك أي رموز من نماذج اللغة الكبيرة، وتبلغ تكلفة إجراء التلدين نحو 0.90 دولار من زمن وحدة معالجة الرسوميات. وبتوسيع هذا إلى Qwen3.5-2B، حيث تُختار الطبقات والجرعة باستخدام النموذج الأساسي فقط، يرفع الإجراء نفسه دقة GSM8K باستخدام التوليد الجشع من 21.6% إلى 69.4%. وأخيراً، بوصف ذلك إثباتاً للمفهوم، ننفذ مسألة فرعية للإصلاح ذات ثمانية متغيرات باستخدام QAOA على معالج IBM Heron.

One-sentence Summary

Researchers from QDeep, LEAD, and ITMO University propose TREE-ISING, which repairs language models by casting sparse discrete BF16 weight edits as row-wise QUBO (Ising) problems solved with simulated annealing or simulated bifurcation, achieving 54.6% on MATH-500 compared with 51.7% for the agent edit under the same evaluation protocol, using 13% to 17% fewer weights and zero LLM tokens, and lifting Qwen3.5-2B greedy GSM8K accuracy from 21.6% to 69.4%.

Key Contributions

  • TREE-ISING formulates LLM weight repair as a gradient-free, sparse discrete optimization over the model’s native BF16 weights, using a state-tree representation that restricts admissible edits to sign flips and exponent shifts preserving shared group exponents and mantissas. The forward-statistics objective is decomposed exactly into independent QUBO/Ising problems, one per output row, solved on a GPU via simulated annealing or simulated bifurcation.
  • On Qwen3.5-0.8B, TREE-ISING repairs the two layers targeted by the earlier GPT-6 Astra agent edit and reaches 54.6% on MATH-500 with simulated annealing; simulated bifurcation reaches a statistically indistinguishable 55.1%, versus 51.7% for the agent edit and 7.9% for the base model. Across all five math benchmarks, it outperforms the agent edit, modifies 13% to 17% fewer weights, reduces BF16 bit flips by a factor of 2.2 to 2.3, and requires only four forward-pass requests and zero LLM tokens at roughly $0.90 per run.
  • The same recipe is extended to Qwen3.5-2B, where selecting target layers and dose from the base model alone raises greedy GSM8K accuracy from 21.6% to 69.4%. A proof-of-concept QAOA experiment on an IBM Heron processor executes an eight-variable repair-derived Ising subproblem, indicating preliminary feasibility on quantum hardware.

Introduction

Weight-space programming has recently shown that a frontier LLM agent can directly edit another model’s weights to fix a common failure in small reasoning models: looping behavior that exhausts the token budget and sharply limits accuracy on benchmarks such as MATH-500. This matters because such failures are frequent in long reasoning traces, but the prior agent-based repair is expensive, heuristic, and provides no guarantee that the chosen edit is optimal. The authors formalize the repair as sparse discrete optimization over stored BF16 weights, representing the network with state trees and decomposing the problem into independent row-wise Ising models. Their method, TREE-ISING, uses forward statistics to select layers and define an objective, then solves the resulting Ising problems with GPU annealers or quantum-inspired solvers, producing a more accurate and substantially cheaper repair than the agent baseline.

Method

The authors propose TREE-ISING, a method that edits frozen MLP output projections W∈Rd×nW \in \mathbb{R}^{d \times n}W∈Rd×n to correct reasoning loops in language models. They cast this weight-space programming task as a discrete optimization problem comprising five key steps.

As shown in the figure below:

Step 1: QUBO-friendly representation of the weights The authors represent the weights using state trees, which unify low-bit compression and exact storage. For lossless BF16 storage, 64 consecutive weights in a row share a maximum exponent EEE. Each weight stores a 4-bit state D=E−eD = E - eD=E−e and a leaf containing its sign and mantissa. Edits are restricted to a set of admissible moves F={−1,2,12,4,−2,−4,−12,14}\mathcal{F} = \{-1, 2, \frac{1}{2}, 4, -2, -4, -\frac{1}{2}, \frac{1}{4}\}F={−1,2,21​,4,−2,−4,−21​,41​}. These moves preserve the shared exponent and avoid escapes, ensuring that an edit only alters the sign bit and the 4-bit state of a single weight. By preselecting one admissible move per candidate weight, the edit becomes a binary decision, conforming to the Quadratic Unconstrained Binary Optimization (QUBO) format.

Step 2: Selecting the layers To identify which layers to edit, the authors perform a forward layer scan. The base model generates answers, and teacher-forced passes record the residual stream, MLP output, and output projection input. They compute a target direction uℓu_\elluℓ​ combining a loop direction and an end direction:

uℓ,loop∝hˉℓ,R−hˉℓ,P,uℓ,end∝hˉℓ,Z−hˉℓ,M,uℓ∝uℓ,loop−βuℓ,endu_{\ell, \text{loop}} \propto \bar{h}_{\ell, \mathscr{R}} - \bar{h}_{\ell, \mathscr{P}}, \quad u_{\ell, \text{end}} \propto \bar{h}_{\ell, \mathscr{Z}} - \bar{h}_{\ell, \mathscr{M}}, \quad u_\ell \propto u_{\ell, \text{loop}} - \beta u_{\ell, \text{end}}uℓ,loop​∝hˉℓ,R​−hˉℓ,P​,uℓ,end​∝hˉℓ,Z​−hˉℓ,M​,uℓ​∝uℓ,loop​−βuℓ,end​

where β=0.5\beta = 0.5β=0.5. The write score of layer ℓ\ellℓ measures how much its MLP pushes the residual stream along uℓu_\elluℓ​ on loop tokens compared to productive ones:

sℓ=uℓ⊤(mˉℓ,R−mˉℓ,P)s_\ell = u_\ell^\top (\bar{m}_{\ell, \mathscr{R}} - \bar{m}_{\ell, \mathscr{P}})sℓ​=uℓ⊤​(mˉℓ,R​−mˉℓ,P​)

The selection rule targets the two highest-scoring layers, excluding the final layer.

As illustrated in the figure below:

Step 3: Defining the objective For a given edited layer, the objective minimizes the edit's dose (its effect along uuu on loop tokens) and collateral (its perturbation on protected tokens), plus a sparsity penalty:

E(Δ)=γdose⁡(Δ)+coll⁡(Δ)+λ∥Δ∥0\mathcal{E}(\Delta) = \gamma \operatorname{dose}(\Delta) + \operatorname{coll}(\Delta) + \lambda \|\Delta\|_0E(Δ)=γdose(Δ)+coll(Δ)+λ∥Δ∥0​

where dose⁡(Δ)=u⊤ΔμR\operatorname{dose}(\Delta) = u^\top \Delta \mu_{\mathscr{R}}dose(Δ)=u⊤ΔμR​ and coll⁡(Δ)=∑r=1dΔr:CPΔr:⊤\operatorname{coll}(\Delta) = \sum_{r=1}^d \Delta_{r:} C_{\mathscr{P}} \Delta_{r:}^\topcoll(Δ)=∑r=1d​Δr:​CP​Δr:⊤​. The parameter γ\gammaγ ensures the edit achieves a target dose, while λ\lambdaλ restricts the edit to a specific budget of changed weights.

Step 4: Exact decomposition into row Ising models The objective decomposes exactly into independent problems per output row. The authors retain the KKK columns with the largest scores and preselect the best admissible factor for each. The row problem is formulated as a QUBO:

Er(x)=∑a=1Khaxa+∑a≠bJabxaxb\mathscr{E}_r(x) = \sum_{a=1}^K h_a x_a + \sum_{a \neq b} J_{ab} x_a x_bEr​(x)=a=1∑K​ha​xa​+a=b∑​Jab​xa​xb​

where hah_aha​ aggregates the dose, self-collateral, and sparsity cost, and JabJ_{ab}Jab​ represents the joint collateral. Substituting spins s=2x−1s = 2x - 1s=2x−1 transforms this energy into an Ising model.

Step 5: Solving the Ising models The authors solve the row problems using GPU simulated annealing or discrete simulated bifurcation (dSB). Prior to solving, they calibrate the sparsity weight λ\lambdaλ and perform a geometric bisection to find the smallest γ\gammaγ that reaches the target dose. The formulation remains solver-agnostic, allowing seamless integration with quantum annealers or QAOA.

Experiment

The experiments evaluate a discrete, low-footprint repair method applied to Qwen3.5 models: for Qwen3.5-0.8B, the recipe targets down_proj matrices in layers 15 and 19 and is compared with an LLM agent edit under a shared math-benchmark harness, showing that the repair improves accuracy and termination across benchmarks while reducing compute cost and weight-level changes. Ablations indicate that the directional objective, especially the concluding-direction term, drives most gains, and the discrete solver matches a continuous rank-one solution with far fewer modified weights. A transfer experiment on Qwen3.5-2B, with layers and dose selected autonomously from base-model statistics, substantially improves greedy GSM8K accuracy and reduces loop-driven truncation, confirming the recipe can operate without a reference edit. A quantum-hardware proof of concept shows a small repair-derived Ising instance can be encoded and sampled on an IBM Heron processor but does not demonstrate quantum advantage, while the stated limitations highlight the narrow failure-mode scope, surrogate-objective heuristics, and partial reliance on prior agent insights for the smaller model.

TREE-ISING improves MATH-500 accuracy over the LLM agent edit while reducing the share of answers truncated at the token cap. It also leads on benchmark comparisons and achieves large cost reductions, using no LLM tokens and requiring far fewer forward-pass requests, much less GPU time, and shorter wall-clock time. TREE-ISING attains a statistically significant accuracy gain over the agent edit on MATH-500. It leads on all five benchmarks, with two leads remaining significant after correction. It reduces truncated MATH-500 answers relative to the agent edit and needs no LLM tokens, while using far less compute and wall-clock time.

The repair procedure defines four token sets drawn entirely from the base model's own practice answers. A loop set captures positions after repeated 8-grams emerge, while protected, concluding, and continuing sets mark non-loop, completion-related, and earlier reasoning tokens. Contrasting mean residual directions across these sets yields a combined direction that suppresses looping and encourages the model to conclude. Loop tokens are collected only after a repetition onset, whereas protected tokens include pre-onset positions and all generated tokens from correct completed traces. Concluding tokens select the final reasoning positions before a correct end, while continuing tokens cover earlier reasoning positions in the same correct traces.

TREE-ISING edits outperform the agent edit across the evaluated benchmarks on Qwen3.5-0.8B, with the strongest and statistically robust gains on MATH-500 and GSM8K. The improvements are accompanied by lower token-cap cut rates, indicating that the edited model more often finishes reasoning within budget. The results also exceed the originally reported agent scores on four of five benchmark families. TREE-ISING with either solver achieves higher accuracy than the agent edit across all five benchmark families, with statistically significant gains on MATH-500 at four completions and GSM8K after correction. The TREE-ISING edits reach the token cap less often across every benchmark, with cut rates falling sharply on GSM8K and OlympiadBench and driving much of the accuracy improvement.

The fixed repair recipe uses far less computation than the agent's exhaustive discovery run, requiring four forward passes and no LLM tokens while the agent uses fifty forward passes and tens of millions of tokens. Forward-pass GPU time drops from over twelve hours to about twenty-two minutes, and overall wall-clock time drops from over fifteen hours to about half an hour. The comparison excludes method development costs and reflects efficient application of a known repair rather than the original discovery process. The fixed recipe reduces forward-pass GPU compute by 34-fold compared to the agent's discovery run. The fixed recipe completes in roughly half an hour of wall-clock time and requires zero LLM tokens, whereas the agent takes over fifteen hours and consumes nearly ninety million tokens.

Across both edited matrices, TREE-ISING edits have a smaller structural footprint than the agent edit. They change fewer weights, produce fewer BF16 and state-tree bit flips, and leave shared exponents and mantissas untouched. The stochastic-branch variant is slightly more compact than simulated annealing, while the agent edit performs many mantissa rewrites and shared-exponent shifts. TREE-ISING modifies fewer weights, with the stochastic-branch variant showing the smallest changed-weight count among the three edits. BF16 bit flips are reduced by more than half and state-tree bit flips by about fourfold relative to the agent edit. TREE-ISING makes no shared-exponent or mantissa changes, whereas the agent edit rewrites mantissas for nearly all touched weights and shifts over a thousand shared exponents. Sign flips are substantially more frequent under TREE-ISING, consistent with scaling and sign moves being part of its typical edits.

The experiments evaluate TREE-ISING against an LLM agent edit across several benchmarks, showing improved MATH-500 and GSM8K accuracy, fewer truncated answers, and stronger overall benchmark performance. A repair procedure built from the base model's own correct and looping traces produces a direction that suppresses repetition and encourages completion. The fixed repair recipe is substantially cheaper than the agent discovery run, requiring no LLM tokens and far less GPU and wall-clock time, while the resulting edits have a smaller structural footprint with fewer weight and bit flips and no shared-exponent or mantissa changes.


بناء الذكاء الاصطناعي بالذكاء الاصطناعي

من الفكرة إلى الإطلاق — سرّع تطوير الذكاء الاصطناعي الخاص بك مع المساعدة البرمجية المجانية بالذكاء الاصطناعي، وبيئة جاهزة للاستخدام، وأفضل أسعار لوحدات معالجة الرسومات.

البرمجة التعاونية باستخدام الذكاء الاصطناعي
وحدات GPU جاهزة للعمل
أفضل الأسعار

HyperAI Newsletters

اشترك في آخر تحديثاتنا
سنرسل لك أحدث التحديثات الأسبوعية إلى بريدك الإلكتروني في الساعة التاسعة من صباح كل يوم اثنين
مدعوم بواسطة MailChimp