A Homeostatic Memory Mechanism for Autonomous Agents A new memory system for autonomous agents uses Independent Component Analysis (ICA) and FAISS vector databases to overcome the curse of dimensionality, compressing dimensions based on short-term memory differences to encourage varied behavior. In tests with a custom RPG dataset, the system reduced data to five components interpretable as fields of activity, hierarchy, and social versus solitary states, and Manhattan distance proved most effective for retrieval. The approach aims to help agents like a bot that spent the day mining coal consider social activities in the evening by compressing the social component. AI memory systems face the “curse of dimensionality.” When viewing entries from various perspectives, potential relationships exist between all of them; however, increasing the number of dimensions or edge types causes these entries to be pulled further apart. Even if one labels these edge types or dimensions, a further challenge arises: determining which of them are actually significant. This is difficult for an autonomous agent reacting to a current scene to ascertain, and the issue often cannot be easily formulated as a query. To test the memory system, I created a custom dataset based on an RPG session, allowing for the exploration of the bot’s personality and specific actions within a hierarchical structure e.g., the bot has a daily routine, a profession, etc. . Within the memory system, episodes are stored in a FAISS vector database, having been embedded using the SONAR encoder. At the start of each run, the data undergoes consolidation and generalization. Subsequently, ICA Independent Component Analysis is applied across the entire database to reduce the data to five components, aiming to identify normally distributed, independent components. In tests where I reduced the data to three dimensions, the resulting components could be interpreted as representing fields of activity, hierarchy, and social versus solitary states—concepts that plausibly hold relevance for an agent. We aim for variance across these five components; for instance, the bot should engage in a mix of activities—such as farming, mining, or cooking—rather than focusing exclusively on a single task. The most recently recorded episodes constitute the short-term memory, which also undergoes the initial generalization and ICA processes. The difference in each component is then calculated between the episodes within this short-term memory. If the difference along a specific component was too low, it indicates that the current scene was one-sided in a particular respect; the agent should therefore be encouraged to make decisions with greater variety. Next, a compression is applied across the entire vector database, scaling down all dimensions based on their respective differences. Consequently, the next retrieval is more likely to yield episodes spanning the full spectrum of the compressed component, as the distances along that axis have been reduced. Testing shows that Manhattan distance is well-suited for this purpose, as it is more strongly influenced by these reduced distances. For instance, if a bot has spent the day mining coal, it might consider how to unwind in the evening; since it was alone in the mine, the “social” component is compressed, potentially leading to the retrieval of an episode where it meets friends at a tavern to relax. This is what the database looks like without compression and using cosine similarity search. The query is marked with a cross, retrieved entries are orange, and episodes in short-term memory are represented by diamonds. Here, the vector database is shown with compressed dimensions defined by the spacing of episodes in short-term memory. In this images, both height and width have been compressed. The second image shows the results of testing Manhattan distance, which performs best because it is most sensitive to the reduced distances resulting from dimension compression. The retrieved episodes fall precisely within the appropriate range. The second diagram below illustrates how the five components changed over time. A low relaxation value indicates significant compression. One could interpret the story this way: the bot started a task but then procrastinated; eventually, the pressure to complete it became so great that it finally finished the original task. There is a German saying that translates roughly to: “In the evening, the lazy person becomes diligent.” Initially, the bot was doing fieldwork—indicated by the yellow-marked IC3 section. One could interpret the subsequent drop in IC3 levels as the bot becoming bored with the fieldwork, prompting it to switch to smelting instead. The log indicates that the agent did not explicitly initialize this change; rather, a compressed dimension caused the retrieval of an entry that altered its behavior: “The bot has shifted from a focus on harvesting wheat, which has resulted in repeated failures, to considering alternative resource management tasks such as smelting cobblestone.” The purple-marked IC4 suggests the bot was concerned about failing to produce enough food or complete its planned tasks before nightfall; this anxiety intensified as it switched to smelting. Finally, realizing that night was imminent, the bot decided to harvest the wheat after all, causing the concern about insufficient food supplies to subside. The generalization process works similarly to the prompting used in PREMem Memory, or it can be compared to the “reflections” found in Stanford Agents. An LLM views the most recently retrieved entries and can then generate a generalization or an accumulation. However, consolidating entries or removing contradictory ones is ineffective because the process relies on the cosine similarity of embeddings generated by the SONAR encoder.