arXiv:2609.01849cs.AISep 2026

Manuscript Offprint

arXiv:2609.01849

SSAKG 2.0: An Open-Source Package for Structural Associative Sequence Memory and Context-Based Retrieval

Przemysław Stokłosa, Janusz A. Starzyk, Paweł Raif

ABSTRACT

This article presents SSAKG 2.0, an open-source software package for constructing and operating Structural Sequential Associative Knowledge Graphs (SSAKGs). An SSAKG represents objects as graph vertices and ordered sequences as structural patterns of graph connections. The resulting sparse graph is used as an associative memory in which complete sequences can be reconstructed from a partial, unordered context. Version 2.0 introduces new algorithms that exploit individual bits of computer memory to efficiently search graph connections. The package is implemented in Python, while performance-critical graph operations are implemented in C and exposed through a Python interface. This hybrid implementation provides a flexible high-level programming environment while reducing the memory and computational overhead associated with large sparse graphs. The algorithms were evaluated using randomly generated numerical sequences, sequences derived from sentences in the NLTK corpus and mRNA sequences. The experiments demonstrate the ability of the package to store and reconstruct sequences from partial contexts and provide a basis for evaluating the effects of graph density, sequence length, and memory size on retrieval performance. SSAKG 2.0 is distributed under the Apache 2.0 open-source license. The package includes documentation and reproducible examples and is publicly available through GitHub and the Python Package Index (PyPI).

Keywords sequence retrieval · context-based association · associative knowledge graphs · graph density · ssakg package

1 Introduction

Associative memory provides a mechanism for retrieving stored information from partial, incomplete, or noisy cues rather than from an explicit address. This idea has played an important role in neural computation and cognitive modeling, leading to a variety of architectures for content-addressable memory, including early correlation-based associative memories, Hopfield networks and sparse distributed memory [1, 2, 3, 4, 5]. Sparse Distributed Memory is particularly relevant to the present work because it demonstrates how sparse connectivity can be used to obtain associative recall while maintaining a relationship between storage capacity and the number of memory connections [6, 3]. Although these approaches differ substantially in their representations and retrieval mechanisms, they share the general objective of recovering stored information on the basis of its content or partial contextual information. A related but distinct problem is the associative storage and retrieval of ordered sequences [7, 8, 9, 10]. In many applications, the information to be recalled is not a single static pattern but an ordered collection of elements whose temporal or positional relationships are essential. Examples include symbolic and numerical sequences, natural-language expressions, biological sequences, behavioral trajectories, and temporal event streams. In such cases, an associative memory must address two related tasks: identifying the elements associated with a partial context and reconstructing, when required, their original order. Sequence storage and retrieval have therefore been investigated using a variety of recurrent neural networks, associative memories, and external-memory architectures.

Structural Associative Knowledge Graphs (SSAKGs) address this problem using a graph-based representation in which objects are represented by vertices and sequences are encoded through structural relationships between them.. Rather than storing every sequence as an independent record, multiple sequences are superimposed within a common graph and may share vertices and connections. A stored sequence can therefore be represented as a structural pattern embedded in the graph, while retrieval is initiated from a context consisting of a subset of its elements. The context may be incomplete and does not necessarily have to preserve the original order of the elements.

The SSAKG model and its basic sequence-reconstruction algorithms were introduced in our previous work [11]. That study investigated the relationship between graph density, memory capacity, and retrieval accuracy and demonstrated that structural graph representations can support context-based sequence reconstruction without storing each sequence as a separate record. Subsequent work further [12] investigated the scalability of sparse graph-based associative memory and compared this approach with modern Hopfield-type architectures [13]. We demonstrate that our approach significantly improves associative memory capacity and search accuracy compared to MHN, while requiring less computer storage for very large memories.

The objective of the present work is different. Rather than introducing a new associative-memory model, this article presents SSAKG 2.0, an open-source and reusable software implementation of the SSAKG framework and its associated algorithms. The package provides a practical environment for constructing, modifying, and querying structural associative memories and for experimenting with alternative sequence representations and retrieval procedures. In this sense, the principal contribution of the present work is not only an algorithmic description, but the transformation of the previously developed model into a documented, extensible, and reproducible software framework.

A particular focus of SSAKG 2.0 is the efficient representation and processing of sparse graph connectivity. Because graph connections are represented by binary information, individual bits of computer memory can be used to encode and search multiple structural relationships efficiently. The package combines a high-level Python interface with performance-critical operations implemented in C. This design allows users to construct and manipulate associative memories through a relatively simple programming interface while performing selected graph operations at the bit level.

The resulting approach differs from architectures in which memory is implemented as an external differentiable resource accessed through an addressing mechanism, such as Neural Turing Machine [14] and Differentiable Neural Computer [15, 16] serves as a good point of contrast: memory is an external resource accessed by the network via an addressing mechanism, whereas In SSAKG, the graph itself constitutes the associative memory: the stored information is represented directly by the connectivity structure, and retrieval is performed by exploiting structural relationships between contextual elements and candidate sequence components.

The package is intended as a general research and experimentation tool rather than as a domain-specific application. The stored elements may represent arbitrary symbols, numerical identifiers, words, or other discrete objects. This allows the same underlying implementation to be applied to different classes of sequence data. In the present study, SSAKG is evaluated primarily through controlled experiments designed to examine the effects of memory size, graph density, sequence length, and context size on retrieval performance. We have provided additional examples on SSAKG's GitHub page [17] to illustrate how the same representation can be applied to a variety of symbolic data using linguistic and biological sequences.

The main contributions of this work are as follows:

(i) An open-source implementation of Structural Associative Knowledge Graph memory for storing and retrieving ordered sequences from partial contextual information.

(ii) A reusable software architecture that separates the high-level Python interface from performance-critical low-level graph operations.

(iii) Bit-level algorithms for representing and searching graph connectivity, implemented through a C extension and integrated with the Python package.

(iv) Algorithms supporting context-based retrieval and ordered sequence reconstruction, including the handling of repeated sequence elements.

(v) An experimental evaluation of the package and its retrieval algorithms under varying memory and sequence conditions.

(vi) A reproducible and extensible software distribution, including documentation, examples, source code, and package availability through public repositories.

The remainder of the paper is organized as follows. Section 2 the basic concepts and notation underlying SSAKG memory. Sections 3–7 describe the sequence representation, storage procedures, retrieval algorithms, and software implementation. Section 8 presents the experimental evaluation. Section 9 discusses the computational properties and limitations and possible future extensions of the package. Finally, Section 10 summarizes the main conclusions.