CV4Code: Sourcecode Understanding via Visual Code Representations
We present CV4Code, a compact and effective computer vision method for sourcecode understanding. Our method leverages the contextual and the structural information available from the code snippet by treating each snippet as a two-dimensional image, which naturally encodes the context and retains the underlying structural information through an explicit spatial representation. To codify snippets as images, we propose an ASCII codepoint-based image representation that facilitates fast generation of sourcecode images and eliminates redundancy in the encoding that would arise from an RGB pixel representation. Furthermore, as sourcecode is treated as images, neither lexical analysis (tokenisation) nor syntax tree parsing is required, which makes the proposed method agnostic to any particular programming language and lightweight from the application pipeline point of view. CV4Code can even featurise syntactically incorrect code which is not possible from methods that depend on the Abstract Syntax Tree (AST). We demonstrate the effectiveness of CV4Code by learning Convolutional and Transformer networks to predict the functional task, i.e. the problem it solves, of the source code directly from its two-dimensional representation, and using an embedding from its latent space to derive a similarity score of two code snippets in a retrieval setup. Experimental results show that our approach achieves state-of-the-art performance in comparison to other methods with the same task and data configurations. For the first time we show the benefits of treating sourcecode understanding as a form of image processing task.
Code (0)
등록된 구현이 없습니다.
Tasks
Lexical AnalysisRetrievalMethods 이 논문이 사용한 방법론
Similar Papers 제목 키워드 기반
Neural sequence labeling for Vietnamese POS Tagging and NER
This paper presents a neural architecture for Vietnamese sequence labeling tasks including part-of-speech (POS) tagging and named entity recognition (NER). We applied the model described in \cite{lample-EtAl:2016:N16-1} …
named-entity-recognitionNamed Entity RecognitionNamed Entity Recognition (NER)NER+4HMMs for Unsupervised Vietnamese WordSegmentation
Word segmentation is an important problem in nat-ural language processing. Most of previous works on Vietnameseword segmentation are supervised learning. In this paper, wepropose an unsupervised method for Vietnamese wor…
SegmentationRaP-Net: A Region-wise and Point-wise Weighting Network to Extract Robust Features for Indoor Localization
Feature extraction plays an important role in visual localization. Unreliable features on dynamic objects or repetitive regions will interfere with feature matching and challenge indoor localization greatly. To address t…
Indoor LocalizationVisual LocalizationTuna-2: Pixel Embeddings Beat Vision Encoders for Multimodal Understanding and Generation
Unified multimodal models typically rely on pretrained vision encoders and use separate visual representations for understanding and generation, creating misalignment between the two tasks and preventing fully end-to-end…
Image GenerationHarmonizing Visual Representations for Unified Multimodal Understanding and Generation
Unifying visual understanding and generation within a single multimodal framework remains a significant challenge, as the two inherently heterogeneous tasks require representations at different levels of granularity. Cur…
Image GenerationQuantization