[論文レビュー] Tree-to-tree Neural Networks for Program Translation
本研究では、親注意フィードバックを含む注意付きの木-対-木ニューラルネットワークを導入し、ソースのサブツリーをターゲットのサブツリーに対応づけてプログラムを翻訳する。CoffeeScript↔JavaScriptおよび Java→C# のベンチマークで state-of-the-art baselines を上回る。
Program translation is an important tool to migrate legacy code in one language into an ecosystem built in a different language. In this work, we are the first to employ deep neural networks toward tackling this problem. We observe that program translation is a modular procedure, in which a sub-tree of the source tree is translated into the corresponding target sub-tree at each step. To capture this intuition, we design a tree-to-tree neural network to translate a source tree into a target one. Meanwhile, we develop an attention mechanism for the tree-to-tree model, so that when the decoder expands one non-terminal in the target tree, the attention mechanism locates the corresponding sub-tree in the source tree to guide the expansion of the decoder. We evaluate the program translation capability of our tree-to-tree model against several state-of-the-art approaches. Compared against other neural translation models, we observe that our approach is consistently better than the baselines with a margin of up to 15 points. Further, our approach can improve the previous state-of-the-art program translation approaches by a margin of 20 points on the translation of real-world projects.
研究の動機と目的
- プログラム翻訳をモジュール化された木構造タスクとして動機づけ、ニューラルモデルの恩恵を受けられることを示す。
- ソースのパース木をターゲットのパース木へ翻訳する木-対-木のエンコーダ–デコーダアーキテクチャを提案する。
- ターゲット木の展開中に対応するソースのサブツリーを特定するための注意機構を組み込む。
- デコーディング木へ注意情報を伝播させる親注意フィードバック機構を導入してモデルを強化する。
提案手法
- ソースおよびターゲットのパースツリーを二分木(Left-Child Right-Sibling)表現へ変換する。
- Tree-LSTM エンコーダを用いてソースツリーおよびサブツリーの埋め込みを計算する。
- 共有語彙でのソフトマックスを用いてノード値を予測し、キュー駆動型の展開でターゲットツリーへデコードする。
- ソースのサブツリー上のアテンションウェイトを計算して埋め込み e_s を形成し、デコーダ状態と結合して e_t を生成する。
- 左および右の子デコーダへ親アテンションベクター e_t をフィードすることで親アテンションフィードバック機構を適用する。
実験結果
リサーチクエスチョン
- RQ1木-対-木ニューラルアーキテクチャはプログラム翻訳においてシーケンス対シーケンスおよび木ベースのベースラインを上回ることができるか。
- RQ2ソースパースツリー上のアテンション機構は翻訳品質を改善するか、提案された親アテンションフィードは性能にどのように影響するか。
- RQ3実世界のコードベースにおいて、モデルは異なる言語ペアやプログラム長にどれだけスケールするか。
主な発見
- 木-対-木モデルはプログラム翻訳タスクで一貫してベースラインを上回り、ベンチマークでプログラム精度が最大で 15-point の改善を達成する。
- CoffeeScript→JavaScript データセットでは、モデルはベストなベースラインより最大約 ~20-point の改善を達成し、特に長めのプログラムで顕著。
- アテンションなしでは複数のタスクでほぼ 0% 程度の性能しか出ない一方、アテンションは一部設定で 90% を超える性能を達成。
- Java→C# では、木-対-木アプローチが従来の SMT ベース手法を実世界プロジェクトで約 20% 程度上回る(プロジェクトごとに異なる)。
- 親アテンションフィードバック機構を組み込むと、それを欠く派生よりも顕著な性能向上を達成し、特に木のサイズが大きくなるにつれて効果が顕著になる。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。