New code models should benefit from expert knowledge with “constrained decoding”

About Daniel Maninger

Daniel Maninger studied computer science and has been a doctoral student at TU Darmstadt since October 2022, a member of the Software Technology Group (STG) under the direction of Prof Mira Mezini and a research assistant in the hessian.AI 3AI project.

In his research, he deals with the generation of programme code by artificial intelligence, with a particular focus on the code capabilities of large language models.

Human expertise plus AI model

Large language models such as GPT-4 have made enormous progress in natural language processing and code generation in recent years. However, Maninger recognises that simply scaling the models is not enough to overcome existing problems such as bugs in the generated code, hallucinations of functions and generally unsafe or low-quality code.

The Software Technology Group, which traditionally deals with topics such as programming languages and programme analysis, is therefore planning to incorporate existing expert knowledge. The aim is not to use language models as a panacea, but to combine them with established approaches in order to “utilise the best of both worlds”, as Maninger says.

Constrained decoding should make AI code better

Specifically, Maninger is working on constrained decoding. This involves taking an existing code model and guiding its output, i.e. the code generation, through certain restrictions – known as constraints.

During the step-by-step generation of the code, it is possible to analyse whether the next blocks will lead to a safe and high-quality program. Blocks that are not desired are excluded from the generation process.

This is where the expert knowledge comes into play: according to Maninger, methods of programme analysis and code completion from the Software Technology Group can be used to check partially generated code and steer it in the desired direction.

In future, Maninger also wants to train the code models with reinforcement learning. This will check whether the generated code is correct, and additional software analysis tools will also assess quality and security. In this way, the system could learn to generate really good code.

Code models could help with the shortage of skilled labour

Maninger sees hessian.AI as very helpful for his research. The network facilitates dialogue with experts from various areas of AI. For example, they can work together on linking methods such as machine learning with established software engineering approaches or neurosymbolic AI.

Maninger sees a major challenge in keeping pace with the rapid development in the field of language models and integrating the various approaches, which is often associated with technical difficulties.

According to Maninger, if this is successful, more efficient, robust and reliable models for code generation could help to solve two pressing problems: the shortage of programmers and the often inadequate quality of software. By supporting developers and revealing potential errors in the code, the models could increase productivity and security.