Fine-tuned LLM for Message Content Moderation and Trust & Safety

thumbtack · Tech · 2024 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: trust and safety message moderation

Thumbtack needed to detect subtle policy-violating messages in its home-services marketplace, because keyword rules and the existing CNN model could catch obvious abuse but struggled with nuanced language, sarcasm, implied threats, and costly review volume.

Constraints:

Architecture

Thumbtack productized a fine-tuned LLM moderation pipeline. Messages first pass rule-based checks and a legacy CNN pre-filter; the CNN threshold screens out most good messages so only about 20% of messages go to the LLM. A centralized LangChain-backed service integrates the fine-tuned model with internal systems, then a resolver aggregates rule/model outputs and routes suspicious messages to manual review while passing safe messages to pros.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  message-review-pipeline["Message review pipeline"] --> rule-based-engine["Rule-based engine"]
  message-review-pipeline --> cnn-pre-filter["CNN pre-filter"]
  cnn-pre-filter --> centralized-langchain-llm-service["Centralized LangChain LLM service"]
  centralized-langchain-llm-service --> fine-tuned-llm-classifier["Fine-tuned LLM classifier"]
  rule-based-engine --> results-resolver["Results resolver"]
  centralized-langchain-llm-service --> results-resolver
  results-resolver --> manual-review-team["Manual review team"]
  results-resolver --> message-review-pipeline
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Message review pipeline Coordinates policy checks for each message before delivery to professionals. Rule-based engine, CNN pre-filter, Results resolver
Rule-based engine Detects obvious policy violations using flagged words or phrases. Message review pipeline, Results resolver
CNN pre-filter Screens out most good messages so the LLM only processes harder cases. Message review pipeline, Centralized LangChain LLM service
Centralized LangChain LLM service Bridges internal systems to LLM models through a reusable centralized service. CNN pre-filter, Fine-tuned LLM classifier, Results resolver
Fine-tuned LLM classifier Classifies nuanced, suspicious, or policy-relevant messages after task-specific training. Centralized LangChain LLM service
Results resolver Aggregates rule, CNN, and LLM results to choose manual review or delivery. Rule-based engine, Centralized LangChain LLM service, Manual review team
Manual review team Investigates suspicious messages before enforcement or delivery decisions. Results resolver

Data flow

A customer message enters the review pipeline, rule-based checks flag obvious policy violations, the adjusted CNN model filters likely-good messages, challenging messages are sent through the centralized LangChain LLM service to the fine-tuned classifier, and the resolver either forwards suspicious cases to manual review or lets legitimate messages reach professionals.

“For each message sent on the platform, Thumbtack’s message review pipeline runs two primary checks:”article, stated
“As a result, the LLM only processes around 20% of the total messages, focusing its resources on the more challenging or suspicious cases.”article, stated

Why this architecture

Thumbtack chose fine-tuning because prompt engineering could not reach production accuracy, then retained the CNN as a pre-filter because LLM inference is GPU-backed and expensive for all messages. LangChain centralized LLM integration so future model deployments across teams would be easier.

“the Area Under the Curve (AUC) for the best prompts in this experiment was only 0.56, which was far below expectations.”article, stated
“Since most of the messages on our platform are legitimate, it would be inefficient and costly to let the LLM review every single message.”article, stated

Models used: Fine-tuned LLM · CNN model · LangChain · Rule-based engine

Scale

Alternatives considered (roads not taken)

Keyword rules and the existing CNN model alone.

Rejected because: They struggled with nuanced language, sarcasm, and implied threats.

“the CNN model performed adequately for more straightforward cases, it struggled with nuanced language, sarcasm, and implied threats.”article, stated

Prompt engineering off-the-shelf LLMs.

Rejected because: The best prompts only reached 0.56 AUC, below production needs.

“prompt engineering alone was not sufficient to achieve the level of accuracy required for production.”article, stated

Send every message to the LLM.

Rejected because: Most messages were legitimate and GPU-backed LLM review of every message would be inefficient and costly.

“it would be inefficient and costly to let the LLM review every single message.”article, stated

