PowerMem v0.4.0
PowerMem 0.4.0 Release Notes
Release Date: January 20, 2026
We're excited to announce the release of PowerMem 0.4.0! This version introduces significant enhancements to our retrieval capabilities with the addition of sparse vector support, enabling even more accurate and efficient memory search.
🎉 What's New
✨ Sparse Vector Support
PowerMem 0.4.0 introduces sparse vector support, a powerful enhancement to our hybrid retrieval system. Sparse vectors complement our existing dense vector and full-text search capabilities, providing a third dimension of semantic matching that significantly improves search accuracy, especially for keyword-rich queries.
Key Features:
- Enhanced Hybrid Retrieval: Combines dense vector search, full-text search, and sparse vector search for superior retrieval accuracy
- Automatic Sparse Vector Generation: Automatically generates sparse vectors when adding memories (no code changes required)
- Configurable Search Weights: Fine-tune the influence of each search method (vector, full-text, and sparse) through weight configuration
Database Requirements:
- OceanBase >= 4.5.0
- seekdb
Supported Providers:
- Qwen (text-embedding-v4)
🔧 Schema Upgrade & Migration Tools
To help users upgrade existing tables and migrate historical data, we've introduced comprehensive migration tools:
- Schema Upgrade Script: Automatically adds sparse vector support to existing OceanBase tables
- Data Migration Script: Migrates historical data to include sparse vectors with progress tracking and error handling
The migration tools support:
- Batch processing with configurable batch sizes
- Multi-threaded migration for improved performance
- Real-time progress monitoring
- Automatic skip of already migrated records
🧠 User Memory Query Rewriting
PowerMem 0.4.0 introduces intelligent query rewriting for UserMemory, which automatically enhances search queries based on user profiles to improve recall and accuracy.
Key Features:
- Automatic Query Enhancement: Rewrites vague or ambiguous queries using user profile information to make them more precise
- Profile-Based Context: Leverages extracted user profile content to fill in missing context in queries
- Graceful Fallback: Automatically falls back to the original query if profile is missing, query is too short, or rewrite fails
- Configurable: Enable/disable via configuration, with optional custom rewrite instructions
- Transparent Operation: No changes to search API - works seamlessly with existing
UserMemory.search()calls
Configuration:
Enable query rewriting in your configuration:
config = {
# ... other config
"query_rewrite": {
"enabled": True,
# Optional: custom instructions for rewrite behavior
# "prompt": "Rewrite queries to be specific and grounded in the user profile."
}
}Or via environment variables:
QUERY_REWRITE_ENABLED=true
# QUERY_REWRITE_PROMPT= # Optional custom instructionsHow It Works:
When UserMemory.search() is called with user_id and query rewrite is enabled:
- Retrieves the user's profile from the profile store
- Uses LLM to rewrite the query based on profile content
- Executes search with the rewritten query for better results
- Falls back to original query if any step fails
This feature significantly improves search recall by making queries more specific and context-aware based on what the system knows about each user.
📚 Documentation
Comprehensive documentation has been added for sparse vector functionality:
- Sparse Vector Guide: Complete guide on configuring and using sparse vectors
- Sparse Vector Example: Step-by-step tutorial with code examples
- Migration Guide: Detailed instructions for upgrading existing tables and migrating data
🚀 Getting Started
Enable Sparse Vector
Add the following to your .env file:
# Enable sparse vector
SPARSE_VECTOR_ENABLE=true
# Sparse vector embedding configuration
SPARSE_EMBEDDER_PROVIDER=qwen
SPARSE_EMBEDDER_API_KEY=your_api_key
SPARSE_EMBEDDER_MODEL=text-embedding-v4
SPARSE_EMBEDDER_DIMS=1536For New Tables
Simply enable sparse vector in your configuration - no additional steps required:
from powermem import Memory, auto_config
config = auto_config() # Ensure SPARSE_VECTOR_ENABLE=true
memory = Memory(config=config)
# Add memories (automatically generates sparse vectors)
memory.add("Your memory content", user_id="user123")
# Search (automatically uses sparse vector for hybrid search)
results = memory.search("query", user_id="user123")For Existing Tables
Upgrade your existing tables using the migration tools:
from powermem import auto_config
from script import ScriptManager
config = auto_config()
# Step 1: Upgrade schema
ScriptManager.run('upgrade-sparse-vector', config)
# Step 2: Migrate historical data (optional but recommended)
from powermem import Memory
memory = Memory(config=config)
ScriptManager.run('migrate-sparse-vector', memory, batch_size=100, workers=3)🔄 Migration from 0.3.x
For New Installations
No migration needed - simply install 0.4.0 and configure sparse vector if desired.
For Existing Installations
- Upgrade PowerMem:
pip install --upgrade powermem - Configure Sparse Vector: Add sparse vector configuration to your
.envfile - Upgrade Schema (if using OceanBase): Run the upgrade script to add sparse vector support
- Migrate Data (optional): Run the migration script to generate sparse vectors for historical data
Note: Sparse vector is optional. Existing functionality continues to work without sparse vector enabled.
📊 Performance Improvements
With sparse vector support, PowerMem's hybrid retrieval system now provides:
- Better keyword matching: Sparse vectors excel at matching specific terms and keywords
- Improved semantic understanding: Combined with dense vectors, provides comprehensive semantic coverage
- Enhanced search accuracy: Three-way hybrid search (dense + sparse + full-text) delivers superior results
With user memory query rewriting:
- Improved query precision: Ambiguous queries are automatically clarified using user context
- Better recall: Profile-based query enhancement helps retrieve more relevant memories
- Personalized search: Each user's search queries are enhanced based on their unique profile
🐛 Bug Fixes & Improvements
- Improved error handling in vector store operations
- Enhanced logging for sparse vector operations
- Better validation of database version compatibility
📝 Breaking Changes
None. This release is backward compatible with 0.3.x.
🙏 Acknowledgments
Thank you to all contributors and users who provided feedback and helped improve PowerMem!
📖 Resources
- Full Documentation
- Sparse Vector Guide
- User Memory Guide - Includes query rewriting documentation
- Migration Guide
- GitHub Issues
- GitHub Discussions
Upgrade Now: pip install --upgrade powermem
Full Changelog: v0.3.1...v0.4.0