Multimodal Screening and Legal Model Review for E-Commerce Anti-Counterfeiting
An effective e-commerce governance workflow separates visual evidence extraction from compliance judgment and decision drafting. This article presents a two-stage architecture that combines a multimodal screening model with a legal and compliance model, covering data preprocessing, structured outputs, rule retrieval, API integration, human review, evaluation, monitoring, and auditability.
1. Why E-Commerce Governance and Anti-Counterfeiting Are Often Inefficient
E-commerce platforms process a large number of complaints every day. Defect videos uploaded by consumers, product comparison images submitted by merchants, and screenshots from product detail pages together form complex multimedia evidence. Manual review is usually constrained by three factors:
- Large evidence volumes: A single complaint may include dozens of images or several minutes of video. Reviewers may need to compare images individually and inspect video frame by frame.
- Scattered sources of authority: Determining whether a case violates policy may require checking platform product rules, advertising regulations, and historical enforcement cases. Reviewers must repeatedly switch between different references.
- Strict documentation requirements: The final decision must be written as a traceable enforcement or remediation notice, with specific requirements for evidence, wording, and format.
Together, these issues lead to complaint backlogs, inconsistent decisions, and a lack of confidence among merchants regarding review outcomes.
2. Decomposing the Review Workflow into Three Steps
Instead of asking a single model to complete the entire process end to end, it is more practical to divide the workflow into three independently verifiable tasks:
- Evidence extraction: Identify product characteristics, visible defects, and the main complaint points from images and videos.
- Compliance assessment: Cross-check the evidence against platform rules and advertising regulations to determine whether the case may involve false advertising, suspected counterfeit products, or other violations.
- Decision output: Generate a structured recommendation with evidence references so that reviewers can verify the conclusion.
These tasks require different model capabilities. The first requires multimodal understanding and typically involves a large volume of materials, making per-call cost important. The second requires stronger legal-text comprehension and reasoning, so accuracy is more important than speed. The third is mainly a structured-generation task, where templates and validation can help ensure quality.
3. Architecture: A Two-Stage Review Loop
A recommended design uses two models in sequence:
- Screening layer: A multimodal model that accepts images and video frames, quickly analyzes all submitted materials, and produces structured factual descriptions.
- Review layer: A model optimized for legal and compliance scenarios that reasons over the screening results and relevant rules, then produces a decision and an action checklist.
Only structured data should be passed between the two layers. The original media should not be sent directly to the review layer. This design provides three benefits:
- Most processing volume and cost remain in the screening layer.
- The review layer receives a controlled amount of input.
- Each layer can be evaluated independently.
- Screening results can be cached and reused. If the same material appears in multiple complaints, it does not need to be analyzed again.
A comparison of common approaches is shown below:
| Approach | Advantages | Main limitations |
|---|---|---|
| Single end-to-end model | Simple to implement | High cost and limited traceability |
| Two-stage pipeline | Controlled cost; each layer can be evaluated independently | Requires maintenance of an intermediate data structure |
| Rules engine plus model | Rules are explainable | Limited rule coverage and high maintenance cost |
In production, the two-stage pipeline can also be combined with a rules engine. Rules can handle explicit hard requirements, while the model handles cases that require semantic understanding.
4. Building a Unified Model Access Layer
Governance systems typically already include business services, task queues, and object storage. When adding large language models, it is useful to place an adapter layer between the application and the models. This layer can provide a consistent implementation for:
- Authentication: Store API keys only in environment variables or a secrets management service. Do not place them in source code or logs.
- Request normalization: Hide differences in parameters and message formats between models so that the business layer uses a consistent interface.
- Model routing: Configure different models for screening and review. Models can then be changed without modifying business logic.
- Timeouts, retries, and fallback: Retry temporary network failures automatically and route persistent failures to a human review queue.
- Invocation auditing: Record the model name, input summary, processing time, and output for later investigation.
The following is an illustrative integration wrapper. The endpoint path and model names must follow the actual gateway documentation; the example only demonstrates the structure:
import osimport timeimport requestsGATEWAY_URL = os.environ["LLM_GATEWAY_URL"]API_KEY = os.environ["LLM_API_KEY"]# Configure model names through environment variables so they can be changed without code updatesMODEL_ROUTES = {"screen": os.environ.get("SCREEN_MODEL", "multimodal-screening"),"review": os.environ.get("REVIEW_MODEL", "legal-compliance"),}def call_model(route: str, messages: list, timeout: int = 60, retries: int = 2) -> str:payload = {"model": MODEL_ROUTES[route],"messages": messages,"temperature": 0.1, # Review tasks generally benefit from stable output}headers = {"Authorization": f"Bearer {API_KEY}","Content-Type": "application/json",}for attempt in range(retries + 1):try:resp = requests.post(f"{GATEWAY_URL}/chat/completions",headers=headers,json=payload,timeout=timeout,)resp.raise_for_status()return resp.json()["choices"][0]["message"]["content"]except requests.RequestException:if attempt == retries:raisetime.sleep(2 ** attempt) # Exponential backoff
Once this layer is in place, the existing governance system usually needs changes mainly in the decision module, which limits the scope of integration and shortens implementation time.
5. Implementing the Screening Layer
The screening layer consists of two parts: media preprocessing and model analysis.
5.1 Media Preprocessing
- Video: Extract frames at fixed intervals or from key moments. Limit the number of frames to prevent oversized requests.
- Images: Resize images to a reasonable resolution and remove metadata unrelated to the complaint, such as device location information.
- Redaction: Mask faces, phone numbers, delivery addresses, and other personal information that may appear in the media before sending it to the model.
5.2 Prompt Design Principles
The screening prompt should instruct the model to describe only facts that are visible in the media, without making a violation judgment. This separates “what is visible” from “whether it violates a rule,” leaving the latter to the review layer.
The output should use a fixed JSON structure:
SCREEN_PROMPT = """You are an e-commerce media analysis assistant. Based on the supplied images or video frames, describe only what is visibly present.Return JSON with the following fields:{"product_features": ["Visible product features"],"complaint_focus": ["Issues raised by the complaint"],"defects": ["Visible defects or abnormalities"],"evidence_refs": ["Related media identifier and timestamp"],"unknown": ["Information that cannot be confirmed from the media"]}Any information that cannot be confirmed must be placed in unknown. Do not make assumptions."""
The output must be parsed as JSON and checked against the required schema. Samples that fail parsing should be retried or sent to a human review queue. Invalid data must not be passed to the next layer.
6. Implementing the Review Layer
The review layer receives the screening results, complaint text, merchant advertising copy, and relevant rules. It then produces a decision and recommended actions.
6.1 Organizing the Input
- Rules and provisions: Maintain an independent rule repository. Retrieve only the provisions relevant to the current case instead of placing the entire rule set in the prompt.
- Evidence chain: Pass the
evidence_refsfrom the screening results along with the other inputs so that the final decision can be traced to specific media. - Merchant copy: Preserve the original advertising language because false-advertising assessments depend on comparing the exact wording with the visual evidence.
6.2 Example Code
import jsonREVIEW_PROMPT = """You are a platform compliance review assistant. Based on the provided rules, compare the screening evidence with the merchant's advertising content.Return JSON:{"violation_type": "False advertising | Suspected counterfeit | No violation | Insufficient evidence","evidence_chain": ["Referenced evidence identifier and explanation"],"rule_refs": ["Referenced rule or provision identifier"],"suggested_actions": ["Recommended actions"],"confidence": 0.0,"needs_human_review": true}If the evidence does not support a conclusion, violation_type must be "Insufficient evidence"."""def review_case(screen_result: dict, claim_text: str, rules: list[str]) -> dict:messages = [{"role": "system", "content": REVIEW_PROMPT},{"role": "user", "content": json.dumps({"screen_result": screen_result,"complaint": claim_text,"rules": rules,}, ensure_ascii=False)},]raw = call_model("review", messages)result = json.loads(raw)validate_review(result)return resultdef validate_review(result: dict) -> None:allowed = {"False advertising", "Suspected counterfeit", "No violation", "Insufficient evidence"}if result.get("violation_type") not in allowed:raise ValueError("Invalid violation_type value")if not result.get("evidence_chain"):raise ValueError("The decision lacks evidence references")
The validation function ensures that model output is machine-readable and that every decision includes evidence. Results without evidence references should be rejected and returned for correction.
7. Human Review and Accountability Boundaries
Model output should support decision-making rather than serve as the sole basis for enforcement. Recommended controls include:
- Insufficient evidence or low confidence: Automatically route the case to a human review queue.
- Enforcement actions: Actions such as delisting, penalty points, or account suspension must be confirmed by a human reviewer.
- Remediation recommendations: The system may automatically draft a remediation notice, but a reviewer should approve it before sending.
- Sampling: Randomly review a proportion of “No violation” decisions to monitor missed violations.
- Appeals: Merchants should be able to view the evidence chain and submit additional materials when they disagree with a decision, creating a complete feedback loop.
These controls reduce risk while providing traceable support for the platform’s rules and enforcement outcomes.
8. Evaluation and Production Rollout
8.1 Building an Evaluation Set
Extract samples from historical complaints and have experienced reviewers label the expected outcomes. The dataset should cover different types of violations, non-violation cases, and borderline cases.
Evaluation should separately measure:
- The accuracy of factual descriptions produced by the screening layer.
- The accuracy and recall of decisions produced by the review layer.
- The types of incorrect decisions and their distribution.
8.2 Gray Release and Parallel Operation
During the initial rollout, use a parallel mode. Record model decisions alongside human decisions without applying the model output directly. After agreement rates for selected categories reach thresholds defined by the team, gradually expand the scope of automated processing.
Business and engineering teams should set these thresholds together rather than selecting them solely from experience.
8.3 Monitoring Metrics
Monitor at least the following indicators:
- Invocation success rate, timeout rate, and retry count
- End-to-end processing time for each complaint
- Human override rate, meaning the proportion of model decisions overturned by reviewers
- Changes in the distribution of violation types, which may reveal new forms of abuse
8.4 Version Management and Data Security
- Prompts, the rule repository, and model configurations should all be version-controlled. Each decision record should include the relevant version numbers for later analysis.
- Complaint materials may contain personal information. Redact this information before review and define retention periods and access permissions.
- Do not record complete credentials or unredacted personal information in invocation logs.
9. Frequently Asked Questions
Why not use one model for the entire workflow?
A single end-to-end model is more expensive and makes it difficult to distinguish between “what the system saw” and “how it reached a judgment.” The two-stage design separates these error types and makes troubleshooting and iteration easier.
Can the model make incorrect decisions?
Yes. Accuracy should not be assumed. Confidence thresholds, human review, sampling, and evaluation datasets should be used continuously to monitor the error rate.
What happens when platform rules are updated?
Maintain the rule repository independently instead of hard-coding rules into prompts. After updating the repository, rerun a set of evaluation samples to confirm that changes in decisions are expected.
Will integrating the models require major changes to the existing system?
Usually not. Once the access layer standardizes model invocation, most changes are limited to the decision module and task orchestration. Existing governance workflow nodes, permissions, and audit processes can generally remain in place.
