Two-Stage E-Commerce Content Moderation: LLM Prescreening Plus Legal Rule Verification
This article presents a two-stage pipeline for e-commerce merchant governance that combines a general multimodal model for evidence prescreening with a legal-specialized model for rule verification. It covers the architecture, structured input/output contracts for each stage, cost modeling, the appeal and audit workflow, evaluation metrics, and a checklist for selecting an LLM aggregation platform.
1. Conclusion First: Prescreen, Reason, Then Fall Back to Rules and Humans
A “general multimodal prescreening plus legal rule reasoning” strategy fits e-commerce merchant governance for three reasons.
First, consumer complaints are dominated by images and videos, which text-only rules cannot cover. Second, legal determinations require traceable citations, which a single vision model cannot provide. Third, platform traffic has clear peaks, so the prescreening stage must be low-cost and high-concurrency.
In daily operations, identifying and handling merchant violations is the core governance task. Defect videos, product comparison photos, and appeal materials uploaded by consumers are mostly unstructured multimedia data. Manual review is slow and inconsistent. In scenarios such as “counterfeit goods compensation” or false-advertising claims, the completeness of the evidence chain directly determines the outcome.
Efficiency bottlenecks appear in four areas:
- Complex data formats: Complaints often include unboxing videos, multi-angle photos, and chat screenshots. Traditional OCR and image classification struggle to capture the semantic connections among them.
- Overlapping rule systems: Platform rules, advertising law, consumer protection law, and product quality law stack on top of each other and change frequently. Manual matching is error-prone.
- Tight latency requirements: Long review cycles hurt the shopping experience and can trigger repeat complaints.
- High labor cost: When complaint volume is large, relying entirely on manual review is unaffordable.
An ideal solution therefore needs three capabilities at once: multimodal content understanding, legal rule reasoning, and high throughput with low latency. A single model rarely covers all three, so a “general foundation plus specialized enhancement” combination is required.
2. Architecture: A Two-Stage Pipeline with Unified Orchestration
The solution contains two engines. The prescreening engine extracts structured information from raw materials. The legal reasoning engine checks that information against rules clause by clause. A unified orchestration layer connects the two and routes each case to either human review or automated handling.
[User submission / system capture]↓┌──────────────────┐│ Multimodal │ ← General vision-language model (video + images)│ prescreening │ → Outputs product features, complaint focus, evidence summary└──────────────────┘↓┌──────────────────┐│ Legal reasoning │ ← Legal-specialized model (cross-checks rules)│ module │ → Outputs violation verdict, penalty suggestion, remediation list└──────────────────┘↓┌──────────────────┐│ Human review / │ ← Qualifying cases execute automatically; others go to humans│ automated action │ → Feedback is recorded and new cases are accumulated└──────────────────┘
Both stages share a context cache to avoid repeated calls on the same material. Humans can intervene and correct at any node. Corrections flow back into the evaluation set and prompts, continuously improving model performance.
3. Stage One: Prescreening with a General Multimodal Model
3.1 Why a Multimodal Model
Traditional pipelines first use an image classifier to decide whether something is damaged, then sample frames from videos and process each frame independently. This breaks temporal information and context. For example, a “cracked product” video may only reveal the issue from a specific angle and motion trajectory. A multimodal model understands frame sequences and text instructions together and can handle the following tasks:
| Task | Input | Output fields | Fallback |
|---|---|---|---|
| Appearance defect detection (scratches, deformation, color difference) | Images, video frames | defects, severity | Switch to text-only rules, mark degraded |
| Packaging info extraction (production date, batch number, ingredient list) | Packaging photos | product_category, visible text | Fill missing fields with null, route to humans |
| Consistency check against consumer description | Complaint text, video | consumer_claim, key_timestamps | Route to human queue |
| Dispute attribution (user damage vs. factory defect) | Video, complaint text | defects, missing_fields | No automatic verdict; route to humans |
3.2 Input and Output Definitions
The prescreening module uses a structured prompt so the model returns fixed-format JSON that downstream components can consume directly. The request must specify the model version, timeout, retry, and fallback policy. These are request-configuration parameters and do not appear in the model’s response.
Request example:
{"task": "Product complaint evidence analysis","model_version": "general-vision-v1","media": [{"type": "video", "url_ref": "evidence://case/123/v1", "max_duration_s": 120},{"type": "image", "url_ref": "evidence://case/123/img_2", "max_duration_s": null}],"instruction": "Based on the provided media, extract the following fields: product category, visible defect description, severity (low/medium/high), consumer claim, key timestamps (if any), and suspected violation type (optional). Fill null for any field you cannot determine; do not guess.","max_input_tokens": 32000,"timeout_ms": 15000,"retry_policy": {"max_retries": 2, "backoff_ms": [500, 2000], "retry_on": ["timeout", "5xx"]},"fallback": "text_only_rules"}
Response example:
{"product_category": "electronics","defects": ["visible dent on upper-right corner of the casing", "abnormal stripes on the screen"],"severity": "medium","consumer_claim": "device failed to power on within 7 days of purchase","key_timestamps": ["00:03-00:05"],"extraction_confidence": 0.85,"model_version": "general-vision-v1","status": "ok","degraded": false,"missing_fields": []}
A few clarifications. extraction_confidence is the model’s self-reported score and is not calibrated. It may only be used for routing and monitoring, never as a basis for penalties. After retries are exhausted on timeouts or server errors, the system switches to a text-only rules engine, sets degraded to true, and places the case in the human queue. Fields that cannot be determined must be filled with null; the model is not allowed to guess.
Evidence access also needs controls. Video and image URLs should use short-lived signed URLs with caller identity verification. Evidence from different merchants is stored with tenant isolation. Logs must not contain raw media or personal information such as phone numbers or addresses—only hashes and redacted summaries. The evidence retention period follows the requirements confirmed by the platform’s legal team.
3.3 Cost Estimation
Prescreening handles the largest call volume, so cost determines whether the solution is viable. Four common techniques:
- Dynamic resolution: Downsample low-quality material first; run high-resolution analysis only on suspicious regions.
- Batch encoding: Merge multiple images from the same merchant into one request to reduce call count.
- Cache reuse: Extract features once for repeated complaints about the same product; reuse the summary afterward.
- Tiered routing: Text-only complaints without images can skip the vision model and go straight to the text rules engine.
The per-case cost formula:
Per-case cost = prescreening token cost + legal reasoning token cost + storage and transcoding cost + human review cost × human review rate
Where token cost per call = input tokens × input unit price + output tokens × output unit price. On a cache hit, prescreening cost is scaled by the miss rate, i.e., multiplied by (1 − cache hit rate).
The following hypothetical numbers demonstrate the calculation. These unit prices are illustrative assumptions, not real quotes:
- Prescreening: 12,000 input tokens, 800 output tokens, input price 0.004 per 1k tokens, output price 0.012 per 1k tokens. Cost: 12 × 0.004 + 0.8 × 0.012 = 0.0576. With a 30% cache hit rate: 0.0576 × 0.7 ≈ 0.0403.
- Legal reasoning: 6,000 input tokens, 600 output tokens, input price 0.008 per 1k tokens, output price 0.024 per 1k tokens. Cost: 6 × 0.008 + 0.6 × 0.024 = 0.0624.
- Storage and transcoding: 0.01.
- Human review: 20% review rate at 3 per review, contributing 0.6.
Total per case ≈ 0.7127, with human review accounting for about 84%. In this example, reducing the review rate usually saves more than negotiating lower model prices.
Load testing should use the real daily case volume, peak QPS, and cache hit rate as inputs. The cache hit rate must be measured from production logs rather than taken from design assumptions. Whether the budget is sufficient should be judged against real quotes and load-test results.
4. Stage Two: Legal-Specialized Model for Rule Verification and Recommendations
4.1 Core Capabilities and Boundaries
The prescreening output is an evidence summary; by itself it is not a legal determination. The legal-specialized model compares the evidence against platform rules and advertising law provisions clause by clause. Its main tasks:
- Clause attribution: Identify the applicable provisions. For example, advertising law prohibits ads from containing false or misleading content that deceives consumers.
- Logic-chain construction: Map evidence facts to the statutory elements of each provision. For example, a merchant advertising “100% cotton” while a quality report shows synthetic fiber can be mapped to the elements of false advertising.
- Handling recommendations: Based on platform penalty rules and violation severity, propose remediation requirements and penalty tiers such as warning, delisting, point deduction, or traffic restriction.
- Risk alerts: If a case may escalate to civil litigation or regulatory action, remind staff to preserve the original evidence.
The legal model’s output is advisory only. Every conclusion must carry a rule ID and rule version. When citing statutes, note the publication date, effective date, and revision version, with the authoritative text taken from the official national legal database in its current form. The rule IDs (e.g., ADS_004, LABEL_12) and version numbers in the examples are format illustrations only, not the contents of a real rule base.
Cases involving heavier penalties must go through human review before any final action. After regulations are updated, the rule base must be synchronized and the evaluation set re-run.
4.2 Input and Output for Cross-Verification
The reasoning module’s input includes the prescreening output, the store’s violation history, and category-specific rules. Rules for food, cosmetics, and electronics differ substantially and must be loaded per category.
Request parameters control call behavior and do not appear in the response:
{"model_version": "legal-expert-v1","timeout_ms": 30000,"max_input_tokens": 16000,"retry_policy": {"max_retries": 1, "backoff_ms": [1000], "retry_on": ["timeout"]}}
Response example:
{"is_violation": true,"violation_types": ["false advertising", "non-compliant labeling"],"matching_rules": [{"rule_id": "ADS_004", "rule_version": "2026.10", "description": "Ads must not contain false or misleading content"},{"rule_id": "LABEL_12", "rule_version": "2026.10", "description": "Local-language labels must state the country of origin"}],"evidence_summary": "Product page lists Japan as origin, but the provided customs declaration shows Vietnam","suggested_action": "Force delisting, remove violating copy, and deduct 12 store points (illustrative value)","legal_confidence": 0.87,"confidence_calibrated": false,"rebuttal_opportunity": true,"requires_human_review": true,"model_version": "legal-expert-v1","missing_fields": []}
The “deduct 12 store points” in suggested_action is an illustrative value that must be confirmed by a human against the current platform rule version. The system must not execute this suggestion automatically.
legal_confidence is produced by the legal model. Until it is calibrated, confidence_calibrated remains false, and the system cannot use this score to execute any action automatically. If the legal model times out, the case keeps its prescreening summary and moves to the human queue—no automatic execution is allowed.
4.3 How the Two Stages Collaborate
The two stages are not a simple serial call. The prescreening output must include traceable evidence anchors, such as “crack visible from 00:03 to 00:05 in the video.” When needed, the legal model can request re-analysis of a specific segment. To control complexity, only text summaries, key timestamps, and key-frame hashes are usually passed between stages. Raw media stays in controlled storage with permissioned access and is not transmitted with the reasoning request.
4.4 Appeal and Audit Loop
Merchant appeals are part of the governance workflow and require the following elements:
- Appeal entry: Merchants submit appeals on the penalty notification page in the merchant console, optionally attaching supplementary evidence.
- Appeal deadline: Within the number of days specified by the rules, counted from delivery of the penalty notice. Seven calendar days is used here as an example; the actual value follows platform rules.
- Evidence freeze: When an appeal is accepted, hash and lock the original evidence and the verdict at that time. Materials may only be appended afterward, never modified.
- Review roles: Appeals are handled by a reviewer different from the original one. Cases involving heavier penalties require legal or compliance staff.
- Rule version snapshots: Every verdict stores the rule IDs and versions used, so the case can be reconstructed even after regulations change.
Audit logs should contain at least: case_id, event_time, operator, model_version, rule_version, input_hash, output_digest, action_type (verdict, appeal, reversal, or enforcement), decision, and reviewer_role. Log retention follows legal requirements.
5. Evaluation Metrics
Evaluation needs unified metric definitions:
| Metric | Definition | Formula |
|---|---|---|
| Accuracy | Share of verdicts matching human labels | Correct verdicts ÷ sampled cases |
| Recall | Share of human-confirmed violations identified by the system | Correctly flagged violations ÷ total human-confirmed violations |
| False positive rate | Share of system-flagged violations that humans confirm as compliant | Wrongly flagged cases ÷ system-flagged cases |
| Human review rate | Share of cases entering the human queue | Human-queue cases ÷ total cases |
| Average handling time | Average time from submission to completion | Σ(completion time − submission time) ÷ resolved cases |
| P95 latency | 95th percentile of end-to-end latency | Sort request latencies ascending; take the value at the 95% position |
| Per-case cost | Total cost over cases in the period | Period total cost ÷ processed cases |
| Appeal reversal rate | Share of appeals that are reversed | Reversed cases ÷ appealed cases |
Compute metrics on a weekly rolling basis with stratified sampling by category. Human labeling is done independently by two reviewers, with disagreements adjudicated by a third. Sample size should be driven by statistical needs; each category should have a non-trivial weekly sample.
6. How to Choose an LLM Aggregation Platform
The value of an aggregation platform is a unified interface that wraps multiple models into callable services. The checklist below can guide selection. For every dimension, require written documentation from the vendor rather than verbal assurances.
| Dimension | What to check | Pass criteria |
|---|---|---|
| Model coverage | Does it offer both general multimodal and legal-domain models? | Both types callable, versions pinnable |
| API compatibility | Does switching models require code changes? | Same request format works across two or more models |
| Billing transparency | Are billing units, input/output prices, and overage rules clear? | Bills can be reconciled per token |
| SLA | Availability, timeout commitments, failure compensation | Written availability and P95 latency commitments |
| Data isolation | Tenant isolation; whether data is used for training | Contract guarantees no training use; per-tenant storage isolation |
| Compliance credentials | Data security and information system certifications and filings | Valid supporting documents provided |
| Audit logs | Are call parameters, model versions, and timestamps logged? | Logs exportable, retention configurable |
| Fallback strategy | Can traffic switch to a backup model if one is unavailable? | Switch rules configurable, switch records traceable |
Common Mistakes in Moderation Systems
- Treating the model’s self-reported confidence as a basis for penalties.
- Auto-executing penalties after a model timeout.
- Failing to record rule versions, making cases impossible to reconstruct after regulatory updates.
- Watching only accuracy while ignoring false positive rate and appeal reversal rate.
- Mixing categories in evaluation samples—food and electronics together—which masks problems.
- Sending raw evidence externally in plaintext, or logging personal information.
How Do You Calculate Cost?
Use the formula in Section 3. The key steps: replace the illustrative unit prices with real quotes, plug in the cache hit rate and human review rate measured from production, and use load-test results to confirm that latency and timeout rates at peak traffic meet targets.
