表示
超・人工知能研究所 Super AI Research Lab トップへ超・人工知能研究所AI Research Lab / ぱそ太郎工事中

since
平成38年9月29日

← 検索結果に戻る

画像モデルの高速化へ、MLPは重みを移し注意機構は出力を学ぶ

Copy the Same, Distill the Difference

保存した記事を見るこのブラウザに保存します。無料会員で端末間の同期・フォルダ整理
原論文の図

通常の注意機構から線形の注意機構へ変えるとき、どの知識を移せるかを示す図です。MLPの重みはコピーし、注意機構の振る舞いは出力をまねる学習で移す、という役割分担に注目してください。

原論文の図の説明を読む

Figure 1: What survives the Softmax-to-linear boundary? We ask whether linear ViTs can benefit from pre-trained Softmax weights for initialization. We find that the attention weights are operator-specific that copying them barely helps. Their token routing behavior can instead be recovered by distilling the attention outputs, while the operator-agnostic MLP weights, which carry the learned representation, can be simply transferred by direct copying. Paired together, linear ViTs can match and even surpass the Softmax ones, consistently across diverse settings.

出典:Copy the Same, Distill the Difference / arXiv ↗

概要

  • Softmax ViTの注意重みを線形ViTへ直接コピーしても、安定した改善は得られなかった。
  • 著者らはMLP重みのコピーと注意出力の蒸留を組み合わせ、複数条件で元モデルに並ぶ精度を報告した。
  • 実用判断には対象画像での分類精度に加え、推論速度と追加学習時間の実測が必要である。
補足:編集した模式図で仕組みを確認する

VISUAL EXPLAINER

図でつかむ、Copy the Same, Distill the Differenceの仕組み

左から右へ読む
  1. 01学習済み画像モデル
  2. 02MLPの重みをコピー
  3. 03注意出力を蒸留
  4. 04線形ViTの予測

原論文の説明をもとにした模式図です。処理の細部は省略しています。

研究の背景

画像Transformer(ViT)は画像を小さな領域の列として扱い、注意機構で領域間の情報を結び付ける。一般的なSoftmax注意では、領域数が増えると計算量が大きくなる。線形注意は計算の増え方を抑える設計だが、初めから学習させる負担や精度差が課題になる。

すでに学習済みのSoftmax ViTの重みを再利用できれば、線形版を作る際の出発点になる。ただし注意の計算方法が変わるため、どの重みを移せるかは部品別に確かめる必要がある。

手法

まず学習済みSoftmax ViTを教師とし、線形注意を使うViTを生徒として用意する。MLPは各領域の情報を変換する層で、その重みを教師から生徒へ直接コピーする。画像を入力したとき、教師と生徒の注意機構が出す値を近づける損失を加えて学習する。これを蒸留という。

例えば画像分類では、同じ画像を両モデルに通し、各層の注意出力の差と分類の誤りをもとに生徒を更新する。注意マップそのものではなく出力を合わせるのは、線形注意の方式によってマップが異なり、明示的なマップを作らない方式もあるためだ。

新規性

この研究は、学習済みの画像Transformerから線形版へ移す際、部品ごとに適した移し方が異なると示した。注意機構の重みをそのままコピーしても安定した利点はなく、注意機構の出力を教師に合わせる蒸留の方が有効だった。

一方、MLPの重みは直接コピーするだけで学習済みモデルの利点の多くを運べた。両者を組み合わせる設計を、複数の線形注意方式とモデル規模で検証している。

従来手法との違い

比較の基準は、線形ViTをランダム初期化して学習する場合と、同じ規模の学習済みSoftmax ViTである。注意機構だけをコピーする方法は、ランダム初期化と同程度か、それを下回る場合もあった。MLPだけをコピーすると各データセットで改善し、注意出力の蒸留を加えるとさらに差が縮んだ。

蒸留では、トークン間の対応を示す注意マップを合わせる案も比べている。線形方式によってマップの性質が異なるため、著者らは注意機構が実際に出した値を合わせる方が汎用的だと結論付けた。

実験結果

