Skip to main content
Reference

Prompt Reference

Key prompt templates used for evaluation and generation in the Mem0 paper

The Mem0 paper publicly releases three categories of key prompt templates. This page provides streamlined versions for reuse.

LLM-as-a-Judge Scoring Template

Uses another LLM to judge whether a generated answer is correct, outputting CORRECT or WRONG.
Your task is to label an answer to a question as "CORRECT" or "WRONG".
You will be given: (1) a question, (2) a gold answer, (3) a generated answer.

Grading rules:
- Be generous: as long as the generated answer touches the same topic
  as the gold answer, count it as CORRECT.
- For time-related questions, accept relative time references that map
  to the same date; accept different formats (e.g., "May 7th" vs "7 May").

Question: {question}
Gold answer: {gold_answer}
Generated answer: {generated_answer}

Return only a JSON object with key "label", value "CORRECT" or "WRONG".
J scores are mean ± standard deviation over 10 independent evaluations to avoid randomness from LLM scoring affecting conclusions.

Mem0 Answer Generation Template

Guides the LLM to answer questions based on memories from two speakers.
You are an intelligent memory assistant.

CONTEXT: memories from two speakers with timestamps.

INSTRUCTIONS:
1. Analyze memories from both speakers.
2. Use timestamps to resolve time references
   (e.g., "last year" relative to memory timestamp).
3. Prefer the most recent memory when contradictions appear.
4. Do not confuse character names inside memories with the users.
5. Convert relative time references to absolute dates.
6. The final answer should be < 5-6 words.

Memories for {speaker_1}: {speaker_1_memories}
Memories for {speaker_2}: {speaker_2_memories}

Question: {question}
Answer:

Mem0g Answer Generation Template

Extends the Mem0 template by additionally injecting graph memories.
(same instructions as Mem0, plus)
5. Analyze the knowledge graph relations to enrich context.

Memories for {speaker_1}: {speaker_1_memories}
Relations for {speaker_1}: {speaker_1_graph_memories}
Memories for {speaker_2}: {speaker_2_memories}
Relations for {speaker_2}: {speaker_2_graph_memories}

Question: {question}
Answer:

Injection Template for OpenAI ChatGPT

Since ChatGPT has no external API to control its memory, evaluation manually injects via prompt:
Please extract relevant information from this conversation and create
memory entries for each user mentioned. Store these memories with the
provided timestamps for future reference.

(1:56 pm on 8 May, 2023) Caroline: Hey Mel! ...
Next: Switch to the other research line and see how ACE Overview handles context itself.