Enhancing Contextual Memory in LLMs for Software Engineering via Ontology-based Inference

dc.contributor.authorAraya, David
dc.contributor.authorValle, Catalina
dc.contributor.authorAstudillo, Hernán
dc.contributor.authorOrmeño, Pablo
dc.contributor.authorTaramasco, Carla
dc.date.accessioned2026-06-04T14:42:04Z
dc.date.issued2025-10
dc.description.abstractThe 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.urihttps://repositorio.uvm.cl/handle/25.500.12536/2263
dc.language.isoen
dc.sourceCEUR Workshop Proceedings
dc.subjectLarge language models
dc.subjectCode generation
dc.subjectSemantic retrieval
dc.subjectTECHNOLOGY::Information technology::Computer science::Software engineering
dc.subjectOntologies
dc.titleEnhancing Contextual Memory in LLMs for Software Engineering via Ontology-based Inference
dc.typeActa de congreso
uvm.carreraIngeniería Civil Informática
uvm.escuelaFacultad Ingeniería, Negocios y Ciencias Agroambientales

Archivos

Bloque original

Mostrando 1 - 1 de 1
Cargando...
Miniatura
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

Mostrando 1 - 1 de 1
Cargando...
Miniatura
Nombre:
license.txt
Tamaño:
1.71 KB
Formato:
Item-specific license agreed upon to submission
Descripción: