Cookies help us to enhance your experience and improve our website. Learn more

+64% gain in Text Safety

An entertainment company enhanced its detection of harmful and prohibited user messages with our Text Classification module.

14

Classes

27

Languages

240M+

Texts monthly

Client previously used the OpenAI moderation API:

0.51

F1 Score

0.53

Recall

Data

Sends to OpenAI

After using 01n boilerplate:

0.84+64%

F1 Score

0.85+60%

Recall

Data 🚀

Stays in-house

Victorious model
Qwen2.5-7B-Instruct:Q4_K_M
  • - Always outputted the defined JSON structure
  • - Produced the highest results across multiple languages
  • - Needed <5Gb of GPU vRAM
System design
A batch of ~20-30 texts is ran through a binary classification: is there a violative text? (1 - yes, 0 - no)
If the response is 1 for the batch, a multi-label classification categorizes each text from the batch (JSON response with message IDs and classes)
Experiments conducted
  • - Checked 50+ different LLMs (0.5B-14B parameters) with different quantization
  • - Tried over 200 class definition variations in the prompt, resulting in a 17% boost in F1 Score

Replicate this success

First, get our boilerplate (it includes Text Classification module):

Then let's run your new Text Classification service:

                    
uvicorn api.main:app --host 0.0.0.0 --port 8001

curl -X POST http://0.0.0.0:8001/predict -H "Content-Type: application/json" -d '{"user_query": "A wise wizard and a resolute paladin united, magic and steel against darkness."}'

> {"classifier_score":"1","classifier_execution_time":0.047,"judge_decision":"correct","judge_execution_time":0.012}
                    
                
0 to 1 to N

Set up your own LLM

Don't waste time on choosing the right stack or ideating on how to evaluate prompts and models.

Get LLM boilerplate