Build separate LLM integrations per team.

Rejected because: Thumbtack needed consistency and reuse across teams through a centralized service.

“create a centralized service that can scale across multiple teams.”article, stated

Patterns

fine-tuning-adaptation (trust and safety classification)

Thumbtack fine-tuned an LLM on tens of thousands of labeled marketplace messages to detect nuanced policy violations.

“we expanded our dataset to tens of thousands of samples for further training.”article, stated

cost-aware-routing (LLM pre-filtering)

The legacy CNN was repurposed as a pre-filter so only harder suspicious cases reach the LLM.

“we repurposed it as a pre-filter to identify and pass through most of the good messages without needing further review.”article, stated

safety-policy-enforcement (marketplace message moderation)

The pipeline detects abusive language, job seeking, partnership requests, and other policy violations before delivery.

“This system effectively filters out inappropriate content before it reaches the pros.”article, stated

tool-use-orchestration (centralized LLM service)

LangChain bridges internal systems to LLM models through one centralized service reusable across teams.

“LangChain enables easy integration with various LLM models allowing us to create a centralized service”article, stated

Tradeoffs

Fine-tune a classifier rather than rely on prompts.

Chose Fine-tuned LLM over Prompt-engineered off-the-shelf LLM.

Rationale: Prompt engineering reached only 0.56 AUC, while fine-tuning achieved 0.93 AUC.

“with the AUC increasing to 0.93. This level of performance was deemed highly reliable for production deployment.”article, stated

Use the CNN as a routing filter instead of retiring it.

Chose CNN pre-filter plus LLM for harder cases over LLM-only moderation.

Rationale: The CNN could cheaply pass through most good messages, reducing LLM cost while preserving quality.

“our old CNN-based machine learning model could still be useful. By adjusting its threshold, we repurposed it as a pre-filter”article, stated

Centralize LLM integration through LangChain.

Chose Centralized LangChain-backed service over Ad hoc LLM integrations.

Rationale: A single service improves consistency and makes future LLM deployments faster and manageable across teams.

“deploying LLM models in the future will be fast and manageable, as all LLM-related services are streamlined through this single infrastructure.”article, stated

Gotchas (what bit them)

Prompt engineering was far below production quality.

Root cause: Off-the-shelf prompts could not reliably distinguish legitimate from suspicious marketplace messages.

Resolution: Thumbtack shifted to fine-tuning with thousands and then tens of thousands of labeled samples.

“the Area Under the Curve (AUC) for the best prompts in this experiment was only 0.56, which was far below expectations.”article, stated

LLM review of every message would be too expensive.

Root cause: The LLM runs on GPU and most platform messages are legitimate.

Resolution: Thumbtack adjusted the CNN threshold to route only about 20% of messages to the LLM.

“the LLM needs to run on GPU and thus is more costly. Also, the sheer volume of messages handled by Thumbtack can lead to significant costs over time.”article, stated

Existing CNN moderation missed subtle violations.

Root cause: Nuance, sarcasm, and implied threats require more context than the CNN handled well.

Resolution: Thumbtack used a fine-tuned LLM for more difficult message review cases.

“it struggled with nuanced language, sarcasm, and implied threats.”article, stated

Evaluation

Thumbtack evaluated prompt-engineered models on a 1,000-message sample, then fine-tuned on thousands to tens of thousands of examples and measured AUC, precision, and recall after deployment.

Metrics: Prompt-engineering AUC 0.56 · Fine-tuned AUC 0.93 · LLM processes around 20% of messages · Precision improved by 3.7x · Recall improved by 1.5x · Tens of millions of messages processed

“We began by validating 1,000 sample messages, where 90% were legitimate, and 10% were suspicious.”article, stated
“our precision has improved by a factor of 3.7 compared to the old system”article, stated

Outcomes

Thumbtack's marketplace serves millions of people; the moderation system has processed tens of millions of messages and routes only about 20% to the LLM.

“Since deploying the new system, it has processed tens of millions of messages with robust performance.”article, stated
“our recall ratio is 1.5 times better, allowing us to detect more potential violations than before.”article, stated