Final places: Learn from Cambridge and apply it in real time. Enrol by 16 July
Technology and Data
The contextual gap in GenAI for software engineering: Haven't we solved this problem with software architecture?
Technology and Data
The contextual gap in GenAI for software engineering: Haven't we solved this problem with software architecture?
When engineering software systems, contextual knowledge is not optional – it’s an essential part of understanding the problem software systems should solve.
Software systems rarely operate in isolation. Instead, they tend to interact with a wider ecosystem of stakeholders and other systems. Within each application domain, there is often an established understanding of these interactions, as well as the most important standards and system quality properties (for example, security in online banking).
Furthermore, there are often established software stacks, technologies, and language that stakeholders in the application domain use. Finally, there is a set of common problems and infrastructural, non-differentiating functionalities that emerge in every domain (e.g., register and login in e-commerce websites).
The main challenge for software architects
The application domain, although helpful to set the stage, is still too wide to fully define all functional and non-functional requirements of a system. To fully understand the problem domain, requirements engineers and software architects interact with software commissioners.
Architects of software systems need to understand the context in which these systems operate, and further scope the problem domain so they can successfully derive solutions and manage implementation.
Mining and capturing this contextual knowledge, for scoping problem and solution domains, is one of the main challenges that software architecture aims to solve.
Failure to do so can result in a system that is not fit for purpose, or an overengineered system that is too expensive as it is capable of much more than what commissioners truly need.
Can GenAI provide the solution? The short answer: not on its own.
If well-educated, industry savvy, senior engineers and architects, adults with a knowledge of technical and non-technical contextual knowledge still struggle with creating software systems, how can we expect that a single prompt provided to a large language model, containing ambiguous and wide-range requirements, will result in adequate solutions?
It can't.
It might result in a functioning piece of software at best, but just as humans need to make assumptions, so generative artificial intelligence (GenAI) and LLMs will too. These assumptions, however, might not be what humans implicitly expect and they might not be transparent.
If you don’t know what you want to build, how can GenAI know what you need?
To create results that match human needs, GenAI would have to have the same context as humans: understanding of external stakeholders and external systems, important quality properties, necessary infrastructural functionality, and solutions to common problems in a domain; just to start.
Otherwise, it can only assume these (as a human would, but without human general knowledge or logical reasoning), resulting in inadequate solutions or hallucinations.
To make Large Language Models (LLMs) useful in generating adequate solutions, someone, somehow, needs to clearly communicate to them system’s context. However, before communicating it, there is a need to capture it in the first place.
The challenge, as we have established, is that capturing the context is not a simple task and there is a whole discipline built around that effort. Therefore, our expectations from GenAI might be misplaced, not because GenAI has technical limitations, but because the solution does not conceptually match the problem.
In plain words, if you do not know what you want to build, how can GenAI know what you need?
The evidence shows that GenAI can’t replace human software architects
The contextual gap when using GenAI in software engineering has been confirmed and exposed in several scientific works.
At Ericsson, in 2025 they conducted a study (1)(Opens in a new window) with 18 practitioners (software developers, architects, and DevOps engineers) to determine how GenAI impacts their daily work. The results state that applying LLMs to more complex tasks rarely reaps benefits in cases where tasks require well-defined, specialised domain knowledge or deeper architectural considerations.
A literature review (2) (Opens in a new window)on the topic from 2026 exposes that LLMs tend to struggle with complex sentences, consequently struggling to generate complex design and code patterns. LLMs misunderstand a developer’s true intent, leading to incorrect identification of refactoring opportunities.
One interesting study (3)(Opens in a new window) in this context focused on feasibility of LLMs to create architecture for systems. They concluded that LLMs are most effective when guided by an architect who can spell out the high-level steps of architectural synthesis, evaluate suggestions, and decide what to keep or discard. That relying on humans to decide about relevance of solutions for the given context is the best way to use LLMs as assistants.
GenAI does try to bridge the contextual knowledge gap – but humans need to provide clarity
These days, LLMs rely on Retrieval-Augmented Generation (RAG) and MCP techniques to fetch additional information not contained in the models themselves.
Furthermore, there are prompting techniques (4)(Opens in a new window), (5) (Opens in a new window)that can help scope a problem guiding users to provide adequate context (4). Empirical evidence (6)(Opens in a new window), (7)(Opens in a new window) suggest that for well-defined tasks, GenAI is highly capable of generating functionally adequate code, with clean syntax, and code that is easy to understand.
GenAI can even help with defining problem and solution domain and suggesting the contextual knowledge. However, despite all advances in GenAI, techniques that try to deal with the contextual gap, and the assistance that GenAI can offer, it is up to humans to determine what kind of systems we want to build and what are the problems we aim to solve.
This part of software engineering is human-centric and essential when building software systems. With the incredible advances in GenAI and considering all the assistance this technology can provide with generating solutions and code, understanding the context becomes even more important.
How to better understand the context and use GenAI effectively
Although software architecture techniques capture essential context, there is still a lot of implicit understanding that humans have and that GenAI and LLMs do not have and therefore assume.
This emphasises the fact that in the GenAI era of software engineering, humans become a central piece in engineering and designing software systems and need to approve, adopt, and integrate generated solutions.
However, humans can only be that central piece if they have adequate skills.
At Cambridge Advance Online, we have two courses that address these topics. Generative AI in the Software Development Lifecycle helps learners to scope their SDLC and identify opportunities where GenAI can help provide beneficial outcomes, such as saving time or improving the quality of solutions.
However, to engineer a system even with the help of GenAI, it is necessary to scope problem and solution domains. The course Managing Software Architecture prepares learners to scope their problem and solution domain and decompose big problems into chunks that technologies such as GenAI can handle.
Want to use GenAI more effectively in your role but not sure where to start? Start your next step today with technology and data courses led by Dr Jasmin Jahić and other leading University of Cambridge experts.
Or to transform your team or organisation’s approach to AI, our Business Development team can help design learning to suit your goals and capability gaps. Book a consultation now. (Opens in a new window)
References
1 Liang Yu. 2025. Paradigm shift on Coding Productivity Using GenAI. In Proceedings of the 29th International Conference on Evaluation and Assessment in Software Engineering (EASE '25). Association for Computing Machinery, New York, NY, USA, 708–713. https://doi.org/10.1145/3756681.3757081
2 Sofia Martinez, Luo Xu, Mariam Elnaggar, Eman Abdullah Alomar, Software refactoring research with large language models: A systematic literature review, Journal of Systems and Software, Volume 235, 2026, 112762, ISSN 0164-1212, https://doi.org/10.1016/j.jss.2025.112762
3 https://ieeexplore.ieee.org/document/11344283 - Can AI Build Systems? an Exploratory Study on Generating Software Architecture With LLMS
4 Meta-learning via Language Model In-context Tuning (https://aclanthology.org/2022.acl-long.53/, Chen et al., ACL 2022)
5 João José Maranhão and Eduardo Martins Guerra. 2024. A Prompt Pattern Sequence Approach to Apply Generative AI in Assisting Software Architecture Decision-making. In Proceedings of the 29th European Conference on Pattern Languages of Programs, People, and Practices (EuroPLoP '24). Association for Computing Machinery, New York, NY, USA, Article 1, 1–12. https://doi.org/10.1145/3698322.3698324
6 Domenico Amalfitano, Andreas Metzger, Marco Autili, Tommaso Fulcini, Tobias Hey, Jan Keim, Patrizio Pelliccione, Vincenzo Scotti, Anne Koziolek, Raffaela Mirandola, and Andreas Vogelsang. 2026. A Research Roadmap for Augmenting Software Engineering Processes and Software Products with Generative AI. ACM Trans. Softw. Eng. Methodol. Just Accepted (January 2026). https://doi.org/10.1145/3788879]
7 Ali Nouri, Johan Andersson, Kailash De Jesus Hornig, Zhennan Fei, Emil Knabe, Hakan Sivencrona, Beatriz Cabrero-Daniel, and Christian Berger. 2025. On Simulation-Guided LLM-based Code Generation for Safe Autonomous Driving Software. In Proceedings of the 29th International Conference on Evaluation and Assessment in Software Engineering (EASE '25). Association for Computing Machinery, New York, NY, USA, 1097–1106. https://doi.org/10.1145/3756681.3756987