Pass-Tuning: Towards Structure-Aware Parameter-Efficient Tuning for Code Representation Learning

Nuo Chen, Qiushi Sun, Jianing Wang, Xiang Li, Ming Gao

TL;DR

Pass-Tuning is a parameter-efficient tuning framework that adapts large code pre-trained models (CodePTMs) by injecting structural information directly into the model's layers. By using a graph-based "tunable prefix" derived from Abstract Syntax Trees (ASTs), it achieves performance comparable to—and sometimes better than—full fine-tuning while updating less than 1% of the model's parameters.

The Challenge of Code Tuning

Fine-tuning large-scale Code Pre-trained Models (like CodeT5 or PLBART) for specific tasks is the current gold standard, but it is becoming prohibitively expensive. As models grow to billions of parameters and the number of downstream tasks (summarization, translation, etc.) multiplies, storing a full copy of the model for every task is no longer feasible.

While the NLP community has developed Parameter-Efficient Learning (PEL) methods like Prefix-Tuning or Adapters, these methods treat code as simple sequences of text. They ignore the inherent structural characteristics of programming languages—the logic, loops, and data flows that distinguish code from natural language. The authors argue that to truly master code intelligence with minimal parameters, we need "structure-aware" tuning.

Methodology: Pass-Tuning

The authors introduce Pass-Tuning, which stands out by using a Structure Knowledge Injector. Instead of adding random learnable vectors as prefixes (as in standard Prefix-Tuning), they use a Graph Attention Network (GAT) to process the code's structure.

The Pass-Tuning framework overview, illustrating the flow from code sampling to structural knowledge injection via GAL into the frozen CodePTM.

Core Components

  1. Upgraded AST (U-AST): Source code is parsed into an Abstract Syntax Tree with added "data-flow edges" to connect distant but related variables, solving the "long-range" problem inherent in deep trees.
  2. Graph Attentional Layers (GAL): A GAT module processes this U-AST to generate structural embeddings. These embeddings are then prepended as "prefixes" to the hidden states of every layer in the frozen backbone model.
  3. Code Retriever: To avoid the "cold-start" problem of random initialization, a retrieval strategy selects representative code snippets based on token importance and uses their structural features to initialize the GAT, providing a stable starting point for training.
  4. Plug-and-Play Architecture: The design is universal, compatible with both encoder-only (like CodeBERT) and encoder-decoder (like CodeT5) models.

Experimental Evaluation

The researchers evaluated Pass-Tuning across eight programming languages using industry-standard benchmarks:

  • Code Understanding: BigCloneBench (Clone Detection) and Devign (Defect Detection).
  • Code Generation: CodeSearchNet (Summarization) and CONCODE (Text-to-Code).
  • Code-to-Code: Java-C# (Translation) and Refine Small/Medium (Code Refinement/Bug Fixing).

Key Results and Insights

Pass-Tuning consistently outperformed other PEL methods like BitFit, Adapters, and standard Prefix-Tuning (P-Tuning V2), proving that "structure-awareness" is the missing ingredient for code tasks.

Comparison of generation performance vs. tunable parameters. Pass-Tuning achieves high performance with significantly fewer parameters than fine-tuning.
  • Beating Full Fine-Tuning: Surprisingly, on tasks like Clone Detection and Code Summarization, Pass-Tuning actually outperformed full fine-tuning. For example, on BigCloneBench, Pass-Tuning reached a 93.41 F1 score, surpassing full fine-tuning (92.85). This suggests that freezing the backbone and tuning a structure-aware module reduces overfitting and preserves general pre-training knowledge.
  • Efficiency without Sacrifice: The method achieves SOTA-level results while modifying only ~0.5M to 3M parameters. This represents a massive reduction in storage and computational overhead, typically updating less than 1% of the total parameters.
  • Summarization Performance: On the PLBART backbone, Pass-Tuning achieved an overall score of 17.97 (Smoothed BLEU-4), slightly higher than full fine-tuning (17.93), despite the parameter savings.

Limitations and Future Work

The authors identify two main limitations:

  1. Natural Language Gap: Pass-Tuning excels at code-centric tasks but does not provide additional structural information for natural language components (e.g., comments in summarization).
  2. AST Complexity: The current method treats all token types in an AST with similar weight. Future work could involve more sophisticated feature engineering to distinguish between different types of nodes, such as function calls versus variable declarations.

In the future, the team aims to explore even more efficient ways to utilize code structure and move toward a "one-model-for-all-tasks" paradigm in code intelligence.

Summary updated

BibTeX
@inproceedings{chen2023pass,
  author = {Nuo Chen and Qiushi Sun and Jianing Wang and Xiang Li and Ming Gao},
  title = {{Pass-Tuning: Towards Structure-Aware Parameter-Efficient Tuning for Code Representation Learning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.42},
}
Figure