Enhancing Memory Retrieval Systems Using LangSmith Testing and Evaluation

new_computer · Tech · 2024 · source Agentic: yes · promotional bias: high · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Agentic memory retrieval evaluation

New Computer needed to improve Dot's long-term memory retrieval so the personal AI assistant could retrieve relevant evolving memories accurately while preserving user privacy during evaluation.

Constraints:

Architecture

New Computer used LangSmith to create synthetic-user evaluation datasets for Dot's agentic memory system. Synthetic backstories and conversations seeded memory databases; queries and full memory sets were stored in LangSmith; relevant memories were labeled with an in-house tool; and retrieval methods such as semantic search, keyword search, BM25, and meta-field filtering were compared using precision, recall, and F1. The team also used LangSmith experiment comparison and prompt playground to inspect prompt changes and fix failures.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  synthetic-users["Synthetic users"] --> memory-database["Memory database"]
  memory-database --> langsmith-dataset["LangSmith dataset"]
  langsmith-dataset --> labeling-tool["Labeling tool"]
  labeling-tool --> retrieval-experiment-variants["Retrieval experiment variants"]
  retrieval-experiment-variants --> langsmith-experiment-comparison["LangSmith experiment comparison"]
  langsmith-experiment-comparison --> prompt-playground["Prompt playground"]
  prompt-playground --> dot-conversation-prompt["Dot conversation prompt"]
  dot-conversation-prompt --> memory-database
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Synthetic users LLM-generated backstories and conversations used to preserve privacy during testing. Memory database
Memory database Stores raw memory content plus optional meta-fields such as status and dates. LangSmith dataset
LangSmith dataset Stores synthetic queries and the full available memory set for experiments. Labeling tool
Labeling tool Labels relevant memories for each query and defines evaluation metrics. Retrieval experiment variants
Retrieval experiment variants Runs semantic, keyword, BM25, and meta-field filtering approaches. LangSmith experiment comparison
LangSmith experiment comparison Compares precision, recall, F1, and prompt-change regressions across runs. Prompt playground
Prompt playground Lets the team adjust prompts directly when failures are identified. Dot conversation prompt
Dot conversation prompt Dynamic prompt that combines memories, tool usage, and behavioral instructions for replies. Memory database

Data flow

Synthetic users and conversations seed a memory database. Queries plus all available memories are stored in a LangSmith dataset, relevant memories are labeled, retrieval variants run experiments, precision/recall/F1 identify better retrieval approaches, and prompt changes are inspected in comparison views and adjusted in the playground.

“they generated synthetic data by creating a cohort of synthetic users with LLM-generated backstories.”article, stated
“the team began storing queries (messages by synthetic users) along with the full set of available memories in a LangSmith dataset.”article, stated

Why this architecture

New Computer needed synthetic, measurable memory experiments because Dot's memory is dynamic, user-specific, and privacy-sensitive. LangSmith provided a way to run retrieval variants, inspect regressions, and iterate prompts without relying on real user memories.

“Unlike standard RAG methods that rely on a static set of documents, agentic memory involves dynamically creating or pre-calculating documents that will only be retrieved later.”article, stated
“To test performance while preserving user privacy, they generated synthetic data”article, stated

Models used: Dot · LangSmith · LLM-generated synthetic users · semantic search · BM25

Scale

Alternatives considered (roads not taken)

Use only a simple semantic-search baseline.

Rejected because: Different query types benefited from other methods such as keyword search, BM25, and meta-field filtering.

“they started out with a simple baseline system using semantic search that retrieves a fixed number of the most relevant memories per query.”article, stated

Evaluate on real user memories.

Rejected because: Synthetic users preserved privacy while allowing labeled memory-retrieval experiments.

“To test performance while preserving user privacy, they generated synthetic data”article, stated

Patterns

agent-memory (memory)

Dot dynamically creates and retrieves memories to maintain an evolving picture of the user.

“Dot’s long-term memory system learns users preferences over time by observing verbal and behavioral cues.”article, stated

synthetic-data-generation (evaluation)

Synthetic users and LLM-generated backstories create privacy-preserving retrieval test data.

“creating a cohort of synthetic users with LLM-generated backstories.”article, stated

eval-driven-development (evaluation)

Precision, recall, and F1 experiments guide retrieval-method selection and prompt changes.

“like precision, recall and F1, allowing them to quickly iterate on improving retrieval”article, stated

hybrid-search (retrieval)

The team compared semantic, keyword, BM25, and meta-field filtering retrieval methods across query types.

“one or multiple of semantic, keyword, BM25, meta-field filter techniques”article, stated

Tradeoffs

Evaluation data

Chose Synthetic user cohorts. over Real user memory data..

Rationale: Synthetic data preserved privacy while still exercising memory retrieval.

“To test performance while preserving user privacy, they generated synthetic data”article, stated

Retrieval approach

Chose Experiment across semantic, keyword, BM25, and meta-field filters. over One fixed semantic-search retriever..

Rationale: Different methods performed better for different query types.

“they started out with a simple baseline system using semantic search”article, stated

Gotchas (what bit them)

Agentic memory is not static-document RAG.

Root cause: Memories must be created or structured now so they can be retrieved accurately later.

Resolution: Store structured memory meta-fields and evaluate retrieval over evolving memory sets.

“information must be structured during memory creation in order to make retrieval possible and, as memories accumulate over time, accurate & efficient.”article, stated

Retrieval method performance varies by query type.

Root cause: Some queries work better with similarity search, others with keyword/BM25 or meta-field filters.

Resolution: Run multiple retrieval experiments quickly in LangSmith.

“In some cases, similarity search or keyword methods like BM25 worked better; in others, these methods required some pre-filtering by meta-fields”article, stated

Prompt improvements can regress other queries.

Root cause: Dot's dynamic prompt combines memories, tool use, and behavioral instructions.

Resolution: Use experiment comparison to inspect global effects and prompt playground to adjust failures.

“a change that improves one query can have detrimental effects on others.”article, stated

Evaluation

New Computer used labeled synthetic-user datasets in LangSmith, evaluated retrieval variants with precision, recall, and F1, and used experiment comparison plus prompt playground for prompt regressions.

Metrics: Recall · Precision · F1 · Regressed prompt runs · Paid-tier conversion after free message limit

“like precision, recall and F1, allowing them to quickly iterate on improving retrieval”article, stated
“leading to 50% higher recall and 40% higher precision compared to a previous baseline implementation”article, stated

Outcomes

The source reports 50% higher recall, 40% higher precision, and over 45% paid conversion after users hit the free message limit.

“These experiments enabled New Computer to significantly improve their memory systems”article, stated