Source-linked AI summary
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
TL;DR
Associative memories must retrieve ordered sequences from partial, potentially unordered contexts, but the paper focuses on making the SSAKG model reusable and experimentally accessible. SSAKG 2.0 provides a Python-and-C implementation with bit-level graph algorithms, and the reported results show improved accuracy and several-fold greater capacity than the conventional implementation. The package is released openly for further investigation, while its evaluation remains limited in important ways.
Problem
Ordered-sequence associative retrieval requires identifying elements from partial contexts and reconstructing their original order.
Method
SSAKG 2.0 implements shared graph-based sequence memory with bit-level position representation, Python access, and C-based graph operations.
Results
The bit-based algorithm produced substantially lower reconstruction error, improved accuracy, and a several-fold increase in associative memory capacity over the conventional implementation.
Takeaways & Limitations
SSAKG 2.0 provides an open-source, reusable framework for constructing, querying, and experimenting with structural associative sequence memory.
Takeaways & Limitations
The evaluation is limited to randomly generated numerical sequences and does not systematically measure execution time, memory consumption, scalability, or alternative implementations.
Abstract
from arXiv · showhide
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).
1 Introduction
SSAKG 2.0 turns structural associative sequence memory into an open-source, reusable software framework for reconstructing ordered sequences from partial contexts. It combines graph-based storage with bit-level connectivity processing and evaluates retrieval under varied memory and sequence conditions.
- Problem: Ordered-sequence retrieval requires identifying elements from partial context and reconstructing their original order.The problem applies to symbolic, numerical, linguistic, biological, behavioral, and temporal sequences.
- Approach: SSAKGs superimpose multiple sequences in a shared graph whose structural relationships encode sequence information.Retrieval starts from a subset of sequence elements rather than an explicit record address.
- Contribution: SSAKG 2.0 transforms the previously developed model into a documented, extensible, and reproducible software framework.The package is intended for constructing, modifying, querying, and experimenting with structural associative memories.
- Implementation: Bit-level algorithms represent and search sparse graph connectivity through a C extension exposed by a high-level Python interface.This design separates user-facing programming from performance-critical graph operations.
- Evaluation: The package evaluates retrieval under varying memory size, graph density, sequence length, and context conditions.The evaluation is framed as a research and experimentation tool for arbitrary discrete sequence elements.
- Distribution: SSAKG 2.0 is distributed with documentation, examples, source code, and public package access.The paper describes a reproducible distribution through public repositories.
2 Preliminaries
SSAKG represents ordered symbolic sequences as structural patterns in a shared graph and retrieves them from partial, potentially unordered contexts. Sequence elements map to graph vertices, while graph edges and adjacency structure encode the relationships used during reconstruction.
- Sequence memory: SSAKG targets reconstruction of ordered sequences from partial and potentially unordered subsets of their elements.Unlike pattern completion alone, the task preserves sequence order.
- Graph representation: The associative memory graph Gsam has one vertex for each available symbol, with its adjacency matrix stored in computer memory.The graph is defined as Gsam = (V, E), where k = |N| vertices correspond to symbols.
- Storage: Storing a sequence adds the edges required to represent relationships among its mapped vertices.The graph initially contains no edges, and appropriate edges are created during sequence storage.
- Graph representation: A sequence is stored as a structural pattern incorporated into a graph representing the complete associative memory.The sequence-specific graph Gs contributes its relationships to the shared graph Gsam.
- Retrieval: The graph structure determines the information available during retrieval and influences associative-memory efficiency, robustness, and capacity.The adjacency matrix is updated as sequence-specific vertices and edges are incorporated.
- Repeated elements: Repeated symbols are handled by creating new vertices and dynamically expanding the adjacency matrix.This preserves representation of repeated elements within stored sequences.
3 Sequences storage
SSAKG 2.0 stores sequences as structural relationships in a shared graph, enabling retrieval from partial contexts while supporting repeated symbols and ordered representations. The package hides graph construction behind a Python interface and updates the underlying representation during insertion.
- SSAKG 2.0 provides an efficient, reusable, and extensible implementation of the SSAKG model and its sequence-retrieval algorithms.
- Sequences are stored as structural relationships among vertices in a graph shared by all stored sequences, allowing retrieval from partial contextual information.The implementation also preserves sequence order and supports repeated symbols.
- A complete-graph representation associates all sequence elements but cannot recover their original ordering from the representation alone.
- Multiple sequences can be superimposed within one graph, yielding a compact representation but introducing retrieval ambiguity addressed with context and positional information.
- Users provide sequence data through the package interface, which constructs and updates the underlying graph representation instead of requiring explicit adjacency-matrix construction.
4 Context-based unordered sequence retrieval
SSAKG retrieves sequence elements associated with an unordered context by intersecting the context vertices’ graph connections. The resulting binary vector identifies candidate positions, with representation changes enabling inclusion of the context vertices themselves.
- The retrieval operation identifies vertices jointly connected to the elements supplied in a partial context.
- The algorithm computes a Hadamard product of matrix rows corresponding to context symbols; ones in the resulting binary vector mark symbols in the target sequence.
- For context C = {1, 6}, the resulting vector has a non-zero element at position 2, identifying an additional sequence element.
- Adding loops or self-connections allows the representation to return the context vertices as part of the retrieved set.
- Each context element eliminates vertices not connected to it, leaving indices that identify candidate sequence elements.
5 Ordered sequence retrieval
Ordered retrieval extends the graph representation with directed, weighted connections encoding sequence positions. A recursive node-ordering procedure searches candidate orderings, while prioritization uses edge weights and may return an implementation-selected ordering when ambiguity remains.
- A transitive tournament establishes directed connections according to sequence positions, with no outgoing connection required from the last element.
- Weighted transitive tournaments filter edges belonging to other sequences and support more effective ordered-sequence retrieval.
- After unordered elements are retrieved, the software extracts a corresponding submatrix and determines their order despite superimposed connections from other sequences.
- Algorithm 2 recursively prioritizes rows with the expected number of nonzero elements, then removes the selected row and column from the reduced matrix.
- The prioritization function can use graph-edge weights to rank rows containing the largest relevant weight.
- When the graph lacks sufficient information for unique ordering, the procedure may return multiple possibilities and the implementation selects the first.
6 Bit-level sequence retrieval
SSAKG 2.0 represents sequence positions with individual bits in memory cells, then filters superimposed graph connections to recover an ordered sequence. The 64-bit representation supports sequences of up to 64 positions.
- Bit-based representation: Sequence positions are encoded as distinct powers of two, so each position occupies an individual bit in a memory cell.This replaces conventional numerical weights with direct bit-level position information.
- Retrieval pipeline: The retrieval process uses context elements to identify candidate sequence elements before filtering bits belonging to the target sequence.The procedure aims to eliminate bits associated with other stored sequences.
- Bit-level filtering: The filtering algorithm selects the most frequent bit in each row as the candidate for that sequence position and removes other bits.The selected bit is then removed from remaining rows before processing continues.
- Ordered reconstruction: The resulting filtered matrix contains one distinct appropriate bit per row, producing a single sequence ordering.The filtered matrix is subsequently used to remove unwanted elements from the associative-memory matrix.
- Bit-based representation: The implementation supports 16-, 32-, and 64-bit unsigned integers, with the 64-bit representation supporting sequences of up to 64 positions.Sequence-length support is directly bounded by the width of the memory cell.
7 Implementation and memory management
SSAKG 2.0 combines a Python object-oriented interface with C-based memory operations and automatically selected bit widths. Users interact with sequence insertion and retrieval without managing low-level allocation.
- High-level interface: Python manages the user-facing interface and high-level operations for creating memories, inserting sequences, and retrieving stored sequences.The package is organized around an object-oriented Python interface.
- Low-level operations: Performance-critical memory operations are implemented in a C extension.The extension uses NumPy memory-management mechanisms and dynamically allocated character arrays.
- Memory management: The package selects 16-, 32-, or 64-bit memory types according to sequence length and allocates the graph structure according to the number of symbols.This permits smaller cells for shorter sequences while supporting longer sequences through 64-bit cells.
- Architecture: The architecture separates Python-level representation, graph-level associative memory, and low-level C memory operations.Users can populate an associative memory without directly interacting with the C extension or allocation details.
- High-level interface: Users specify the number of symbols and sequence length, then insert sequences through the insert() method while internal representation is handled automatically.The example illustrates the intended abstraction level of the package.
8 Experimental evaluation
Experiments compared bit-based and conventional retrieval under changing storage loads and context lengths. The bit-based implementation maintained much more stable reconstruction accuracy as stored sequences increased and contexts became shorter.
- Evaluation design: The evaluation stored sequences and retrieved them from randomly selected contexts, recording an error when complete reconstruction failed.Complete reconstruction required recovering all sequence elements in the required form.
- Stored-sequence load: The bit-based representation was more robust to additional stored-sequence connections because individual sequence positions remained distinguishable when connections were superimposed.The difference from conventional retrieval became more pronounced as the number of stored sequences increased.
- Context length: Conventional retrieval was strongly affected by context length, with error decreasing from 29.3% at context size three to zero at sizes six or seven for 1,000 stored sequences.The context-length experiment fixed the symbol set at 2,000 and sequence length at 15.
- Interpretation: Overall, bit-based retrieval degraded more slowly with additional stored sequences and maintained better accuracy when contexts contained relatively few elements.The results support bit-level memory cells as an implementation strategy for reducing interference, but not a general capacity limit or computational speedup.
9 Discussion
SSAKG 2.0 packages the SSAKG model as reusable software with Python access, C-based memory operations, and bit-level retrieval algorithms. The discussion identifies scope boundaries in sequence length, filtering assumptions, datasets, and benchmarking.
- Contribution: The primary contribution is a reusable package for constructing associative sequence memories, inserting sequences, and performing context-based retrieval.Performance-critical memory operations are implemented in C behind the Python interface.
- Results: The implementation provides a practical mechanism for reducing retrieval errors caused by superimposed connections from multiple stored sequences.This conclusion is based on the reported experimental results.
- Limitations: The current 64-bit implementation limits supported sequences to 64 positions.Maximum sequence length is tied to the number of available bits in the memory cell.
- Limitations: The filtering strategy assumes that the target-position bit can be identified by its frequency in a row, which may fail under sufficiently high density or particular interference patterns.This is an assumption of the bit-filtering procedure rather than a demonstrated universal failure condition.
- Evaluation scope: The evaluation is limited to randomly generated numerical sequences and reconstruction accuracy, without systematic measurements of execution time, memory consumption, scalability, or alternative implementations.The discussion notes that referenced NLTK and mRNA evaluations are not included in the current Results section.
- Future development: Future development includes longer supported sequences, improved retrieval under higher loads, more diverse datasets, and systematic time and memory benchmarks.The open-source architecture also supports implementing and comparing alternative graph representations and retrieval procedures.
10 Conclusions
SSAKG 2.0 packages structural associative sequence memory in an open-source framework, combining Python with C-based graph operations. Its bit-level algorithms improve capacity, accuracy, and reconstruction error, especially as stored-sequence load increases or context shortens.
- SSAKG 2.0 provides an open-source implementation for storing and retrieving sequences from contextual information.
- A Python interface and C extension support efficient manipulation of the underlying graph memory.
- Bit-level sequence-position representation enables faster, more efficient algorithms, increasing associative-memory capacity several-fold and improving accuracy.
- Bit-based algorithms show substantially lower reconstruction error than conventional implementations as stored-sequence counts increase and available context shortens.
- The package is released under Apache 2.0, with source code and examples on GitHub and a Python package on PyPI.