title: Embedding Java classes with code2vec: improvements from variable obfuscation

authors: Compton, Rhys

abstract: Automatic source code analysis in key areas of software engineering, such as code security, can benefit from Machine Learning (ML). However, many standard ML approaches require a numeric representation of data and cannot be applied directly to source code. Thus, to enable ML, we need to embed source code into numeric feature vectors while maintaining the semantics of the code as much as possible. code2vec is a recently released embedding approach that uses the proxy task of method name prediction to map Java methods to feature vectors. However, experimentation with code2vec shows that it learns to rely on variable names for prediction, causing it to be easily fooled by typos or adversarial attacks. Moreover, it is only able to embed individual Java methods and cannot embed an entire collection of methods such as those present in a typical Java class, making it difficult to perform predictions at the class level (e.g., for the identification of malicious Java classes). Both shortcomings are addressed in the research presented in this paper. We investigate the effect of obfuscating variable names during training of a code2vec model to force it to rely on the structure of the code rather than specific names and consider a simple approach to creating class-level embeddings by aggregating sets of method embeddings. Our results, obtained on a challenging new collection of source-code classification problems, indicate that obfuscating variable names produces an embedding model that is both impervious to variable naming and more accurately reflects code semantics. The datasets, models, and code are shared1 for further ML research on source code.

text: Embedding Java classes with code2vec: improvements from variable obfuscation Automatic source code analysis in key areas of software engineering, such as code security, can benefit from Machine Learning (ML). However, many standard ML approaches require a numeric representation of data and cannot be applied directly to source code. Thus, to enable ML, we need to embed source code into numeric feature vectors while maintaining the semantics of the code as much as possible. code2vec is a recently released embedding approach that uses the proxy task of method name prediction to map Java methods to feature vectors. However, experimentation with code2vec shows that it learns to rely on variable names for prediction, causing it to be easily fooled by typos or adversarial attacks. Moreover, it is only able to embed individual Java methods and cannot embed an entire collection of methods such as those present in a typical Java class, making it difficult to perform predictions at the class level (e.g., for the identification of malicious Java classes). Both shortcomings are addressed in the research presented in this paper. We investigate the effect of obfuscating variable names during training of a code2vec model to force it to rely on the structure of the code rather than specific names and consider a simple approach to creating class-level embeddings by aggregating sets of method embeddings. Our results, obtained on a challenging new collection of source-code classification problems, indicate that obfuscating variable names produces an embedding model that is both impervious to variable naming and more accurately reflects code semantics. The datasets, models, and code are shared1 for further ML research on source code.

year: 2020

title: Fair testing revisited: A process-algebraic characterisation of conflicts

authors: Malik, Robi

subjects: computer science

abstract: This paper studies conflicts from a process-algebraic point of view and shows how they are related to the testing theory of fair testing. Conflicts have been introduced in the context of discrete event systems, where two concurrent systems are said to be in conflict if they can get trapped in a situation where they are waiting or running endlessly, forever unable to complete their common task. In order to analyse complex discrete event systems, conflict-preserving notions of refinement and equivalence are needed. This paper characterises an appropriate refinement, called the conflict preorder, and provides a denotational semantics for it. Its relationship to other known process preorders is explored, and it is shown to generalise the fair testing preorder in process-algebra for reasoning about conflicts in discrete event systems.

text: Fair testing revisited: A process-algebraic characterisation of conflicts This paper studies conflicts from a process-algebraic point of view and shows how they are related to the testing theory of fair testing. Conflicts have been introduced in the context of discrete event systems, where two concurrent systems are said to be in conflict if they can get trapped in a situation where they are waiting or running endlessly, forever unable to complete their common task. In order to analyse complex discrete event systems, conflict-preserving notions of refinement and equivalence are needed. This paper characterises an appropriate refinement, called the conflict preorder, and provides a denotational semantics for it. Its relationship to other known process preorders is explored, and it is shown to generalise the fair testing preorder in process-algebra for reasoning about conflicts in discrete event systems.

year: 2004

title: Biculturalism in practice, ‘Te Pounamu’: Integration of a Māori model with traditional clinical assessment processes

authors: Manna, Leona

subjects: Maori

abstract: Traditional clinical psychological assessment follows a western paradigm of interaction, which relies heavily on verbalisations of internal and external symptoms. This process relies upon the assumption of and acceptance that tangata whaiora (consumer/s) are able to do this. Training encourages a clinical psychologist to take into account differences which may or may not be obvious, e.g., differences in religious beliefs, gender, hearing, or sight. However, as clinicians we often neglect to assess tangata whaiora abilities to verbalise such information. Te Pounamu, as a Māori model demonstrates the underlying principles of Te Tiriti O Waitangi. Providing the best treatment outcomes is about acknowledging all aspects of one’s wellbeing: physical, mental, spiritual, and whānau. Te Pounamu provides a process that acknowledges such aspects in a way of knowing that is healing. From clinical experience, the interactive mode that Te Pounamu utilises has been found efficacious in assisting tangata whaiora to understand how such factors contribute to poor mental health.

text: Biculturalism in practice, ‘Te Pounamu’: Integration of a Māori model with traditional clinical assessment processes Traditional clinical psychological assessment follows a western paradigm of interaction, which relies heavily on verbalisations of internal and external symptoms. This process relies upon the assumption of and acceptance that tangata whaiora (consumer/s) are able to do this. Training encourages a clinical psychologist to take into account differences which may or may not be obvious, e.g., differences in religious beliefs, gender, hearing, or sight. However, as clinicians we often neglect to assess tangata whaiora abilities to verbalise such information. Te Pounamu, as a Māori model demonstrates the underlying principles of Te Tiriti O Waitangi. Providing the best treatment outcomes is about acknowledging all aspects of one’s wellbeing: physical, mental, spiritual, and whānau. Te Pounamu provides a process that acknowledges such aspects in a way of knowing that is healing. From clinical experience, the interactive mode that Te Pounamu utilises has been found efficacious in assisting tangata whaiora to understand how such factors contribute to poor mental health.

year: 2003