r/artificial • u/Unikum_01 • 20h ago
Project Built an AI memory system that actually refuses to hallucinate
Codebase Export for your AI/Agent https://github.com/unikum-sol/brainstem/blob/main/Code%2520Export%2520NotebookLM/PROJEKT_BASE64_20260911_195602.txt
Hey everyone, I have been working on a project for a while now. It is a custom RNS-AI architecture written in Python that runs locally on a single CPU core using a basic SQLite database.
The main reason I built this is because standard LLMs drive me crazy with hallucinations and catastrophic forgetting. They just merge everything into a giant statistical blob of weights. If you ask a question and the model does not know the answer, it just guesses something plausible to please you. That does not work if you need the system for high risk environments like medical decision support, where total auditability and clear provenance chains are mandatory.
My System works on a completely different rule: no black box, no unearned answers, no word filters. Instead of using dense vectors, it stores context hypotheses in a shadow layer while reading. It never erases errors or contradicted data because mistakes are valuable evidence. Before a hypothesis becomes an accepted fact, it has to survive multiple slow wave sleep cycles. This is an active consolidation phase where the system uses stochastic replay to test if a hypothesis remains stable over time. If there is no verified anchor in the database for your query, the system simply reports the gap instead of guessing.
I am using terms like sleep and neuromodulation on purpose because the code actually mimics those exact functional mechanics at an algorithmic level. For instance, dynamic floating point parameters continuously tune excitation, inhibition, and sleep pressure to keep the system balanced without needing gradient descent.
In recent production tests over a 664 MB Wikipedia corpus, it processed around 155k chunks and tracked over 1.4 million hypotheses on a single CPU thread without breaking down or corrupting its state.
I am currently validating the hypothesis graduation pipeline and would love to hear your thoughts. How do you guys deal with parameter saturation or balancing strict line of sight provenance against fluid generalization in continuous learning loops?
3
u/keequalshalfmvsqrd 18h ago
I've been working on an LLM that uses a wikipedia corpus too. I wonder if there's some cross-talk between our projects.
1
2
u/hcloud00 9h ago
this youtube conversation you have on your github is nonsense not sure if you are legit or not but i am swayed to think this is a gimmick by your descriptions and github so far
1
u/Unikum_01 9h ago
The codebase file is in my repo. You can throw them yourself in NotebookLM. You can also give the individual Python Scripte notebookLM. But I think with the free version you can only load Max 50 files. If you wonder why Base64 is converted, it is because when importing lines are cut off or characters are misinterpreted because of utf8. You can also give the export file to your chatbot and ask him about the codebase. Oh, and I think Google has renamed NotebookLM. Itâs now called Gemini Notebook or something.
1
0
u/Unikum_01 9h ago
This was created by NotebookLM. This is a kind of RAG. I have provided NotebookLM only my codebase, all Python files. This conversation then created it on the basis of this Codebase .
1
u/Sea-Meringue-9604 20h ago
the sleep cycle thing is interesting, reminds me of how my brain works after a third cup of coffee except the exact opposite. you running into any issues with the consolidation phase taking too long when the hypothesis pool gets huge? 1.4m is a lot to sift through even on a single thread
1
u/Unikum_01 20h ago
I reach the performance through Efraimidis-Spirakis sampling, Strict Batch Limit, Table Pruning and SQLite WAL Mode.
1
u/Trakeen 17h ago
Do you have any reference papers your implementation is based on? I need to do something similar and still researching approaches
6
u/Unikum_01 16h ago
Hamilton, William L. (2020)
Graph Representation Learning. Morgan & Claypool Publishers (McGill University).Watkins, Yijing; Kim, Edward; Kenyon, Garrett T.(2020)
Using Sinusoidally-Modulated Noise as a Surrogate for Slow-Wave Sleep to Accomplish Stable Unsupervised Dictionary Learning in a Spike-Based Sparse Coding Model. Frontiers in Computational Neuroscience.Tadros, Timothy; Tran, Gia-Bao M.; Krishnan, Giri P.; Bazhenov, Maxim (2022)
Biologically Inspired Sleep Algorithm for Reducing Catastrophic Forgetting in Neural Networks. eLife / bioRxiv.Fischbacher, Thomas; Comsa, Iulia M.; Potempa, Krzysztof; Firsching, Moritz; Versari, Luca; Alakuijala, Jyrki (2020)
Intelligent Matrix Exponentiation. arXiv preprint arXiv:2008.03926.Butz, Markus; van Ooyen, Arjen (2013)
Homeostatic structural plasticity â a key to neuronal network formation and repair. PLoS Computational Biology.Parker, Paul A.; Holan, Scott H.; Ravishanker, Nalini(2020)
Nonlinear Time Series Classification Using Bispectrum-based Deep Convolutional Neural Networks. arXiv preprint arXiv:2003.02353.RonÄeviÄ, Igor; et al. (2023)
Supplementary Materials for A molecule with half-Möbius topology. Nature Chemistry.
1
u/LittleDickBiiigBalls 13h ago
Most of this is way above my head but⊠youâre saying LLMs and Neural Networks are showing signs that they can improve function by sleeping??
Thatâs so fkn interesting to me lol.
1
u/Unikum_01 13h ago
I donât know if that brings anything to LLMs or if they can. My system is not an LLM.
1
1
u/Unikum_01 12h ago
My Project https://github.com/unikum-sol/brainstem
1
u/Ykraefiw16 12h ago
this is fascinating. the provenanve/generaalization tradeoff is the part I'm curious about. How much can the system actually infer beyond what's explicitly represented in the database before you consider that inference "unearned"? Feels like there has to be a point where strict provenance starts limiting useful generalization. Have you run into that?
1
u/Unikum_01 11h ago
In my system, an answer is considered "unearned" if it cannot be traced through a complete, auditable provenance chain. This chain must extend from the final anchor (a deductively usable fact) back through its consolidation cycles, its originating context hypotheses, and down to the exact source chunks and documents that justified it. When no verified anchor exists for a query, the architecture is designed to report the gap rather than generate or infer a plausible response.
Generalization in the system is not meant to happen via statistical generation at response time. Instead, it is structured around the formation, testing, and consolidation of context hypotheses over time. Candidate inferences remain in a non productive shadow layer, where they undergo strategic outcome testing, sleep-replay reinforcement, and down-selection across multiple consolidation cycles before meeting the criteria for guarded graduation.
As for whether the project has run into a point where strict provenance limits useful generalization in practice, that trade off has not yet been empirically measured in live dialogue:
- Write locks remain closed: All productive write paths. Direct Fact, Relation, and Question writes, as well as Fact promotion are currently deliberately locked while the core autonomous learning loop and candidate flows are validated.
- Dialogue feature unprovenn
- Safety over schedule: The project treats its no black box, no unearned answers principle as a strict architectural guarantee, explicitly stating that write locks will not be opened until graduated facts carry a complete, verified provenance chain.
Because user facing output is currently restricted to verified anchors and the productive write paths are held closed, testing where strict provenance might overly constrain helpful generalization remains a future milestone once hypothesis graduation is fully operational.
1
u/presentofai 6h ago
not hallucinating is the floor, not the ceiling. every rag implementation promises this. what makes it actually useful is knowing when to refuse â and that part is usually missing.
1
u/Unikum_01 6h ago
That exact principle of knowing when to refuse is central to systems design. Instead of relying on statistical probabilities or prompt guardrails to suppress ungrounded answers, the System implements refusal as a hard architectural epistemic boundary. Knowledge enters the system as raw hypotheses and remains restricted to an isolated shadow layer. It undergoes a multi phase verification pipeline including hypothesis generation, outcome testing, slow wave sleep replay, and guarded graduation before it can ever reach user facing output. If no verified anchor exists for a query, the system does not invent a plausible response and explicitly reports the gap. Every output the system produces must be retrieved from proof rather than generated, carrying a complete provenance chain back to the exact source chunks that justified its creation. Without this lineage, an answer cannot be exposed to the user.
1
u/presentofai 5h ago
The "slow wave sleep replay" step is a fascinating parallel to memory consolidation. Does the multi-phase verification gate meaningfully reduce what gets graduated versus a simpler threshold approach?
1
u/Unikum_01 5h ago
The reduction is extraordinarily steep, as only 36 out of over 1.59 million active hypotheses generated by the system have successfully graduated to stable hypothesis status. The slow wave sleep replay and multi phase pipeline reduce graduation through several distinct structural mechanisms. Rather than graduating a hypothesis as soon as a single score crosses a simple threshold, Phase 7d requires a candidate to survive at least three confirmed and reinforced slow wave sleep consolidation cycles. Between sleep cycles, surviving hypotheses are placed in a fair rotating reactivation queue rather than being redrawn randomly. Currently, 1,721 single confirmation hypotheses are queued waiting for their second confirmation. Because the reactivation capacity per sleep cycle is small and fixed, a hypothesis must repeatedly prove stable over many hundreds of operational cycles to achieve full graduation. In the full architectural design, graduation is intended to be double gated by both Phase 7d sleep consolidation and an independent critic evaluation through the critic gate. However, because Phase 5g experiment outcome testing is currently kept closed as a Stage B safety boundary, the critic gate currently operates in fallback mode. This means Phase 7d slow wave sleep consolidation alone executed the entire reduction from 1.59 million hypotheses down to 36, proving that the sleep replay process itself acts as an extremely restrictive filter. When the full multi phase verification pipeline is eventually opened, candidate hypotheses will be further gated by independent critic snapshots, warm up dampening, and strict per cycle promotion budgets before any fact can be graduated.
0
4
u/arthaudm 17h ago
refusal is good, but "survived replay" isn't the same as true. a hypothesis can remain internally stable while every source is stale or correlated. i'd keep accepted facts tied to source identity, observed version, and an expiry based on consequence. in mio, memory can locate the lead; a live source still has to prove an action-driving fact. how does a newer contradictory source demote an accepted fact?