📣 We added multi-turn memory to RAG across three frameworks. The LoC gap is the widest in the entire benchmark series. SynapseKit: 6 lines. One constructor argument. memory_window=5 and you're done. LlamaIndex: 9 lines. Token-budget buffer — more predictable prompt sizes than turn-count windows. LangChain: 17 lines. Session store, LCEL wiring, explicit config on every invocation. That's not the interesting part though. The persistence story is what actually matters for production. → SynapseKit — in-memory only. Session ends, history gone. → LlamaIndex — JSON file. Lightweight, no multi-user sessions. → LangChain — Redis, DynamoDB, Postgres. Swap backends with one import change. If you're building a multi-user app, LangChain is the only one that gives you proper session persistence out of the box. The 17 lines are the price of that flexibility. It's worth paying. The thing most engineers miss when adding memory: Memory and RAG compete for the same token budget. Most teams wire in memory and never adjust retrieval depth. Context grows. At some point something gets truncated — silently. The retrieved documents get cut first. The model starts answering from memory instead of documents. Retrieval quality degrades. The answers still sound coherent. Nobody notices until a user catches a hallucination. Do the maths before you hit the limit. Pick the framework that matches where your app needs to be in six months, not where it is today. Full benchmark + reproducible Kaggle notebook → engineersofai.com #Python #AI #LLM #RAG #MLEngineering #OpenSource #AIEngineering #EngineersOfAI #SynapseKit
RAG Frameworks Compared: Persistence and Memory Considerations
More Relevant Posts
-
𝐃𝐚𝐲 𝟕 𝐨𝐟 𝐁𝐮𝐢𝐥𝐝 𝐒𝐜𝐚𝐥𝐚𝐛𝐥𝐞 𝐚𝐧𝐝 𝐄𝐟𝐟𝐢𝐜𝐢𝐞𝐧𝐭 𝐒𝐨𝐥𝐮𝐭𝐢𝐨𝐧𝐬 𝐭𝐨 𝐑𝐞𝐚𝐥-𝐖𝐨𝐫𝐥𝐝 𝐂𝐨𝐝𝐢𝐧𝐠 𝐏𝐫𝐨𝐛𝐥𝐞𝐦𝐬 : 𝐂𝐚𝐜𝐡𝐢𝐧𝐠 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐢𝐞𝐬: 𝐈𝐦𝐩𝐫𝐨𝐯𝐢𝐧𝐠 𝐏𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐜𝐞 𝐰𝐢𝐭𝐡 𝐌𝐞𝐦𝐨𝐢𝐳𝐚𝐭𝐢𝐨𝐧 𝐚𝐧𝐝 𝐋𝐑𝐔 𝐂𝐚𝐜𝐡𝐞 Let's talk caching strategies! When building scalable solutions, performance bottlenecks are inevitable. Memoization and LRU (Least Recently Used) caches are your allies in optimizing performance. Memoization is a powerful optimization technique where you store the results of expensive function calls and reuse them when the same inputs occur again. Think of it as remembering the answers to avoid re-calculation. LRU cache, on the other hand, focuses on eviction. It removes the least recently accessed items when the cache is full, ensuring you're always storing the most relevant data. Here's a lesser-known point: You can combine memoization and LRU caches! Libraries like `functools.lru_cache` in Python seamlessly integrate both, providing efficient storage and retrieval. This combo is especially useful when dealing with computationally intensive functions that also have limited input variability. What caching strategies have you found most effective in your projects, and what were the specific performance gains? #Caching #Memoization #LRUCache #Algorithms #DataStructures #SoftwareEngineering #PerformanceOptimization
To view or add a comment, sign in
-
-
Barq-DB v2 is now released. This iteration focuses on moving beyond a simple vector store into a more structured retrieval system. Key improvements in v2: - Disk-backed vector storage with memory control (mmap + eviction) - Async ingestion pipeline with batching and backpressure - Segment lifecycle (Growing → Sealed → Compacted) for long-running stability - Hybrid retrieval with vector + BM25 using Reciprocal Rank Fusion (RRF) - gRPC-first API with SDK alignment (Python, TypeScript, Go, Rust) - Observability across ingestion, storage, indexing, and query execution This iteration was also influenced by a recent discussion with Isham Rashik around real-world scaling issues in vector databases, particularly memory pressure and system stability. That conversation pushed me to revisit and tighten several parts of the architecture. One important change in this release is being explicit about system behavior under real workloads. The cluster layer now supports sharding with runtime consensus-backed replication. In multi-node replicated setups, writes are committed through quorum before acknowledgment, instead of simple routed replication. The goal with v2 was not to add more features, but to make the system behave predictably under load and give better control over ingestion, memory, and distributed writes. Benchmarking is no longer synthetic. The benchmark harness now executes live ingestion and query workloads, with CI-backed runs to validate behavior continuously. Still more work to do, especially around large-scale validation and long-running distributed scenarios, but this is a solid step toward a more production-oriented retrieval foundation. Repo: https://lnkd.in/e8br-22r #AI #MachineLearning #VectorDatabase #SemanticSearch #RAG #SearchSystems #DistributedSystems #RustLang #BackendEngineering #DataEngineering #OpenSource
To view or add a comment, sign in
-
-
My RAG demo worked perfectly. My RAG deployment did not. 50 users hit it at the same time. Response times spiked. Rate limits kicked in. I was paying for the same embedding call over and over. Demo performance and production performance are not the same thing. This article covers every fix: → Async processing for concurrent users → Caching at the LLM and query layer → Retry logic for rate limits → Document update pipelines → Per-user session management → Observability and logging Part 9 of my LangChain + RAG series. https://lnkd.in/g9QeXAwc #RAG #Python #AI #GenerativeAI #MachineLearning
To view or add a comment, sign in
-
@betterdb/agent-cache now speaks Python. pip install betterdb-agent-cache Same three tiers as the TS package (LLM, tool, session). Same adapters for OpenAI, Anthropic, LangChain, LangGraph, LlamaIndex. Works on vanilla Valkey 7+. No RedisJSON, no RediSearch. Also new in this release (TS and Python): bundled default cost table from LiteLLM, 1,900+ models. Zero config. Override what you need, keep the rest. https://betterdb.com/ai #Valkey #Redis #AI #LLM #OpenSource #AIagents #LangChain #LangGraph
To view or add a comment, sign in
-
IT Trends Digest – April 16, 2026 Graphify launched as a GraphRAG-based knowledge graph skill for codebases, using deterministic AST extraction for code structure and parallel Claude subagents for docs and images — delivering 71.5x fewer tokens per query compared to reading raw files. Microsoft's MarkItDown, a Python tool that converts any document (DOCX, PDF, Excel, images, audio, YouTube URLs) to LLM-ready Markdown, crossed 91K GitHub stars and added MCP server support for direct integration with Claude Desktop and other agents. Google released TimesFM 2.5, a 200M-parameter time-series foundation model with a 16,000-step context window, now generally available in BigQuery. On the language side, Scala 3.8 marked a milestone: the standard library is now compiled by Scala 3 itself, with a JDK 17 baseline, stabilized Better Fors (SIP-62), and `:dep` in the REPL. Key topics: ・Graphify: GraphRAG + AST for codebases, 71.5x token reduction, 20 languages, no central relay ・Microsoft MarkItDown: 91K stars, MCP server, any doc → Markdown (DOCX/PDF/images/audio/YouTube) ・Google TimesFM 2.5: 200M params, 16K context, quantile head, XReg support, BigQuery GA ・Scala 3.8: stdlib compiled by Scala 3, JDK 17 baseline, Better Fors stable, REPL :dep ・Scala 3.9 LTS: feature-frozen, arriving Q2 2026 as the new production stable target Read more 👇 https://lnkd.in/gjxAUjfX #ITTrends #AI #Technology #Engineer #Programming
To view or add a comment, sign in
-
𝗜 𝗰𝘂𝘁 𝗮𝗻 𝗘𝗧𝗟 𝗽𝗶𝗽𝗲𝗹𝗶𝗻𝗲'𝘀 𝗽𝗿𝗲𝗽𝗿𝗼𝗰𝗲𝘀𝘀𝗶𝗻𝗴 𝗹𝗮𝘁𝗲𝗻𝗰𝘆 𝗯𝘆 𝟳𝟬%. Three things worked. Only one of them was the one I expected. The context: we were processing 𝟱𝟬𝟬𝗞+ (𝗶𝗻𝘃𝗼𝗶𝗰𝗲𝘀) 𝗿𝗲𝗰𝗼𝗿𝗱𝘀 𝗮 𝘄𝗲𝗲𝗸. The pipeline was quietly becoming the bottleneck for every downstream dashboard. Management wanted more data ingested, not less — so optimization wasn't optional. 𝗛𝗲𝗿𝗲'𝘀 𝘄𝗵𝗮𝘁 𝗮𝗰𝘁𝘂𝗮𝗹𝗹𝘆 𝗺𝗼𝘃𝗲𝗱 𝘁𝗵𝗲 𝗻𝗲𝗲𝗱𝗹𝗲: 𝟭. 𝗣𝗿𝗼𝗳𝗶𝗹𝗲 𝗯𝗲𝗳𝗼𝗿𝗲 𝘆𝗼𝘂 𝗼𝗽𝘁𝗶𝗺𝗶𝘇𝗲. My instinct was to parallelize first. The profiler told me 60% of the time was spent in a single nested loop doing membership checks against a list. Swapping the list for a set closed most of the gap before I wrote a single worker. 𝟮. 𝗜/𝗢-𝗯𝗼𝘂𝗻𝗱 𝘄𝗼𝗿𝗸 𝗱𝗼𝗲𝘀𝗻'𝘁 𝗰𝗮𝗿𝗲 𝗮𝗯𝗼𝘂𝘁 𝗰𝗼𝗿𝗲𝘀. I assumed multiprocessing would win. The CPU-bound transforms benefited less than expected. The biggest jump came from batching database writes and running them concurrently against the sink — not from parallelizing the Python code. 𝟯. 𝗕𝗼𝗿𝗶𝗻𝗴 𝗯𝗲𝗮𝘁𝘀 𝗰𝗹𝗲𝘃𝗲𝗿, 𝗮𝗹𝗺𝗼𝘀𝘁 𝗮𝗹𝘄𝗮𝘆𝘀. A weekly-batch analysis showed ~50% of our records didn't actually change week-over-week. A simple content-hash cache skipped all of that redundant work. Five lines of code. Bigger impact than the parallelism refactor. The takeaway I keep coming back to: measure first, then pick the cheapest fix that matches the real bottleneck. Engineers (me included) love the interesting solutions. The boring ones usually win. So tell me :— What's the most embarrassingly simple fix that ever saved you a week? #softwareengineering #python #backend #dataengineering #learninginpublic
To view or add a comment, sign in
-
I built a recommendation engine that had to respond in under 200ms. Here's what I learned about the gap between "it works" and "it works at scale." The first version was straightforward. Python service, takes user behavioral data, scores items, returns a ranked list. In development it worked great. In production with real traffic, it was way too slow. The problem wasn't the algorithm. It was when we were doing the work. We were computing recommendations at request time. Every API call triggered a fresh scoring pass over the dataset. At low traffic, fine. At real traffic, timeouts. The fix was separating the work into two parts: → Precompute: a background pipeline that scored and ranked recommendations ahead of time based on behavioral signals, then wrote the results to Redis → Serve: the API just read from Redis. No computation at request time. Sub-200ms, consistently. But the harder part wasn't the caching. It was knowing which strategy to trust. We had multiple ranking approaches. Instead of picking one based on gut feeling, we ran them side by side and compared on three signals: 1. Engagement: did users actually click/act on what we recommended? 2. Latency: did the serving path stay fast? 3. Coverage: were we recommending the same 20 items to everyone, or actually personalizing? That comparison was more valuable than any single optimization. It turned "we think this ranking is better" into "here's the data, pick the tradeoff you want." The takeaway: personalization is easy to demo and hard to ship. The difference is knowing what to precompute, what to serve live, and having the discipline to measure which approach actually works instead of guessing. #softwareengineering #python #recommendationsystems
To view or add a comment, sign in
-
🚀 Case Study Part 2 – I made my graph database index its own codebase. Last month I shared Cypherlite, the embedded graph DB I've been building on evenings (beer first to take the edge off the day, Rust compiler second to put it back). The natural next step: point its indexer at its own source code, store the whole project as a graph, and query my own architecture in Cypher. Three things came out of it I didn't quite expect: → The indexer found 4 real bugs in Cypherlite within minutes — valid Cypher that worked in Neo4j but broke in mine. 579 unit tests had missed all four. Embarrassing, in roughly inverse proportion to how proud I'd been of the test count the day before. → Switching from syn to rust-analyzer's LSP doubled the CALLS edges from 4k to 8k. The compiler resolves trait dispatch and method targets that pure AST parsing simply can't see. → Linking 426 Gherkin scenarios into the same graph gives rough impact analysis: "how many features touch this function?" — three hops in Cypher, instant answer. Before I touch the code, I know roughly how much I'm signing up for. Honest note on how this gets built: I hand-write the core — grammar, planner, executor, storage layout. The ecosystem around it (indexer, CLI, MCP server, benchmark generator) I mostly Claude'd around. The interesting parts get my evenings; JSON-RPC plumbing doesn't. Important note: still not an open-source release, still not a product. This is part 2 of the series — a continued case study of what I've been building and learning with it on the side. More coming over the next weeks. If you're into Rust, graph queries, dev tooling, or the AI-coding labor split, feel free to check it out: 👉 https://lnkd.in/dMw2HYWF #Rust #GraphDatabase #Cypher #DatabaseEngineering #Dogfooding #RustInPublic #velr #RustLang #DrunkRusting #AfterHoursCoders #ClaudeCode
To view or add a comment, sign in
-
#Day_23/100: Before I finalise HERVEX — I want to get this right. For the past 13 project days, I've been building HERVEX — an autonomous AI Agent API from scratch. The full pipeline is now connected: Goal Intake → Planner → Task Queue → Executor → Tools → Memory → Aggregator → Final Result Here's what's under the hood: → FastAPI receives a goal in plain English and returns a session ID instantly → Groq (llama-3.3-70b) breaks the goal into an ordered task list → Celery + Redis queues and executes tasks in the background → Tavily web search gives the agent real internet access → Redis memory keeps context alive across every task in the session → The aggregator sends all results back to the LLM for one final coherent response → MongoDB persists everything — goals, tasks, runs, and final results Phase 8 is next — refinements, additional tools, testing, and documentation. But before I close this out, I want to ask the people who've built things like this: What should I double-check? What edge cases am I likely missing? What would you add or remove before calling it production-ready? Specifically, I'm thinking about: → Error recovery — what happens if a task fails mid-run? → Rate limiting — protecting the API from abuse → Tool reliability — what if Tavily returns empty results? → LLM hallucination — how do I validate agent outputs? → Observability — logging, tracing, monitoring If you've built agentic systems, autonomous pipelines, or production backends — I'd genuinely value your input. Drop your thoughts in the comments or DM me. Stack: Python · FastAPI · Groq · Celery · Redis · MongoDB · Tavily #BuildingInPublic #AgenticAI #BackendEngineering #Python #FastAPI #HERVEX #AIAgents #100DaysOfCode #ProjectDay13
To view or add a comment, sign in
-
🚀 Day 94 of 100 Days of DSA 📌 LeetCode #454 (4Sum II) 📈 "Consistency over motivation, Progress over perfection" A great example of how breaking a problem into parts can reduce complexity drastically. 🧩 Problem Statement Given four integer arrays A, B, C, and D (all of size n): Count the number of tuples (i, j, k, l) such that: A[i] + B[j] + C[k] + D[l] = 0 🧠 Thought Process At first glance: Four nested loops → check all combinations But that quickly raises a concern: ⚠️ Time complexity explodes 🚫 Brute Force Approach 1. Use 4 nested loops 2. Check every possible combination Complexity: • Time → O(n⁴) ❌ • Completely impractical for larger inputs 🔍 Key Insight Instead of solving for 4 variables at once: Break the equation: A[i] + B[j] = -(C[k] + D[l]) Now: • Compute sums of pairs from A & B • Compute sums of pairs from C & D 💡 Core Idea Reduce: 4-sum problem → 2-sum problem This is the turning point. 🔄 Intermediate Optimization 1. Store all sums of A + B 2. Store all sums of C + D 3. For each sum in AB, find matching -sum in CD ✅ Approach Used Two arrays of pair sums + Binary Search ⚙️ Strategy 1. Generate all pair sums: • AB = A[i] + B[j] • CD = C[k] + D[l] 2. Sort one of them (CD) 3. For each value in AB: • Search how many times -value exists in CD • Use binary search (equal range) 4. Accumulate counts 💡 Intuition Instead of checking quadruples: Precompute pair interactions Then match complements efficiently. ⏱ Complexity Analysis Time Complexity: • Pair sums → O(n²) • Sorting → O(n² log n) • Searching → O(n² log n) Overall → O(n² log n) Space Complexity: O(n²) 💡 Key Learnings - Breaking problems reduces complexity significantly - Transforming equations can simplify logic - Precomputation is powerful in multi-loop problems - Binary search works well with sorted intermediate results #100DaysOfDSA #Day94 #LeetCode #Hashing #BinarySearch #Algorithms #DSA #CodingJourney
To view or add a comment, sign in
-
More from this author
Explore related topics
- AI Language Model Benchmarks
- How to Improve RAG Retrieval Methods
- LLaMA 3 Applications in Machine Learning
- How to Use RAG Architecture for Better Information Retrieval
- Understanding the Role of Rag in AI Applications
- How to Improve Memory Management in AI
- How to Improve AI Using Rag Techniques
- How to Reduce Hallucinations in Language Models
- Guide to Meta Llama Large Language Models
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development