All research

2026Published

Design and Implementation of Dynamic KG-RAG: Extending the RAG Paradigm with Persistent Memory through a Bitemporal Knowledge Graph

  • Christian Javier Caldera Sánchez

CID Journal, Tecnológico Nacional de México, 2026

Publication details

Year
2026
Status
Published

Cite

@article{caldera2026dynamic,
  author = {Caldera Sánchez, Christian Javier},
  title = {{Diseño e Implementación de KG-RAG Dinámico: Una Extensión del Paradigma RAG con Memoria Persistente mediante Grafo de Conocimiento Bitemporal}},
  journal = {Revista CID, Tecnológico Nacional de México},
  year = {2026},
  doi = {10.62805/cid2026.CID008},
  url = {https://revistacid.itslerdo.edu.mx/revistacid2026-v2/cid008},
  language = {es}
}

Generated from the publication data on this page.

Abstract

Retrieval-Augmented Generation (RAG) systems allow querying external sources to generate grounded responses; however, they lack mechanisms to update knowledge between interactions, limiting long-term personalization and continuity. This article presents the design and implementation of a multi-layer persistent memory engine called Dynamic KG-RAG, which extends this paradigm by incorporating dynamic memory based on a bitemporal knowledge graph. The objective is to develop an architecture capable of retaining, structuring, and retrieving knowledge across independent sessions. To this end, a fourphase approach was followed: state-of-the-art review, architectural definition, implementation, and experimental validation. The proposal organizes memory into three layers: immutable raw transcripts, a bitemporal graph that models entities, relationships, and their evolution over time, and a hybrid retrieval layer that integrates semantic search through embeddings, lexical search, and graph traversal. Retrieved context is systematically injected before response generation. The graph is built automatically and asynchronously through an entity and relationship extraction pipeline, eliminating the need for manual indexing. Results show consistent context retrieval across sessions and coherent representation of facts changing over time. Viability is validated through a prototype implemented as a conversational agent. It is concluded that Dynamic KG- RAG effectively extends the RAG paradigm and is applicable to systems requiring structured, persistent, and evolving memory.

Key findings

  1. Organizing memory in three layers (immutable raw transcripts, a bitemporal knowledge graph and a hybrid retrieval layer) lets an agent retain, structure and retrieve knowledge across independent sessions.

  2. The bitemporal model is the component with the greatest impact: it preserves the full history of facts without destroying previous states, enabling temporal reasoning that flat memory systems cannot offer.

  3. Unifying storage in PostgreSQL with pgvector guarantees transactional consistency, and splitting the extraction pipeline into steps solves the errors of monolithic prompts.

  4. In a 35-test evaluation framework the system passed 33 tests (94.3%), with 1 partial and 1 failed, covering extraction, retrieval, temporal reasoning and normalization.

Techniques & technologies

  • KG-RAG
  • Bitemporal Knowledge Graph
  • Hybrid Retrieval
  • PostgreSQL
  • pgvector
  • Full-Text Search
  • Ollama Embeddings
  • GLiNER
  • Claude Sonnet & Opus
  • ASP.NET
  • Angular
  • Cytoscape.js
  • Docker Compose

Bibliography

  1. Anthropic. (2024). The Claude 3 model family: Opus, Sonnet, Haiku. https://www-cdn.anthropic.com/de8ba9b01c9ab7cbabf5c33b80b7bbc618857627/Model_Card_Claude_3.pdf
  2. Chen, Z., Du, W., Zhang, W., Liu, K., Liu, J., Zheng, M., Zhuo, J., Zhang, S., Lin, D., Chen, K., & Zhao, F. (2024). T-Eval: Evaluating the Tool Utilization Capability of Large Language Models Step by Step. Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 9510–9529. https://doi.org/10.18653/v1/2024.acl-long.515
  3. Chhikara, P., Khant, D., Aryan, S., Singh, T., & Yadav, D. (2025). Mem0: Building production-ready AI agents with scalable long-term memory. arXiv preprint arXiv:2504.19413. https://arxiv.org/abs/2504.19413
  4. Cormack, G. V., Clarke, C. L. A., & Büttcher, S. (2009). Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning Methods. Proceedings of the 32nd International ACM SIGIR Conference on Research and Development in Information Retrieval, 758–759. https://doi.org/10.1145/1571941.1572114
  5. Edge, D., Trinh, H., Cheng, N., Bradley, J., Chao, A., Mody, A., Truitt, S., Metropolitansky, D., Ness, R. O., & Larson, J. (2024). From local to global: A Graph RAG approach to query-focused summarization. arXiv preprint arXiv:2404.16130. https://arxiv.org/abs/2404.16130
  6. Gemma Team. (2026). Gemma 4 model card. Google AI for Developers. https://ai.google.dev/gemma/docs/core/model_card_4
  7. Khot, T., Trivedi, H., Finlayson, M., Fu, Y., Richardson, K., Clark, P., & Sabharwal, A. (2023). Decomposed Prompting: A Modular Approach for Solving Complex Tasks. Proceedings of the 11th International Conference on Learning Representations (ICLR 2023). https://arxiv.org/abs/2210.02406
  8. Kulkarni, K., & Michels, J.-E. (2012). Temporal Features in SQL:2011. ACM SIGMOD Record, 41(3), 34–43. https://doi.org/10.1145/2380776.2380786
  9. Leblay, J., & Chekol, M. W. (2018). Towards Probabilistic Bitemporal Knowledge Graphs. Companion Proceedings of The Web Conference 2018 (WWW '18), 1–6. https://doi.org/10.1145/3184558.3191637
  10. Luan, Y., Eisenstein, J., Toutanova, K., & Collins, M. (2021). Sparse, Dense, and Attentional Representations for Text Retrieval. Transactions of the Association for Computational Linguistics, 9, 329–345. https://doi.org/10.1162/tacl_a_00369

Let’s build something that lasts.

I’m not taking new client projects right now, but I’m open to future work. What would you like to talk about?

Recommender systems, RAG or machine learning. Share the question you are working on.

Write to me
© 2026 Christian J. Caldera, Torreón, México