AI EngineeringInterview preparation
Intermediate·Concept·2 min read

Long-term, semantic, episodic, and user-profile memory

Practice this question

Overview

  • Long-term memory stores selected information beyond one task.
  • Semantic memory contains facts or preferences; episodic memory records past events; user-profile memory contains explicit attributes such as preferred language.
  • These categories overlap and should be defined by application requirements rather than mystical model capabilities.

Why this matters

Returning users benefit from relevant continuity, and agents may need prior verified task outcomes.

An everyday example

A customer profile stores contact preferences; a service history stores prior visits.

A technical example

Profile: preferredLanguage="Gujarati"; episode: claimDraftReviewed with date, source, and user ID.

How it works

  1. Identify candidate memory
  2. Verify/confirm
  3. Attach source, scope, and timestamp
  4. Persist with retention
  5. Retrieve only relevant authorized entries
  6. Update/delete on correction.

Architecture and flow

Verified event/preference → scoped memory store → relevance retrieval → bounded context.

The insurance assistant example

Remember the customer's chosen communication language, but never assume last year's policy remains active.

When to use it

Clear repeated personalization or task-continuity needs with user-visible controls.

When to avoid it

Do not store sensitive medical details or inferred personality labels just because they appeared in chat.

Interview answer

“Long-term memory is curated, scoped, source-backed application data. I distinguish preferences and past events from current business facts.”

Benefits, trade-offs, and production considerations

  • Memory poisoning means malicious or incorrect content becomes future trusted context.
  • Require provenance and write policy, set expiry, allow user correction, and avoid treating retrieval similarity as memory truth.
Adapted from 13_AI.MD · “Long-term, semantic, episodic, and user-profile memory”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.