Hmm, the user wants a system that integrates user feedback to re-rank ML outputs using post-hoc votes and complaint tags. This is a practical engineering problem with both technical and UX considerations.
I need to structure this as an end-to-end system design. First, clarify the core objective: dynamically improving output quality by leveraging explicit (votes) and implicit (complaints) feedback. Then break it down into logical components - from feedback collection to model retraining.
The user likely cares about scalability and real-time performance, so I should emphasize asynchronous processing and low-latency storage choices. The complaint taxonomy is critical too; without structured tags, the feedback loses actionable value.
I’ll highlight trade-offs: simplicity vs. sophistication in re-ranking, and real-time vs. batch retraining. The user might not have considered how feedback loops can degrade if not monitored, so I’ll include safeguards like feedback decay and A/B testing.
Finally, I’ll summarize with key design principles to tie it all together. The response should balance depth with clarity—avoid diving too deep into any single component unless the user follows up.
Excellent. This is a classic Human-in-the-Loop (HITL) / Reinforcement Learning from Human Feedback (RLHF) Lite problem. The goal is to create a closed-loop system where user interactions directly improve the quality and relevance of a generative or retrieval-based ML system (e.g., a chatbot, search engine, recommendation list).
Here is a comprehensive design for a User Feedback Ingestion & Re-ranking System.
1. System Goal & Core Principle
Primary Goal: Improve end-user satisfaction by dynamically re-ranking model outputs based on explicit (votes) and implicit (complaints) feedback, creating a continuous learning loop.
Core Principle: Treat user feedback as a supervisory signal. Votes provide relative preferences (A > B), while complaint tags provide absolute, categorical critiques (e.g., "Inaccurate," "Offensive"). The system combines these signals to learn a better reward function or re-ranking model.
2. High-Level Architecture
The system has 4 main stages:
code
[Model Inference] -> [Serving & Logging] -> [Feedback Ingestion & Processing] -> [Re-ranking Model Training & Deployment]
^ |
| V
+---------------------- [A/B Testing & Evaluation Loop] <----------+
3. Component Breakdown
A. Model Serving & Logging Layer
Function: Generate initial candidate outputs (top-K) and log all interactions with a unique interaction_id.
Key Requirement: Immutable, append-only logging (e.g., to cloud storage bucket, Kafka topic, or dedicated log DB like ClickHouse). Every inference must be logged.
B. Feedback Collection Layer (Frontend/API)
Voting UI: Present outputs in a ranked list (e.g., 1-5). Allow:
Single Selection: "This is the best response."
Pairwise Comparison: "Response A is better than B." (More informative but higher friction).
Thumbs Up/Down per item.
Complaint Tagging UI: A lightweight "Report" button next to each output. Opens a modal with a pre-defined, structured taxonomy of tags.
{
"interaction_id": "uuid_v4", // Links back to the original inference
"feedback_type": "vote | complaint",
"vote": {"selected_rank": 2, "pairwise_selection": {"up": 1, "down": 2}},
"complaint": {
"tag": ["Factually Incorrect", "Off-Topic"],
"comment": "The date is wrong and it didn't answer my question."
},
"user_feedback_timestamp": "iso_8601",
"ui_context": {"position": "side-by-side", "device": "mobile"}
}
C. Feedback Ingestion & Processing Pipeline
This is the core data pipeline (batch/stream).
Ingestion: Receive feedback events via REST API or event stream (Kafka/PubSub).
Input: The original query and the full list of candidates.
Label: The preferred candidate_id. For pairwise, it's a comparison (cand_A > cand_B).
For Complaints: Create a negative example and/or a feature for the re-ranker.
Mark the complained-about candidate as "bad".
Extract the tag as a feature (e.g., "this answer has an 'Inaccuracy' penalty").
Storage:
Feedback DB (PostgreSQL/MySQL): Structured, queryable store of all feedback events (for analytics, monitoring, manual review).
Feature Store / Training Dataset: Write enriched examples (query, candidates, label) to a parquet dataset in cloud storage (S3/GCS) or a feature store (Feast, Hopsworks). This is the training data for the re-ranker.
D. Re-ranking Model & Training
Option 1 (Simpler, Rule-Based Initial):
Heuristic Re-ranker: Boost rank for items with Thumbs Up, demote for Complaint. Complaint tags trigger specific demotion scores (e.g., Offensive = -1000, Inaccurate = -50). Quick to implement, interpretable.
Limitation: Cannot learn complex preferences between candidates.
Model Type: A cross-encoder (e.g., BERT-based) or a list-wise ranking model (e.g., using ListNet, LambdaRank loss).
Training Input:[CLS] query [SEP] candidate_text [SEP] candidate_metadata ... [SEP]
Training Signal: From the enriched votes. Use a ranking loss function (e.g., PairwiseLoss for comparisons, ListwiseLoss for single selections).
Complaint Tag Integration: Two powerful ways:
As a Feature: Append the set of complaint tags (one-hot encoded) for that specific candidate to the model input. The model learns that candidates with tag Inaccuracy should be ranked lower for a given query.
As a Filter: Hard filter: Any candidate with a Severe complaint tag (Offensive, Unsafe) is removed from the candidate pool before re-ranking.
Training Cadence: Retrain nightly or weekly on the accumulated feedback dataset. Use weighted sampling to prioritize recent feedback (concept drift).
E. Serving & A/B Testing
Deployment: The new re-ranker model is deployed as a separate microservice (re-rank-service).
Serving Flow:
Base Model generates top-50 candidates.
Re-rank Service takes the query and candidates, applies the learned model, and returns a new ranked top-5/10.
A/B Testing (CRITICAL):
Randomly split traffic (e.g., 90% control (no re-rank), 10% treatment (with re-rank)).
Key Metrics:Click-Through Rate (CTR), Feedback Rate (votes/complaints per impression), User Session Duration, Task Completion Rate. Monitor if the re-ranker improves these overall, not just on feedback data (which is biased).
Canary Deployment: Gradually ramp up traffic to the new model.
4. Advanced Considerations & Challenges
Feedback Sparsity & Bias: Only a tiny fraction of users give feedback. The data is heavily biased towards "bad" outputs (people only complain). Solution: Use counterfactual learning techniques (like Direct Preference Optimization - DPO) that can learn from implicit preferences in the unfeedbacked data, assuming the base model's ranking is a prior.
Cold Start for New Queries: No feedback for novel queries. The re-ranker must generalize. Solution: Regularly distill the re-ranker's knowledge back into the base model via fine-tuning (the classic RLHF loop).
Complaint Tag Quality: Users tag incorrectly. Solution: Add a moderator review queue in the Feedback DB UI to correct tags. Use these corrected labels as gold standard for a small validation set.
Feedback Fraud: Users trying to game the system to boost/penalize specific answers. Solution: Rate-limit feedback per user/IP, use anomaly detection on feedback patterns (e.g., a user always upvoting one source).
Latency: Re-ranking adds an extra model call. Solution: Cache re-ranking results for frequent queries. Use a lightweight cross-encoder or apply re-ranking only to the top-10 from the base model, not top-100.
5. Monitoring & Analytics Dashboard
Track these system health and impact metrics:
Feedback Volume:# votes / 10k impressions, # complaints / 10k impressions. (A healthy system might see more complaints initially as bad outputs get surfaced).
Feedback Distribution: % of complaints by tag. Is a new model version causing more Inaccuracy complaints?
Model Performance (Offline): Ranking metrics (NDCG@5, MAP) on a held-out, manually labeled set of query/response pairs.
Online A/B Test Results: All metrics from the A/B test framework.
Feedback Decay: Age of feedback used in the latest training set. Ensures the model adapts to recent data.
Data Pipeline: Apache Spark / Prefect / Airflow for nightly ETL to create training sets.
Feature Store: Feast (to serve query/candidate features consistently to training & serving).
Re-ranking Model: Hugging Face Transformers (BERT-based cross-encoder), trained with sentence-transformers or lightgbm (for feature-based).
Serving: TorchServe, TensorFlow Serving, or a FastAPI microservice.
A/B Testing: Statsig, GrowthBook, or custom implementation.
Monitoring: Grafana/Looker dashboards on top of analytics DB (e.g., BigQuery, Snowflake).
7. Summary & Key Design Principles
Link Everything: Every feedback MUST link back to an interaction_id and the exact model_version that produced the output.
Structure Complaints: A strict, moderated taxonomy for complaint tags is non-negotiable for actionable learning.
Start Simple, Then Learn: Begin with rule-based re-ranking (e.g., simple demotion for complaints) to get initial data, then quickly move to a learning-to-rank model.
Close the Loop with A/B Testing: Never deploy a new re-ranker without proving it improves user-centric metrics in a controlled experiment.
Beware of Biases: Actively monitor for feedback fraud, sparsity, and distribution shift. Assume your feedback data is a highly biased sample.
Iterate on the Taxonomy: Periodically review complaint tags. Merge under-used tags, split overly broad ones.
This system creates a powerful, automated flywheel: Better Outputs → More Useful Feedback → Smarter Model → Even Better Outputs. The critical success factor is treating feedback as a first-class citizen in your data pipeline, not an afterthought.