Skip to content

Operations

Operation Mechanism API Cost
Index There is no separate index. A node’s key is its centre μk\mu_k, recomputed from SkS_k when needed; searching is comparing with the max_nodes centres. O(Kd)O(Kd)
Assign Posterior over the nodes and new story (The read). Memory.step, Memory.read O(Kd)O(Kd)
Insert Add zz to SS and 1 to NN of the winning node, or spread it with soft write. inside step O(Kd)O(Kd)
Create Birth: a free row with S=zS = z, N=1N = 1, n=n0n = n_0. inside step; Step.born O(d)O(d)
Update Not a separate operation: every insertion moves the centre and changes the concentration of its node.
Delete Gradual forgetting (always), expiry below a mass (expiry), and eviction of the lightest node when the table is full and another is born. History.ended records when each node left O(K)O(K)
Nearest nodes now Cosine between a query and the centres of the active nodes. Memory.nearest O(Kd)O(Kd)
Retrieve by query at a date Cosine between a query and the centre of each node’s items in a window around the date. History.query O(n)O(n)
Items of a node From the record, not from the memory. History.items, History.exemplars O(n)O(n)
Nodes alive at a date Forgotten mass of each node at that time, from the record. History.active O(n)O(n)
Reconstruct The statistics are sums, so a node’s mass and centre at any past time are recomputed from the record: exactly with hard write, from each item’s share in its own node with soft write. History.masses, History.trajectory O(n)O(n)
Merge Possible and exact, by adding SS, NN and nn. Not provided: in the paper’s error analysis, merging nodes with similar centres would merge mostly different stories.

With max_nodes = 256 and d = 256, a step compares the item with 256 centres of 256 numbers: about 0.4 ms in NumPy on one CPU thread, independent of how many items came before. In practice the sentence encoder costs far more per item.