ACL 2025long0 citations

Beyond Sequences: Two-dimensional Representation and Dependency Encoding for Code Generation

Xiangyu Zhang, Yu Zhou, Guang Yang, Wei Cheng, Taolue Chen

Abstract

The advent of large language models has significantly advanced automatic code generation, transforming the way programmers writing code. Inspired by natural language processing, mainstream code generation approaches represent code as a linear sequence of tokens. In this paper, we propose to represent code snippets as two-dimensional entities, where both code lines and tokens within lines are explicitly modeled. This representation allows us to capture the hierarchical and spatial structure of code, especially the dependencies between code lines. Our method CoDE introduces a dependency encoding approach that leverages dictionary learning to perform semantic matching between code lines. As such, it avoids the reliance on strict position indices, leading to better generalization to code with diverse context and lengths. We thoroughly evaluate CoDE based on four categories of tasks. The experimental results showcase its generalizability, context understanding and retrieval, as well as interpretability in code generation.

BibTeX
@inproceedings{zhang-etal-2025-beyond,
    title = "Beyond Sequences: Two-dimensional Representation and Dependency Encoding for Code Generation",
    author = "Zhang, Xiangyu  and
      Zhou, Yu  and
      Yang, Guang  and
      Cheng, Wei  and
      Chen, Taolue",
    editor = "Che, Wanxiang  and
      Nabende, Joyce  and
      Shutova, Ekaterina  and
      Pilehvar, Mohammad Taher",
    booktitle = "Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    month = jul,
    year = "2025",
    address = "Vienna, Austria",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2025.acl-long.308/",
    doi = "10.18653/v1/2025.acl-long.308",
    pages = "6157--6172",
    ISBN = "979-8-89176-251-0"
}