Trust and safety
Generate and label realistic examples of scams, abuse, and harassment to train and evaluate your classifiers.
Classifiers learn from examples, and the examples you need are the ones filtered models refuse to write: scam messages, harassment, manipulative sales pitches. The models on XField will write them, label them, and explain the label. This guide covers designing a schema, getting diversity, batch generation, and measuring whether your classifier actually improved.
Which model to use
| Job | Model |
|---|---|
| Bulk generation of examples | glm-5.3-flash-uncensored |
| Careful labeling and policy edge cases | glm-5.3-uncensored |
| Building the pipeline code | deepseek-v4.1-flash-1017-uncensored |
GLM 5.3 Flash is the lighter GLM, which matters when you resend the same policy text with every batch. Keep that policy text at the start of the prompt so automatic caching picks it up.
Design the schema first
Decide what a row looks like before you generate anything. Changing it later means relabeling. A practical starting point:
{
"id": "scam-0412",
"text": "Hi! Your parcel could not be delivered. Confirm your address and pay the 1.99 redelivery fee here: [link]",
"channel": "sms",
"language": "en",
"label": "scam",
"subtype": "delivery_fee",
"severity": "medium",
"rationale": "Unsolicited delivery notice with an urgent small payment request and a link. Classic advance-fee pattern.",
"synthetic": true
}Use the same label set your production policy uses. Always include rationale and synthetic: the first makes review fast, the second stops generated data leaking into your real-data evaluation sets.
Get diversity on purpose
Ask for "100 scam messages" and you get 100 variations of the same one. Instead, define axes and sample across them:
- Channel: SMS, email, marketplace chat, dating app, comment section.
- Tone: friendly, urgent, official, flirtatious, aggressive.
- Length and polish: one line with typos to a full corporate email.
- Language and region: match the markets you actually moderate.
- Hard negatives: real delivery notices, legitimate bank alerts, rough but non-abusive banter. These teach the classifier where the line is and cut false positives.
Generate one small batch per combination, not one huge batch.
Batch generation with JSON output
Ask for JSON Lines and validate every row. Drop anything that fails to parse or is missing a field.
import json, os, itertools
from openai import OpenAI
client = OpenAI(base_url="https://xfield.cloud.brutal.ai/api/v1", api_key=os.environ["XFIELD_API_KEY"])
policy = open("policy/scams.md").read()
channels = ["sms", "email", "marketplace_chat"]
tones = ["friendly", "urgent", "official"]
rows = []
for channel, tone in itertools.product(channels, tones):
resp = client.chat.completions.create(
model="glm-5.3-flash-uncensored",
temperature=1.0,
messages=[
{"role": "system", "content": f"You generate labeled training data for a scam classifier.\n\nPolicy:\n{policy}"},
{"role": "user", "content": (
f"Write 10 opening messages for channel={channel}, tone={tone}: "
"6 scams and 4 legitimate look-alikes. Use [link] for URLs and fake names. "
"Output JSON Lines with fields id, text, channel, language, label, subtype, "
"severity, rationale, synthetic. No other text."
)},
],
)
for line in resp.choices[0].message.content.splitlines():
try:
rows.append(json.loads(line))
except json.JSONDecodeError:
passThen deduplicate on normalized text. Generators repeat themselves more than you expect.
Label with a rationale
For real data you already have, or for a second opinion on generated rows, use GLM 5.3 as a labeler. Give it the policy, one example per label, and ask for label plus a one-sentence rationale that cites the policy clause. Where the model and your human reviewers disagree, look at the rationale first: disagreements usually point at a gap in the policy, not a bad label.
Evaluate recall honestly
- Hold out a set of real, human-labeled examples. Never evaluate only on synthetic data.
- Report recall per subtype, not just overall. A classifier can score well while missing a whole category.
- Track the false-positive rate on hard negatives alongside recall.
- When recall is weak on a subtype, generate more examples for that subtype only, retrain, and re-measure on the same held-out set.
Keep it mild and in bounds
You need realistic examples, not dangerous ones. Scam openers, insults, and manipulative pitches are enough to train most classifiers; you do not need working fraud kits or real people's details. Use placeholders for links, names, and account numbers. Never generate sexual content involving minors, for any purpose; use hash-matching services and the proper reporting channels for that category. Protect the people reviewing this data with rotation and opt-outs. See the acceptable use policy.