UNSW's NS-Mem Beats Vector Memory on Constrained AI Planning by 12.5%
NS-Mem gives multimodal agents a memory that combines fuzzy vector search with explicit symbolic rules, improving constrained reasoning by up to 12.5%.
ProTakeaways
- NS-Mem adds a symbolic reasoning layer to agent memory, improving constrained queries by 12.5% on M3-Bench.
- Three-layer architecture separates episodic events, semantic entities, and procedural logic with explicit DAGs.
- SK-Gen mines recurring action patterns via PrefixSpan, then verifies them with an LLM filter.
- Hybrid retrieval classifies queries as factual, constraint, or character-based and routes accordingly.
- Deterministic symbolic query functions replace multi-hop LLM retrieval, cutting average rounds from 4.01 to 3.38.
- Source code is publicly available for anyone building long-horizon multimodal agents.
Vector databases have become the default memory for LLM agents, but they hit a wall the moment a query involves hard constraints. Ask an agent what to do next when the bowl at home is broken and a store nearby sells one, and semantic similarity retrieval will happily suggest mixing fruit while ignoring the missing bowl. A new paper from researchers at the University of New South Wales proposes NS-Mem, a neuro-symbolic memory framework that pairs embedding-based recall with explicit procedural graphs so agents can actually reason about dependencies and constraints.
Why vector memory keeps failing at planning
Most multimodal agent memories are vector-centric, relying primarily on neural embeddings for storage and retrieval and sometimes being augmented with lightweight relational structures. That design is fine for what Kahneman calls System 1 reasoning: fuzzy matching, analogies, and associative recall. It falls apart on System 2 tasks like deductive reasoning over dependencies such as understanding prerequisites and ordering, abductive inference from partial observations, and constraint-aware reasoning involving constraint satisfaction or alternative discovery when constraints are violated.
The concrete failure mode is easy to picture. An agent watching a video of Jack making fruit salad has episodic clips about chopping fruit, a broken bowl, and a nearby store. A purely vector-based retrieval system can identify memory fragments mentioning "fruit salad" or "chopped fruits" based on semantic similarity. However, it cannot take into account that the bowl at home is broken or that a store nearby has bowls. Cosine similarity has no notion of "you can't proceed without a bowl."

A three-layer memory that thinks in two modes
NS-Mem organizes memory into three layers that mirror how humans separate raw experience from abstract knowledge:
- Episodic layer: stores fine-grained event descriptions grounded in multimodal perception, each node holding a timestamp, a text description, and its embedding.
- Semantic layer: entity-centric summaries (types, attributes, relationships) that get reinforced rather than duplicated when similar observations arrive.
- Logic layer: the novel piece. Each logic node pairs a neural index vector with a Procedural DAG, plus a set of deterministic query functions.
The Procedural DAG is where symbolic reasoning lives. Nodes include distinguished START and GOAL nodes, edges encode valid step transitions, and each node maps to relevant attributes. DAGs let the system enumerate valid execution paths, filter by attribute constraints, and reason about alternatives when the primary path is blocked. Each logic node also keeps a dual-level index, one embedding for the overall goal and one averaged over step descriptions, so retrieval works whether you ask about "making fruit salad" or a specific action like "chopping."

How the memory builds itself
The construction pipeline, called SK-Gen, runs in five sequential steps once episodic observations have been extracted from video via face embeddings (ArcFace), voice embeddings (ERes2Net), and a vision-language model:
- Action sequence extraction: pull temporally ordered actions from each video's episodic memories.
- Sequential pattern mining: apply PrefixSpan to discover recurring procedural motifs. Unlike set-based mining algorithms, PrefixSpan preserves temporal ordering, so [cut, blanch] is treated as distinct from [blanch, cut].
- Knowledge verification: an LLM filter scores each candidate pattern for whether it represents coherent, reusable knowledge, killing spurious frequent patterns like [pick_up, put_down].
- DAG construction: verified patterns become graphs with START/GOAL nodes, edges, and attributes pulled from associated episodic memories.
- Index generation: compute the goal-level embedding and the mean step-level embedding.
To handle the open-world case where new observations keep streaming in, NS-Mem uses an exponential moving average to nudge index vectors toward current usage patterns without catastrophically forgetting older semantics (default decay β=0.9). Edge transitions in the DAG get simple counting-based updates, which the authors prove converge almost surely to the true underlying probabilities.
Hybrid retrieval that routes by query type
At query time, a lightweight classifier labels incoming questions as factual, constraint, or character. Factual queries get routed to episodic and semantic layers; constraint and character queries bias retrieval toward logic nodes. Once a logic node is found, three deterministic functions do the heavy lifting:
getProcedureWithEvidence(goal)returns the DAG plus the episodic clips that support it.queryStepSequence(goal, C)enumerates all START-to-GOAL paths whose every node satisfies constraint set C.aggregateCharacterBehaviors(person)collects every logic node linked to a given entity for cross-procedure summaries.
These functions are pure graph traversals with theoretical guarantees of determinism, meaning repeated calls with the same input always return the same output. That is a nontrivial property when the alternative is asking an LLM to "figure out" step ordering from a wall of retrieved text.
The numbers
Evaluated on M3-Bench, a long-video question answering benchmark consisting of M3-Bench-robot (100 real-world videos from a robot's perspective) and M3-Bench-web (920 web-sourced videos), NS-Mem hits 53.6% on Web and 34.7% on Robot, beating the previous best M3-Agent by 4.7 and 4.0 absolute points respectively. The interesting breakdown is by query type:
| Query type | M3-Agent | NS-Mem | Delta |
|---|---|---|---|
| Factual | 52.5 | 54.3 | +1.8 |
| Procedural | 23.8 | 35.7 | +11.9 |
| Constrained | 25.0 | 37.5 | +12.5 |
Factual recall barely moves, which makes sense since the semantic layer is doing the same thing vector memory already does. The wins concentrate on procedural and constrained queries, where the DAG traversal replaces multi-hop retrieval chains. On efficiency, average query rounds drop from 4.01 to 3.38 on Robot because symbolic functions like queryStepSequence() can return complete procedural sequences in a single call, eliminating the iterative cycles required by pure neural memory.
What it's actually good for
NS-Mem is most useful when your agent needs to answer questions like "what should the user do next given these constraints" or "which of these paths is still valid." Household robots, tutoring agents that track student progress across sessions, and video-analysis agents that need to reason about procedures over long time horizons are the natural fits. It is less compelling for chatbots doing straight factual QA, where the 1.8-point gain probably doesn't justify the added complexity of pattern mining and DAG construction.
The honest limitations: the logic layer only helps when there is enough repetition in observations for PrefixSpan to mine stable patterns, and the LLM verification step adds latency and cost to construction. There's also a hyperparameter budget (support threshold, gating threshold, retrieval weight) that needs tuning per domain. The source code is available, so teams can experiment with these tradeoffs directly against their own multimodal workloads.