A recording of a lecture that I gave at the international colloquium: "AI meets Software Quality."
This talk will present ongoing work on creating a synergy between artificial intelligence and software engineering. Deep Learning (DL) is dramatically changing the world of software, enabling engineers to train models that can achieve super-human results. Yet, DL can err when faced with new situations, which is highly troubling if DL is to be used in critical systems. An exciting new approach augments DL-based systems with hand-crafted code. This approach allows leveraging decades of work in software engineering (SE).
Apart from the reliability of AI systems, recent AI advancements have started changing the way we develop software. AI is already used for code completion (i.e., GitHub Copilot), test generation, fault localization, weaknesses identification, and more. In many cases, these automated tools rely on big data and NLP and do not utilize the full power of SE.
We propose to bridge the gaps between the two fields by using Behavioral Programming (BP) at the core of this synergy. BP is a software development and modeling paradigm designed to allow users to program reactive systems in a natural and intuitive manner that is aligned with how humans perceive the system requirements. BP provides intuitive means for bridging the two fields.
We identify and demonstrate a weakness of Petri Nets (PN) in specifying composite behavior of reactive systems. Specifically, we show how, when specifying multiple requirements in one PN model, modelers are obliged to specify mechanisms for combining these requirements. This yields, in many cases, over-specification and incorrect models. We demonstrate how some execution paths are missed, and some are generated unintentionally. To support this claim, we analyze PN models from the literature, identify the combination mechanisms, and demonstrate their effect on the correctness of the model. To address this problem, we propose to model the system behavior using behavioral programming (BP), a software development and modeling paradigm designed for seamless integration of independent requirements. Specifically, we demonstrate how the semantics of BP, which define how to interweave scenarios into a single model, allow for avoiding the over-specification. Additionally, while BP maintains the same mathematical properties as PN, it provides means for changing the model dynamically, thus increasing the agility of the specification. We compare BP and PN in quantitative and qualitative measures by analyzing the models, their generated execution paths, and the specification process. Finally, while BP is supported by tools that allow for applying formal methods and reasoning techniques to the model, it lacks the legacy of PN tools and algorithms. To address this issue, we propose semantics and a tool for translating BP models to PN and vice versa.
From Requirements to Source Code: Evolution of Behavioral Programs
Automatically generating executable code has a long history of arguably modest success, mostly limited to the generation of small programs of up to 200 lines of code, and genetic improvement of existing code. We present the use of genetic programming (GP) in conjunction with context-oriented behavioral programming (COBP), the latter being a programming paradigm with unique characteristics that facilitate automatic coding. COBP models a program as a set of behavioral threads (b-threads), each aligned to a single behavior or requirement of the system. To evolve behavioral programs we design viable and effective genetic operators, a genetic representation, and evaluation methods. The simplicity of the COBP paradigm, its straightforward syntax, the ability to use verification and formal-method techniques to validate program correctness, and a program comprising small independent chunks all allow us to effectively generate behavioral programs using GP. To demonstrate our approach we evolve complete programs from scratch of a highly competent O player for the game of tic-tac-toe. The evolved programs are well structured, consisting of multiple, explainable modules that specify the different behavioral aspects of the program and are similar to our handcrafted program. To validate the correctness of our individuals, we utilize the mathematical characteristics of COBP to analyze program behavior under all possible execution paths. Our analysis of an evolved program proved that it plays as expected more than 99% of the times.
EC-KitY is a comprehensive Python library for doing evolutionary computation (EC), licensed under GNU General Public License v3.0, and compatible with scikit-learn. Designed with modern software engineering and machine learning integration in mind, EC-KitY can support all popular EC paradigms, including genetic algorithms, genetic programming, coevolution, evolutionary multi-objective optimization, and more. This paper provides an overview of the package, including the ease of setting up an EC experiment, the architecture, the main features, and a comparison with other libraries.
Modern systems require programmers to develop code that dynamically adapts to different contexts, leading to the evolution of new context-oriented programming languages. These languages introduce new software-engineering challenges, such as: how to maintain the separation of concerns of the codebase? how to model the changing behaviors? how to verify the system behavior? and more.
This paper introduces Context-Oriented Behavioral Programming (COBP) — a novel paradigm for developing context-aware systems, centered on natural and incremental specification of context-dependent behaviors. As the name suggests, we combine behavioral-programming (BP) — a scenario-based modeling paradigm — with context idioms that explicitly specify when scenarios are relevant and what information they need. The core idea is to connect the behavioral model with a data model that represents the context, allowing an intuitive connection between the models via update and select queries. Combining behavioral-programming with context-oriented programming brings the best of the two worlds, solving issues that arise when using each of the approaches in separation.
We begin with providing abstract semantics for COBP and two implementations for the semantics, laying the foundations for applying reasoning algorithms to context-aware behavioral programs. Next, we exemplify the semantics with formal specifications of systems, including a variant of Conway’s Game of Life. Then, we provide two case studies of real-life context-aware systems (one in robotics and another in IoT) that were developed using this tool. Throughout the examples and case studies, we provide design patterns and a methodology for coping with the above challenges.
The case studies show that the proposed approach is applicable for developing real-life systems, and presents measurable advantages over the alternatives — behavioral programming alone and context-oriented programming alone.
We present a paradigm allowing programmers and system engineers to capture complex context-dependent requirements and align their code with such requirements.
Evolving context-aware recommender systems with users in mind
A context-aware recommender system (CARS) utilizes users’ context to provide personalized services. Contextual information can be derived from sensors in order to improve the accuracy of the recommendations. In this work, we focus on CARSs with high-dimensional contextual information that typically impacts the recommendation model, for example, by increasing the model’s dimensionality and sparsity. Generating accurate recommendations is not enough to constitute a useful system from the user’s perspective, since the use of some contextual information may cause problems, such as draining the user’s battery, raising privacy concerns, and more.
Previous studies suggested reducing the amount of contextual information utilized by using domain knowledge to select the most suitable information. This approach is only applicable when the set of contexts is small enough to handle and sufficient for preventing sparsity. Moreover, hand-crafted context information may not represent an optimal set of features for the recommendation process. Another approach is to compress the contextual information into a denser latent space, but this may limit the ability to explain the recommended items to the users or compromise their trust.
In this paper, we present a multi-step approach for selecting low-dimensional subsets of contextual information and incorporating them explicitly within CARSs. At the core of our approach is a novel feature selection algorithm based on genetic algorithms, which outperforms state-of-the-art dimensionality reduction CARS algorithms by improving recommendation accuracy and interpretability. Over the course of evolution, thousands of diverse feature subsets are generated; a deep context-aware model is produced for each feature subset, and the subsets are stacked together. The resulting stacked model is accurate and only uses interpretable, explicit features. Our approach includes a mechanism of tuning the different underlying algorithms that affect user concerns, such as privacy and battery consumption.
We evaluated our approach on two high-dimensional context-aware datasets derived from smartphones. An empirical analysis of our results confirms that our proposed approach outperforms state-of-the-art CARS models while improving transparency and interpretability for the user. In addition to the empirical results, we present several use cases, examples and methodology of how researchers, domain experts and CARS modelers can tweak the feature selection algorithm to improve various user concerns and interpretability.