Neo4j Live: Cognitive Sciences and Dynamic GraphRAG
In this Neo4j Live session, Vasilije Markovic, founder of Cognee, shared insights into how cognitive science principles can transform traditional GraphRAG systems. Drawing inspiration from human memory models, he demonstrated how dynamic, evolving knowledge graphs could replace static data representations in AI applications.
You can watch the full session above.
From Static Data to Living Memory
Traditional RAG systems treat data as static snapshots – information gets embedded, stored and retrieved without consideration for how relationships and relevance change over time. Vasilije’s approach fundamentally challenges this paradigm by modelling AI memory systems after human cognitive processes.
“The nature of systems is to evolve,” Vasilije explained during the session. “You come into a workplace and in two years it’s a different workplace – 30% of people left, 30% are different. Every type of system is an evolving system.”
This insight led to the development of Cognee, a Python library that implements dynamic graph memory models inspired by decades of cognitive science research.
The Cognitive Science Foundation
Vasilije’s journey began with studying human memory models, particularly the Atkinson-Shiffrin model from the 1960s-70s. This foundational work in psychology describes three distinct memory systems:
- Sensory memory: Captures 100% of information briefly before it’s filtered
- Short-term memory: Holds limited information for immediate use
- Long-term memory: Stores information permanently, divided into episodic (personal experiences) and semantic (factual knowledge) components
Initial attempts to hardcode these memory domains into graph databases revealed a critical flaw: static memory structures couldn’t handle the dynamic nature of real-world information systems. So they started developing more sophisticated approaches incorporating temporal and frequency-based weighting.
Beyond Static Relationships
Graph Databases excel at representing relationships like “Vasilije owns a company” or “Company develops software.” But these static relationships don’t capture the evolving nature of information importance. Cognee introduces relationships that change over time based on:
- Recency: How recently information was accessed or updated
- Frequency: How often specific data points are referenced
- Contextual relevance: How information relates to current queries and use cases
“We’re adding these weights and making relationships not static but having relationships that are increasing and decreasing in size,” Vasilije demonstrated. This approach enables the system to naturally prioritise frequently accessed, recent or contextually relevant information while allowing less essential data to fade.
Self-Improving Pipelines: The Future of Data Engineering
Perhaps most intriguingly, Cognee implements evolutionary pipelines that automatically optimise themselves. Here’s how it works:
- Initial Setup: Define test sets with question-answer pairs relevant to your domain
- Pipeline Execution: Process data through various chunking, embedding and graph generation strategies
- Evaluation: Assess results against the test set to measure performance
- Optimisation Loop: Automatically adjust parameters like chunk size, LLM selection and data models based on performance metrics
- Convergence: Stop when the system passes both training and validation tests
“We can avoid tweaking chunk sizes and all these factors in GraphRAG pipelines that are time-consuming and ineffective,” Vasilije noted. This automation addresses one of the most significant pain points in production RAG systems: the manual optimisation of countless parameters.
Code Graph: A Specialised Implementation
Vasilije also showed their specialised CodeGraph application, a knowledge graph that models the Python codebase at multiple levels of granularity. Instead of relying solely on embeddings, this system creates detailed graph representations of codebases, including:
- Class instances and relationships
- Function calls and dependencies
- Variable connections across files
- Operator usage and expressions
“The current way they do it is create embeddings, store something in a vector store and hope for the best,” Vasilije explained. “We’re trying to narrow it down and give them a searchable space that makes sense.”
The Growing GraphRAG Ecosystem
The session highlighted the explosive growth in GraphRAG implementations. “I’ve seen another five projects in the last week,” Vasilije observed. “When we started, this didn’t have a name – it was just a concept.”
This rapid evolution reflects the broader trend toward more sophisticated AI memory systems. As token costs decrease and processing speeds increase, the industry moves from batch processing to real-time, streaming approaches that can continuously adapt and improve.
Production Considerations and Scalability
One key differentiator of Cognee’s approach is its focus on production readiness. The system addresses common scaling challenges in GraphRAG implementations:
- Data engineering integration: Built-in normalisation and standardisation using DLT (Data Load Tool)
- Merge ID generation: Ensures reproducible pipeline runs
- Parallel and sequential task execution: Flexible pipeline orchestration
- Multiple database support: Seamless switching between development and production environments
“Most GraphRAG issues happen because there’s not enough data engineering,” Vasilije emphasised. “We use DLT behind the scenes for JSON normalisation and standardisation.”
Looking Forward: The Probabilistic Future
Vasilije’s vision extends beyond current implementations toward “probabilistic data warehouses” where entities continuously evolve based on their utility in answering questions. This represents a fundamental shift from the deterministic world of traditional relational databases.
“We moved from relational data that I could map one-to-one and always know what’s true or false to probabilistic systems,” he noted. “Most of our job now becomes not only building these things but making sure they work – moving from 70% to 90% accuracy while avoiding scenarios where your chatbot gives free coupons to customers incorrectly.”
Getting Started with Dynamic GraphRAG
Cognee is available as an open-source Python library on GitHub for developers interested in experimenting with these concepts. The project includes Colab notebooks for hands-on experimentation and comprehensive documentation covering various use cases.
The session demonstrated that the future of AI memory systems lies not in static knowledge graphs but in dynamic, evolving representations that mirror human cognitive processes. As these systems mature, they promise to unlock new levels of accuracy and efficiency in AI applications across industries.
Whether you’re building coding assistants, document analysis systems or conversational AI, the principles demonstrated in this session offer a roadmap toward more sophisticated and reliable AI memory architectures.
Key Takeaways for Developers
Consider Dynamic Relationships: Move beyond static graph relationships by implementing weights that evolve based on recency, frequency and contextual relevance. This simple change can significantly improve retrieval accuracy.
Automate Parameter Optimization: Instead of manually tuning chunk sizes, embedding models and retrieval strategies, implement evolutionary pipelines that automatically optimise these parameters against test sets.
Think Beyond Vector Stores: While embeddings are powerful, combining them with structured graph representations (especially for code repositories) provides more precise and navigable search spaces.
Plan for Production Scale: Incorporate proper data engineering from the start. Use data normalisation and ensure your pipeline can handle terabytes of data, not just megabytes.
Embrace Probabilistic Systems: Accept that AI systems will provide probabilistic rather than deterministic results. Focus on building robust evaluation frameworks that measure and improve accuracy over time.
Consider Cognitive Science Models: Human memory research offers proven frameworks for information organization and retrieval that can be adapted for AI systems.
Additional Resources
GraphRAG Learning Path on GraphAcademy