Intermediate10 min read37 of 40

Retrieval with Feedback Loop

The learning system — collects user feedback after each answer and uses it to improve future retrievals. Gets smarter the more you use it.

Overview

PropertyDetail
PatternRetrieval with Feedback Loop — The Learning System
Level6 (Continuous improvement)
Key InnovationPast feedback re-ranks future retrievals + adds good Q&A pairs to the index
Notebook19_Self_RAG.ipynb

Architecture

flowchart TD
    A[User Query] --> B[Retrieve from Qdrant]
    B --> C["Adjust Scores Using Past Feedback\n(Boost high-rated, demote low-rated)"]
    C --> D["Generate Answer (LLM via Bedrock)"]
    D --> E["User Rates: 1-5"]
    E --> F{"Score >= 4?"}
    F -->|Yes| G["Add Q&A Pair to Qdrant Index"]
    F -->|No| H[Store Feedback Only]
    G --> I["System is Now SMARTER"]
    H --> I
    I -->|Next Query| A

Test Results (Actual Notebook Output)

StepWhat Happened
Query 1"What is the greenhouse effect?" → Retrieved docs → Generated answer
User rates5/5 (great answer)
Feedback storedQuery + docs + score saved
Index growsCollection: 92 → 93 points (added the Q&A pair)
Query 2"How do gases trap heat?"
ResultThe feedback-derived Q&A pair appeared as top result!

The system literally learned from its own good answers.


How Feedback Improves Retrieval

MechanismHow It Works
Score boostingDocs that got 5/5 in past → boosted in future rankings
Score demotionDocs that got 1/5 in past → demoted in rankings
Index expansionHigh-quality Q&A pairs added to Qdrant as new documents
Query memory"This query + these docs = good result" is remembered

When to Use

ScenarioUse Feedback Loop?
Repeated similar queries over timeYes — learns what works
Internal tool used by same teamYes — adapts to team's needs
Public-facing with diverse queriesMaybe — feedback may be noisy
One-shot queries (no repeat users)No — no opportunity to learn

Tech Stack

ComponentTechnology
EmbeddingsAWS Bedrock — Amazon Titan Embed Text v2 (1024 dims)
LLMAWS Bedrock — Claude Sonnet
Vector DBQdrant Cloud (cosine similarity)
Feedback StoreIn-memory (upgradeable to persistent)
FrameworkLangChain

Source