Categorizing source codes accurately and efficiently is a challenging problem in real-world programming education platform management. In recent years, model-based approaches utilizing abstract syntax trees (ASTs) have been widely applied to code classification tasks. We introduce an approach named the Sparse Attention-based neural network for Code Classification (SACC) in this paper. The approach involves two main steps: In the first step, source code undergoes syntax parsing and preprocessing. The generated abstract syntax tree is split into sequences of subtrees and then encoded using a recursive neural network to obtain a high-dimensional representation. This step simultaneously considers both the logical structure and lexical level information contained within the code. In the second step, the encoded sequences of subtrees are fed into a Transformer model that incorporates sparse attention mechanisms for the purpose of classification. This method efficiently reduces the computational cost of the self-attention mechanisms, thus improving the training speed while preserving effectiveness. Our work introduces a carefully designed sparse attention pattern that is specifically designed to meet the unique needs of code classification tasks. This design helps reduce the influence of redundant information and enhances the overall performance of the model. Finally, we also deal with problems in previous related research, which include issues like incomplete classification labels and a small dataset size. We annotated the CodeNet dataset with algorithm-related labeling categories, which contains a significantly large amount of data. Extensive comparative experimental results demonstrate the effectiveness and efficiency of SACC for the code classification tasks.
Instituto Superior Técnico & Instituto de Telecomunicações, Universidade de Lisboa, Portugal(里斯本大学理工学院及电信研究所,葡萄牙);Champalimaud Research, Lisbon, Portugal(Champalimaud研究,葡萄牙里斯本);TransPerfect, Lisbon, Portugal(TransPerfect,葡萄牙里斯本);Carnegie Mellon University, Pittsburgh, USA(卡内基梅隆大学,美国匹兹堡)
From Softmax to Sparsemax: A Sparse Model of Attention and Multi-Label Classification
Unbabel Lda(Unbabel有限公司);Instituto de Telecomunicações (IT)(电信研究所(IT));Instituto Superior Técnico(高等技术学院);Instituto de Engenharia de Sistemas e Computadores (INESC-ID)(系统与计算机工程研究所(INESC-ID))
SAF3R: Dynamic Sparse Attention for Feed-Forward 3D Reconstruction Transformers
University of Pittsburgh(匹兹堡大学);University of Arizona(亚利桑那大学);Tongji University(同济大学);University of Central Florida(中佛罗里达大学);University of North Carolina at Chapel Hill(北卡罗来纳大学教堂山分校)
Pruning and Sparsemax Methods for Hierarchical Attention Networks
Instituto Superior Técnico, University of Lisbon(里斯本大学高等技术学院);INESC-ID
本文介绍并评价了两种新颖的层次注意力网络模型[Yang et al.,- i)分层修剪注意力网络,其从分类过程中去除不相关的单词和句子,以减少文档分类准确性中的潜在噪声,以及ii)分层Sparsemax注意力网络,其用Sparsemax代替注意力机制中使用的Softmax函数[Martins和Astudillo,2016],能够更好地处理重要性分布,其中许多单词或句子具有非常低的概率。我们对IMDB Review的情感分析数据集的实证评估显示,这两种方法都能够匹配当前最先进的方法所获得的结果(但是没有任何显着的好处)。我们所有的源代码都可以在https://www.example.com上找到。github.com/jmribeiro/dsl-project
Kernel Deformed Exponential Families for Sparse Continuous Attention
Georgia Institute of Technology(佐治亚理工学院);University of Michigan(密歇根大学)
注意力机制采用关于概率权重的数据表示的期望。这将创建侧重于重要功能的汇总统计信息。最近,(Martins et al. 2020,2021)提出了连续注意力机制,重点关注指数和变形指数家族的单峰注意力密度:后者具有稀疏支持。(Farinhas et al. 2021)将其扩展到使用高斯混合注意力密度,这是一个具有密集支持的灵活类。在本文中,我们扩展到两个一般的灵活类:核指数家庭和我们的新的稀疏对应核变形指数家庭。理论上,我们证明了核指数和变形指数族的新的存在性结果,并且变形的情况下具有类似的逼近能力的核指数族。实验表明,核变形指数族可以处理数据域的多个紧凑区域。
Efficient Content-Based Sparse Attention with Routing Transformers
Google Research(谷歌研究院)
自注意最近已被广泛的序列建模问题。尽管它的有效性,自我注意遭受二次计算和存储器的要求相对于序列长度。降低这种复杂性的成功方法集中在关注本地滑动窗口或独立于内容的一小部分位置。我们的工作提出了学习动态稀疏注意模式,避免分配计算和内存参加内容无关的查询的兴趣。这项工作建立在两条线的研究:它结合了先前的工作基于内容的稀疏注意力的建模灵活性,从本地的,时间稀疏注意力的方法的效率收益。我们的模型,路由Transformer,赋予自我注意力的稀疏路由模块的基础上在线k-均值,同时降低整体的复杂性注意$O\left(n^{1.5}d\right)$从$O\left(n^2d\right)$的序列长度$n$和隐藏的维度$d$。我们表明,我们的模型在Wikitext-103上的语言建模(15.8 vs 18.3困惑度)以及ImageNet-64上的图像生成(3.43 vs 3.44 bits/dim)方面优于可比较的稀疏注意模型,同时使用较少的自我注意层。此外,我们在新发布的PG-19数据集上设置了一个新的最新技术水平,使用在长度为8192的序列上训练的22层Routing Transformer模型获得了33.2的测试困惑度。
School of Informatics, University of Edinburgh(爱丁堡大学信息学院);ILLC, University of Amsterdam(阿姆斯特丹大学语言、逻辑与计算研究所);Department of Computational Linguistics, University of Zurich(苏黎世大学计算语言学系)
Towards Robust Knowledge Tracing Models via k-Sparse Attention
Think Academy International Education(学而思国际教育);TAL Education Group(好未来教育集团);Guangdong Institute of Smart Education(广东省智慧教育研究院);Jinan University(暨南大学);City University of Hong Kong(香港城市大学);College of Cyber Security(网络空间安全学院)
Dimensional Collapse in Transformer Attention Outputs: A Challenge for Sparse Dictionary Learning
Shanghai Innovation Institute, Shanghai, China(上海创新研究院);OpenMOSS Team, School of Computer Science, Fudan University, Shanghai, China(开放MOSS团队,计算机科学学院,复旦大学)
Instituto de Telecomunicações(电信研究所);Instituto Superior Técnico(高等技术学院);LUMLIS (Lisbon ELLIS Unit)(里斯本ELLIS单位(LUMLIS));Unbabel;Informatics Institute, University of Amsterdam(阿姆斯特丹大学信息学院);Instituto de Sistemas e Robótica(系统与机器人研究所)