著者らは5種類の線形ViTをTiny、Small、Baseの規模で調べ、CIFAR-10、CIFAR-100、STL-10、Food、Flowers、PetsとImageNet-1Kを使った。結果は3つの乱数シードの平均で示す。注意重みだけのコピーは、どの方式でも最良の初期化にはならず、ランダム初期化を下回る例もあった。

ViT-BaseのImageNet-1Kでは、例えばReLU方式の正解率がランダム初期化76.5%、DeiT由来の注意重みコピー75.6%だった。MLPコピーと注意出力の蒸留の組み合わせは、複数条件でSoftmax版に並び、一部では上回ったと著者らは報告する。

応用の可能性

編集上の応用案 · 論文が実証した用途とは区別しています。

編集上の応用案:製造ラインの外観検査画像を分類するモデルの初期化に使う。入力は撮影画像、出力は検査対象の分類結果とする。既存の学習済みSoftmax ViTを教師にし、線形ViTへMLPの重みを移した上で、注意機構の出力を教師に近づけて学習する。

高解像度画像を扱う場合に推論時間が改善するかは、この用途の画像サイズと実装で測る。欠陥の見逃しに関わるクラスごとの精度も記録し、全体の正解率だけでは採用を決めない。

応用先の候補からNauhに相談できます。

導入時の検証

導入時の検証案 · 対象データでの再評価が必要です。

導入時の検証案:手元の分類画像を学習用と評価用に分け、同じ線形ViTでランダム初期化、注意重みだけのコピー、MLPコピー、MLPコピーと注意出力の蒸留を比較する。元のSoftmax ViTも基準に置く。正解率はクラスごとにも記録する。

画像サイズ別の推論時間とメモリ使用量、追加学習にかかった時間を測る。分布の異なる撮影条件も評価に含める。蒸留で精度が戻っても、対象環境で速度が改善しないなら、その用途での導入効果は限定的と判断する。

限界と課題

著者らは、注意機構の出力を蒸留するだけでは、細かな分類を要するFlowersで学習済みSoftmaxモデルとの差が残る例を示した。MLPのコピーがその差を縮める結果はあるが、すべての構成とデータで必ず元モデルを超えるという主張ではない。

編集上の確認点は、対象画像の解像度で理論上の計算量削減が実測速度やメモリ削減に結び付くか、分布が変わった画像でも精度が保たれるかである。教師モデルによる蒸留に必要な学習時間も、初期化の利点と合わせて測る。

応用先の候補
研究内容と応用案に基づく分類です。業界での導入実績を示すものではありません。

出典

元のタイトル・要旨を確認する(英語)

Copy the Same, Distill the Difference: Initializing Linear Vision Transformers

Linear Vision Transformers (ViTs) are designed to replace the attention in Softmax ViTs with the linear-complexity attention operator for more efficient token routing, but they require from-scratch pre-training and typically underperform the original Softmax version. How to initialize linear ViTs both efficiently and effectively still remains unclear. In this work, we explicitly ask: given that most foundation ViTs are built on the mainstream Softmax attention, can linear ViTs benefit from their pre-trained weights? Recent works on Attention Transfer show that attention is the effective transferable component between Softmax ViTs, suggesting attention alone suffices for such reuse. However, we find the opposite for Softmax-to-linear transfer. The attention weights are operator-specific: copying them barely helps, and is sometimes even worse than random initialization. Instead, the attention's token routing behavior can be recovered through distillation with a proper loss design, letting linear ViTs reduce the gap and even match Softmax ones. In contrast, the MLP weights, which carry the learned representation, are operator-agnostic: they can be transferred by simple direct copying, which already carries most of the benefit of the pre-trained weights. Thus, copying MLPs can serve as an effective foundation for Softmax-to-linear transfer: paired with the distilled attention, linear ViTs eventually close the remaining gap and even surpass Softmax ones. These findings hold consistently across various linear ViT variants, different model sizes, and diverse datasets. We hope this study deepens the understanding of reusing pre-trained weights across attention operators: copy what stays the same and distill what differs, to recover the benefit across the Softmax-to-linear boundary.

論文本体の取得範囲に基づく解説。AIが作成した未校閲の記事です。性能の数値は著者の評価条件に依存します。応用例と検証計画は編集上の提案です。解説更新:2026-09-29