Emma Guardrails 1.0
Emma Guardrails 1.0 is an open-source Italian text classification model developed by Egomnia S.p.A. for detecting safety-related and content-related categories in user prompts.
It is designed to operate as a lightweight input guardrail in front of large language models (LLMs), classifying incoming prompts before they are processed by the main generative model. It can also be used to moderate generated outputs.
The model uses a classical machine learning pipeline based on TF-IDF vectorization and multiclass Logistic Regression, providing low-latency inference, low computational requirements, and easy deployment in Python and on-premise environments.
Model Details
- Model name: Emma Guardrails 1.0
- Developer: Egomnia S.p.A.
- Language: Italian
- Task: Multiclass text classification
- Number of categories: 21
- Training samples: 44,677 real and unique prompts
- Architecture: TF-IDF + Logistic Regression
- Framework: scikit-learn
- Training/test split: 80% / 20%
- Test samples: 8,935
- Random seed: 42
- Test accuracy: 81.31%
Intended Use
Emma Guardrails is intended to classify Italian-language prompts according to predefined safety, content, and contextual categories.
Typical applications include:
- Input guardrails for LLM-based applications
- Prompt safety classification
- Output moderation
- Enterprise chatbots and virtual assistants
- Educational platforms
- Compliance and auditing systems
- Academic research and benchmarking
- On-premise AI deployments
The model can be placed before an LLM to identify prompts that should be blocked or routed through a different handling process, reducing unnecessary inference and token consumption.
Classification Categories
The model classifies prompts into the following categories:
- Not detected category
- Presence of public figures
- Presence of names
- Sexual content
- Offensive language
- Trick questions
- Mathematical calculation requests
- Illegal activities, weapons, violence and harmful behavior
- Personal opinions and beliefs
- Blasphemy and profane language
- Current affairs questions
- Poisoning and toxic substances
- Advocacy and propaganda of extremist ideologies
- Personal data insertion
- Discriminatory, stereotypical and hateful content
- Prompt injection and model manipulation
- Italian proverbs, idioms, memes and humor
- Drugs and illegal substances
- Religion, faith and spirituality
- Child sexual abuse
- Gender identity and sexual orientation
The taxonomy is organized into different operational priority levels. Critical categories can be used to trigger immediate blocking, while other categories can be handled according to the policy of the organization deploying the model.
Training Data
The model was trained on 44,677 real and unique prompts collected from user interactions with Egomnia's Emma-5 conversational system.
The dataset contains a variety of authentic user requests, including informational questions, mathematical requests, attempts to manipulate the model, offensive language and potentially risky content.
Each prompt was manually assigned to one of the defined categories.
Personal data potentially present in the original prompts was irreversibly anonymized before being used for training. The distributed model does not contain the original training texts.
Dataset Distribution
The dataset is strongly imbalanced. The largest category, "Not detected category", contains approximately 62.9% of the corpus.
The distribution reflects real conversational traffic rather than a synthetically balanced benchmark.
The category "Nonsensical or paradoxical requests" is defined in the taxonomy but is not represented in the current training corpus and is therefore not modeled in this version.
Model Architecture
Emma Guardrails uses a two-stage classical NLP pipeline:
- TF-IDF vectorization
- Multiclass Logistic Regression
The TF-IDF vectorizer uses:
lowercase=Truestop_words=Nonengram_range=(1, 2)max_features=10000min_df=2sublinear_tf=True
The classifier uses scikit-learn's LogisticRegression with:
- Multiclass classification
max_iter=2000
For each input prompt, the classifier estimates a probability distribution over the modeled categories and assigns the class with the highest probability.
Performance
The model was evaluated on a stratified test set containing 8,935 prompts, corresponding to 20% of the corpus.
The reported overall accuracy is:
81.31%
Because the dataset is strongly imbalanced, accuracy alone should not be interpreted as a complete measure of safety or classification quality.
Future versions are expected to include additional evaluation metrics such as precision, recall, macro F1 and micro F1.
Limitations
Emma Guardrails 1.0 is not an infallible safety system and should not be considered a comprehensive security solution.
Known limitations include:
- Strong class imbalance
- Limited representation of low-frequency categories
- TF-IDF does not fully capture complex semantic relationships or long-range dependencies
- Accuracy can overestimate perceived performance on imbalanced datasets
- The vectorizer was fitted on the complete corpus before the train/test split, which may make the reported accuracy slightly optimistic
The model should therefore be deployed as one component of a broader AI safety strategy, ideally combined with human review, monitoring and periodic updates.
Privacy
The training prompts were irreversibly anonymized before training.
Emma Guardrails classifies the content of individual prompts and is designed as a defensive component rather than a user-surveillance system. The model does not require identification of the user in order to perform classification.
Ethical and Safety Considerations
The model is intended to support the detection and mitigation of potentially harmful or non-compliant content.
It should not be used as the sole mechanism for making high-impact decisions about individuals.
Organizations deploying the model should define their own moderation policies, thresholds and escalation procedures and should periodically evaluate the model against their specific use case.
Deployment
The model and its TF-IDF vectorizer are distributed together as .joblib files.
Both components are required for inference because the classifier operates on the numerical representations generated by the vectorizer.
The model is particularly suitable for environments where low latency, limited computational resources and on-premise deployment are important requirements.
Example
import joblib
vectorizer = joblib.load("vectorizer.joblib")
classifier = joblib.load("classifier.joblib")
prompt = "your Italian prompt here"
X = vectorizer.transform([prompt])
prediction = classifier.predict(X)[0]
probabilities = classifier.predict_proba(X)[0]
print("Category:", prediction)
print("Confidence:", probabilities.max())
License
Emma Guardrails 1.0 is released as open-source software under the OpenRAIL license.
Users are responsible for evaluating whether the model and its outputs are appropriate for their specific application and regulatory context.
Citation
If you use Emma Guardrails 1.0 in research or other public work, please cite the accompanying technical documentation:
Egomnia S.p.A., "Emma Guardrails 1.0 — A Machine Learning Model for Italian Prompt Safety Classification."
Acknowledgements
Emma Guardrails 1.0 was developed by the AI Research & Development division of Egomnia S.p.A.
Links
- Emma: https://emma.egomnia.com
- Egomnia: https://egomnia.com
- Egomnia AI: https://ai.egomnia.com