We are to design a system that generates alt text for images, blending machine learning suggestions, human review, and production enforcement. The pipeline should be efficient, scalable, and maintainable.
Key components:
ML Suggestion Service: A service that uses a pre-trained model (like CLIP, BLIP, etc.) to generate initial alt text for an image.
Human Review Interface: A web-based or integrated interface where human reviewers can edit, approve, or reject the suggested alt text.
Production Enforcement: A mechanism to ensure that only approved alt text (or the ML suggestion if auto-approved) is published to production.
Constraints and considerations:
Scalability: Handle a high volume of images.
Reliability: Minimal downtime.
Quality control: Human oversight for critical or ambiguous images.
Flexibility: Configurable rules for auto-approval (e.g., confidence threshold, image type).
Auditability: Track changes and decisions.
Architecture:
We can design a pipeline with the following steps:
Image Ingestion:
Images are uploaded or identified (from a CMS, e-commerce platform, etc.) and sent to the pipeline.
ML Generation:
The image is passed to the ML service, which returns one or more alt text suggestions along with a confidence score.
Triage/Routing:
Based on rules (confidence score, image category, etc.), the suggestion is either:
a. Auto-approved: sent directly to production.
b. Sent for human review.
Human Review:
The suggestion (and possibly the image) is presented to a human reviewer via a dashboard.
The reviewer can edit, approve, or reject. Rejection might mean the image is sent back to ML with a different model or flagged for more expertise.
The reviewer's decision is recorded.
Production Enforcement:
Approved alt text (either auto or by human) is stored in a database and made available to the production system (e.g., via API, or written to a content store).
There should be a way to update or remove alt text if needed.
Monitoring and Logging:
Track the entire process, log decisions, and monitor performance.
Implementation Details:
Use a message queue (e.g., RabbitMQ, Kafka, AWS SQS) to handle asynchronous processing and decouple components.
Microservices for each major function: ingestion, ML generation, triage, review, and production update.
Database: Use a relational DB (e.g., PostgreSQL) for structured data (image metadata, alt text versions, review decisions) and possibly a blob store for images.
For the ML service, we can use a framework like TensorFlow Serving or TorchServe to deploy the model, or a cloud-based service (AWS Rekognition, Google Vision AI, etc.) if we don't want to host.
Workflow:
Ingestion Service:
Receives image (or reference) and metadata (e.g., source, importance, category).
Stores image in blob storage (e.g., S3) and metadata in DB with status "pending".
Publishes a message to the "ml-generation" queue with image ID and location.
ML Generation Service:
Listens to "ml-generation" queue, fetches image, runs model.
Returns suggestion and confidence. Updates DB with suggestion and sets status to "ml_complete".
Publishes to "triage" queue with image ID, suggestion, confidence, and metadata.
Triage Service:
Applies business rules (configurable) to decide auto-approval or review.
Example rule: if confidence > 0.9 and category is "product", auto-approve; else send for review.
If auto-approved, updates DB status to "approved" and publishes to "production" queue.
If needs review, updates status to "in_review" and publishes to "review-queue".
Review Service:
A web application that pulls images from the "in_review" status and presents to reviewers.
Reviewers see image, suggestion, and other context. They can edit and submit.
On submission, the service updates the DB with approved alt text (or rejection) and status changes.
If approved, publish to "production" queue. If rejected, maybe publish to "rejection" queue for further analysis or re-routing.
Production Enforcement:
Service listening to "production" queue.
Takes the approved alt text and updates the production system. This could be:
Writing to a database that the frontend reads from.
Calling an API of the CMS.
Updating a search index (for SEO).
After successful update, set status to "published".
Monitoring:
Log each step, track processing times, error rates.
Dashboard for overall pipeline health.
Scalability:
Each service can be scaled independently.
Use a load balancer for the review interface (if many reviewers).
Reliability:
Use dead-letter queues for messages that fail repeatedly.
Ensure idempotency in processing.
Security:
Secure the review interface (authentication, authorization).
Protect the blob storage and databases.
Extensions:
Feedback loop: Use human corrections to retrain the ML model periodically.
Multiple ML models: For different image types, we can have different models and the triage can select the appropriate one.
Tech Stack Suggestions:
Backend: Python (Django/FastAPI) or Node.js.
Queue: RabbitMQ or Kafka (for high volume) or AWS SQS.
Database: PostgreSQL.
Blob Storage: AWS S3, Google Cloud Storage, etc.
ML: Hugging Face Transformers (for BLIP, etc.) or cloud APIs.
Frontend for review: React or similar.
This is a high-level design. Implementation details will depend on the specific requirements, scale, and existing infrastructure.
Alt-Text Generator Pipeline: ML + Human-in-the-Loop + Production Enforcement
🎯 System Overview
A three-stage pipeline combining automated ML suggestions, human editorial review, and strict production controls to generate high-quality, compliant alt text at scale.
This pipeline balances automation with human oversight, ensuring alt text quality while maintaining high throughput. The modular design allows organizations to adjust auto-approval ratios based on their risk tolerance and resource availability, while the enforcement layer guarantees production integrity.