Enhancing Contextual Memory in LLMs for Software Engineering via Ontology-based Inference
| dc.contributor.author | Araya, David | |
| dc.contributor.author | Valle, Catalina | |
| dc.contributor.author | Astudillo, Hernán | |
| dc.contributor.author | Ormeño, Pablo | |
| dc.contributor.author | Taramasco, Carla | |
| dc.date.accessioned | 2026-06-04T14:42:04Z | |
| dc.date.issued | 2025-10 | |
| dc.description.abstract | The application of large language models (LLMs) in software engineering has expanded rapidly, supporting tasks such as code generation, system design, error correction, and documentation. However, LLMs face persistent challenges in multi-step development workflows, where accumulated design decisions, dependencies, and constraints require a structured, persistent memory. Existing approaches, including extended context windows and retrieval-augmented generation, rely on statistical similarity between text fragments and lack explicit, formal representations of the evolving system state, limiting their ability to maintain semantic coherence across development stages. We propose an architecture that integrates a dynamically evolving ontology, represented in OWL (Web Ontology Language), as a structured knowledge base, maintained automatically to reflect changes in the codebase and user interactions. OWL is a standard language for formal knowledge representation, allowing the explicit modeling of entities, relationships, and constraints in a machine-readable way. A secondary LLM (LLM2) functions as a context manager, querying the ontology using OWLready2 to retrieve structured information about entities, classes, methods, and associated constraints. This context is provided to the primary LLM (LLM1), which directly interacts with the user to generate code that adheres to both current requirements and historical design decisions. This hybrid approach combines symbolic knowledge representation with generative capabilities, enabling context-aware, semantically coherent, and explainable code generation. We validated the approach through a proof-of-concept implementation in a multi-stage object-oriented development scenario. Comparative evaluation using the same base model, with and without the ontology layer, showed that the ontology-enhanced configuration improved adherence to prior decisions, maintained semantic consistency across stages, and produced outputs that were more interpretable and reliable. These results demonstrate the potential of ontology-supported LLMs to facilitate long-term, semantically grounded software development. | |
| dc.identifier.uri | https://repositorio.uvm.cl/handle/25.500.12536/2263 | |
| dc.language.iso | en | |
| dc.source | CEUR Workshop Proceedings | |
| dc.subject | Large language models | |
| dc.subject | Code generation | |
| dc.subject | Semantic retrieval | |
| dc.subject | TECHNOLOGY::Information technology::Computer science::Software engineering | |
| dc.subject | Ontologies | |
| dc.title | Enhancing Contextual Memory in LLMs for Software Engineering via Ontology-based Inference | |
| dc.type | Acta de congreso | |
| uvm.carrera | Ingeniería Civil Informática | |
| uvm.escuela | Facultad Ingeniería, Negocios y Ciencias Agroambientales |
Archivos
Bloque original
1 - 1 de 1
Cargando...
- Nombre:
- Artículo científico - Enhancing Contextual Memory in LLMs for Software.pdf
- Tamaño:
- 1.18 MB
- Formato:
- Adobe Portable Document Format
Bloque de licencias
1 - 1 de 1
Cargando...
- Nombre:
- license.txt
- Tamaño:
- 1.71 KB
- Formato:
- Item-specific license agreed upon to submission
- Descripción: