Introduction
Assembly code serves as the foundational "dark matter" of software, critical for reverse engineering, vulnerability detection, and malware analysis. However, its lack of explicit syntactic structures and low information density makes it notoriously difficult for both human experts and artificial intelligence to parse. Traditional Large Language Models (LLMs) often struggle with assembly because they treat it as standard text, failing to capture the hardware-centric structural patterns like control flow and register usage.
To address these challenges, we introduce ASMA-Tune, the first end-to-end instruction tuning framework designed to bridge the gap between low-level assembly code and high-level natural language understanding. By integrating specialized structural encoders with generative LLMs, ASMA-Tune enables models to explain, reason about, and analyze binary code with unprecedented effectiveness.
Methodology: The "Sandwich" Architecture
ASMA-Tune utilizes a unique three-part architecture that combines specialized feature extraction with general-purpose linguistic reasoning.
The framework consists of three primary modules:
- Assembly Code Encoder Module: This module leverages a pre-trained CLAP-ASM encoder to extract hardware-level structural features, such as vocabulary and control flow, from raw assembly snippets.
- Projector Module: A learnable multi-layer perceptron (MLP) acts as a "translator," aligning the specialized assembly embeddings with the LLM’s internal semantic space.
- LLM Module: A standard decoder-based LLM (e.g., Qwen2.5-Coder or DeepSeek-Coder) receives these aligned embeddings to generate coherent natural language responses.
The training process is divided into two phases: Feature Space Alignment, where the projector is pre-trained on 292k assembly-text pairs, and End-to-End Fine-tuning, where both the projector and the LLM are trained on 115k complex instruction-following samples.
Data and Benchmarking
The effectiveness of ASMA-Tune is powered by a massive, curated dataset. The researchers utilized the BinaryCorp-3M and Juliet Test Suite to source assembly snippets across various architectures. To facilitate instruction tuning, they generated a 407k assembly-text instruction dataset using GPT-4-Turbo, featuring multi-turn conversations and complex reasoning tasks. Furthermore, the study introduces ASMA-Bench, a new benchmark consisting of 90 domain-diverse questions covering cryptography, malware, and network protocols to evaluate assembly-language instruction following.
Results and Discussion
ASMA-Tune demonstrates state-of-the-art performance across multiple metrics. In binary similarity tasks, ASMA-Tune models achieved a +39.7% Recall@1 and +17.8% Mean Reciprocal Rank (MRR) improvement over GPT-4-Turbo.
A blind evaluation conducted by 20 binary analysis experts further validated these results. The ASMA-Tune enhanced model (Vicuna-1.5-AT-13.2B) outperformed GPT-4-Turbo by 9% in overall score, showing particular strength in accuracy and relevance. Interestingly, the framework provided the most dramatic boosts to general-purpose models; for instance, the Vicuna-1.5-AT model saw a 75x improvement in recall compared to its base version. Crucially, ASMA-Tune achieves this specialization without "catastrophic forgetting," maintaining competitive performance on general coding benchmarks like HumanEval.
Conclusion
ASMA-Tune represents a significant advancement in the field of binary analysis. By prioritizing structural features over raw syntax, it unlocks the ability for LLMs to comprehend the complexities of assembly code. While challenges remain in handling extremely long and complex logical reasoning, the commitment to open-sourcing the toolkit and the 407k instruction dataset provides a foundational resource for the security research community. Future work will focus on improving architectural adaptability and deepening the semantic reasoning capabilities for large-scale binary functions.
Summary updated