LabelGuard is a discriminator to detect labels (texts) generated by AI for the French NACE (NAF). It outputs 1 if it considers the text synthetic, and 0 otherwise.
The last version of LabelGuard is accessible through this API (see /docs for more information about the input). API deployment is managed with LabelGuard-deployment.
This repository is the source code behind LabelGuard training. The current version of LabelGuard has been trained on 160,000 labels (1/2 real, 1/2 synthetic), and has the best validation FPR (40,000 points) among all the other candidates.
LabelGuard/
├── app/ # API
├── notebooks/ # Exploration
├── src/
│ ├── datasets/ # Data preprocessing (Qdrant and Parquet)
│ ├── embeddings/ # Embedding models (using external API)
│ ├── inference/ # Small example for LabelGuard inference
│ ├── models/ # Discriminators (embedding → binary)
│ └── training/ # Training script
└── tests/ # Pytest check
-
Database: QDrant is used to store and retrieve embeddings for training, mostly because it permits fast indexing and similarity search.
-
ML Lifecycle: MLFlow is used for model versioning and performance tracking during training.
-
Language model: The embedding model used is Qwen3-Embedding-8B.
- Clone the repository:
git clone https://github.com/mateomorin/LabelGuard.git
cd LabelGuard
- Install dependances:
pip install uv
uv sync- Set environnement variables for QDrant and MLFlow:
# Data (pour l'entrainement, choisir S3 ou Qdrant)
QDRANT_API_KEY
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
# Embedding API
EMBEDDING_API_BASE_URL
EMBEDDING_API_KEY
# MLFlow
MLFLOW_TRACKING_URI
MLFLOW_TRACKING_USERNAME
MLFLOW_TRACKING_PASSWORD
MLFLOW_HTTP_REQUEST_TIMEOUT # Optional
Développé dans le cadre d'un projet au sein du SSP Lab.