lerim
lerim copied to clipboard
MiniMax-M2.5 doesn't distinguish user vs assistant content in extraction
Problem
The extraction prompt includes "only extract what the USER decided, preferred, or learned" but MiniMax-M2.5 doesn't follow this well. It extracts assistant-generated explanations as "learnings."
Examples
From a session where the assistant explained Claude Code features:
- "Effort levels: low, medium, high, and max (Opus 4.6 only)" — this is Claude Code documentation the assistant recited, not a user learning
- "Claude Code effort precedence order" — same
- "Status line customization via settings.json" — same
- 5 near-duplicate memories about "effort level configuration" that should be 1
Context
This was discovered during the extraction quality improvement work (improved prompts with "future-self test" + DO NOT EXTRACT rules + deterministic filter). The prompt improvements helped (0-candidate sessions now exist, average dropped from 6.3 to ~4.1 candidates/session) but MiniMax-M2.5 doesn't reliably distinguish speakers.
Suggested Approaches
- Pre-process transcript with speaker labels: Before passing to DSPy, annotate each message with
[USER]/[ASSISTANT]prefixes so the model can clearly see who said what - Post-extraction filter: Check if the memory body contains phrases typical of assistant explanations (documentation-style language, feature descriptions)
- Use stronger model for extraction: Test with Claude Haiku or GPT-4o-mini which may follow the speaker distinction better
- Add few-shot examples: Use DSPy's
dspy.Examplemechanism to show the model what user-vs-assistant distinction looks like
Files
src/lerim/memory/extract_pipeline.py—MemoryExtractSignaturedocstringsrc/lerim/memory/schemas.py—source_speakerfield (already added)
🤖 Generated with Claude Code