🧠 Overview
Most AI prompts are too long.
In practice, a large portion of tokens does not contribute to the final output. This leads to higher costs, slower responses, and unnecessary complexity.
MemoryLens was built to make this invisible inefficiency visible.
💡 Inspiration
While analyzing AI-based projects, I noticed recurring issues:
- context window limits
- high API costs
- latency caused by long prompts
The problem was not the model itself, but how prompts were written.
This led to a simple question:
What part of a prompt actually matters?
⚙️ What it does
MemoryLens analyzes prompts and:
- visualizes token usage
- highlights important parts
- removes unnecessary content
- compares original vs compressed outputs
In many cases, prompts can be reduced by 30–50% without changing the result.
🏗 How I built it
The system is designed to minimize reliance on AI:
- Tokenization for exact token counting
- Heuristic-based importance scoring
- Web-based dashboard for visualization
- Optional LLM usage only for compression suggestions
This makes the system fast, stable, and interpretable.
🚧 Challenges
1. Measuring importance
LLMs do not expose which tokens are actually used.
→ Approximated using:
- position
- repetition
- structural relevance
2. Maintaining output quality
Compression is only useful if meaning is preserved.
→ Implemented:
- side-by-side comparison
- similarity estimation
3. Usability
Token analysis can be hard to understand.
→ Solved with:
- heatmaps
- before/after visualization
- simple UI flow
📊 Key Insight
Most of the prompt is not used.
MemoryLens turns this into something measurable and actionable.
🚀 What I learned
- Prompt design strongly impacts cost and performance
- Visualization improves understanding of AI behavior
- Lightweight systems can outperform complex pipelines in reliability
🔮 What's next
Embedding-based learning loop: Upgrade from TF-IDF to semantic embeddings with a continuous feedback loop that improves compression accuracy over time.
LLM-powered verification: Add optional LLM comparison to validate that compressed prompts produce equivalent outputs, moving from estimated to verified compression quality.
🧩 Why it matters
As AI usage scales, efficiency becomes critical.
MemoryLens helps reduce cost and improve performance without changing the model itself.
Built With
- chart.js
- fastapi
- javascript
- python
- react
- tiktoken
Log in or sign up for Devpost to join the conversation.