Instructions to use syed7741/aegis-bilingual-industrial-action-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use syed7741/aegis-bilingual-industrial-action-classifier with PEFT:
from peft import PeftModel from transformers import AutoModelForSeq2SeqLM base_model = AutoModelForSeq2SeqLM.from_pretrained("bigscience/mt0-small") model = PeftModel.from_pretrained(base_model, "syed7741/aegis-bilingual-industrial-action-classifier") - Notebooks
- Google Colab
- Kaggle
- AEGIS Bilingual Industrial Action Classifier
- Dataset
- Training Configuration
- Held-Out Evaluation
- Why Single-Token Numeric Classes?
- Candidate Scoring
- Controlled Response Design
- Example — English
- Example — Arabic
- Loading the LoRA Adapter
- AEGIS AI Application Integration
- Score Margin
- Intended Uses
- Out-of-Scope Uses
- Limitations
- Safety
- Repository Files
- Related Resources
- Reproducibility
- Author
AEGIS Bilingual Industrial Action Classifier
AEGIS Bilingual Industrial Action Classifier is an English-Arabic controlled industrial-action classification prototype built on bigscience/mt0-small using LoRA/PEFT.
It was developed as part of AEGIS AI, an industrial intelligence portfolio platform for manufacturing, robotics, warehouses, logistics, and related operational environments.
Instead of generating unrestricted operational instructions, the model selects one of eight predefined action classes from operational evidence and a question.
The selected class is then mapped deterministically to an approved English or Arabic response.
Key Features
- English and Arabic industrial classification
bigscience/mt0-smallbase model- LoRA / PEFT fine-tuning
- Eight controlled industrial action classes
- Single-token numeric classification targets
- Candidate scoring across all eight classes
- Deterministic approved-response rendering
- Free-form operational action generation disabled
- FastAPI backend integration
- React frontend integration
- CPU-trained portfolio prototype
Architecture
The AEGIS inference architecture is:
Operational Evidence
+
Industrial Question
+
Language (EN / AR)
|
v
bigscience/mt0-small
+
AEGIS LoRA Adapter
|
v
Candidate scoring over
single-token codes 0-7
|
v
Selected Class Code
|
v
Semantic Action ID
|
v
Deterministic Approved
English / Arabic Response
The model therefore functions as a controlled classifier, not as an unrestricted industrial chatbot.
Free-form operational action generation is disabled.
Controlled Action Classes
| Code | Semantic Action ID | Industrial Module |
|---|---|---|
0 |
ALERT_ESCALATION |
AI Alerts |
1 |
DOCUMENT_GROUNDED_ANSWER |
Document Assistant |
2 |
FACTORY_DEGRADED_REVIEW |
Factory Status |
3 |
PREDICTIVE_MAINTENANCE |
Predictive Maintenance |
4 |
ROBOT_SAFE_RESTART |
Robot Monitoring |
5 |
VISION_QUARANTINE |
Vision Inspection |
6 |
WORKER_SAFETY_STOP |
Worker Safety |
7 |
WORK_ORDER_CREATE |
Workflow Automation |
The complete English and Arabic mappings are provided in:
class_code_map.json
Approved Actions
0 — ALERT_ESCALATION
English
Acknowledge, assess severity, and escalate according to the alert playbook.
Arabic
أكد استلام التنبيه، وقيّم مستوى الخطورة، وصعّد الحالة وفق دليل إجراءات التنبيهات.
1 — DOCUMENT_GROUNDED_ANSWER
English
Answer only from approved evidence and cite the source.
Arabic
أجب فقط استنادًا إلى الأدلة المعتمدة، واذكر المصدر.
2 — FACTORY_DEGRADED_REVIEW
English
Review line KPIs and investigate the assets driving the degraded status.
Arabic
راجع مؤشرات الأداء الرئيسية (KPIs) لخط الإنتاج، وتحقق من الأصول المتسببة في تدهور الحالة.
3 — PREDICTIVE_MAINTENANCE
English
Inspect the asset, confirm the trend, and schedule maintenance before failure.
Arabic
افحص الأصل، وتأكد من اتجاه التدهور، وجدول أعمال الصيانة قبل حدوث العطل.
4 — ROBOT_SAFE_RESTART
English
Diagnose the protective stop and verify safe conditions before restart.
Arabic
شخّص سبب التوقف الوقائي، وتحقق من توفر ظروف آمنة قبل إعادة التشغيل.
5 — VISION_QUARANTINE
English
Quarantine the suspect item and send it for secondary inspection.
Arabic
اعزل العنصر المشتبه به وأرسله لإجراء فحص ثانوي.
6 — WORKER_SAFETY_STOP
English
Stop unsafe work, secure the area, and follow the approved safety procedure.
Arabic
أوقف العمل غير الآمن، وأمّن المنطقة، واتبع إجراء السلامة المعتمد.
7 — WORK_ORDER_CREATE
English
Create and track a work order with owner, priority, evidence, and closure verification.
Arabic
أنشئ أمر عمل وتابعه مع تحديد المسؤول، والأولوية، والأدلة، والتحقق من الإغلاق.
Dataset
Training dataset:
syed7741/aegis-bilingual-industrial-ai-dataset
The dataset contains 64 unique synthetic industrial records across eight operational modules.
Languages:
- English
- Arabic
The final experiment used:
| Dataset Property | Value |
|---|---|
| Unique records | 64 |
| Training records | 48 |
| Held-out records | 16 |
| Training records per module | 6 |
| Held-out records per module | 2 |
| Expanded training examples | 192 |
| Bilingual evaluation examples | 32 |
| Approved action classes | 8 |
The record-level train/evaluation split was performed before prompt expansion.
The dataset design also includes:
- evidence-aligned examples
- module labels removed from questions
- target-leakage checks
- balanced module representation
- bilingual English-Arabic evidence
Training Configuration
| Setting | Value |
|---|---|
| Base model | bigscience/mt0-small |
| Architecture | MT0 + LoRA |
| Epochs | 10 |
| Learning rate | 5e-4 |
| Batch size | 1 |
| Gradient accumulation steps | 4 |
| Maximum input length | 512 |
| LoRA rank | 8 |
| LoRA alpha | 16 |
| LoRA dropout | 0.05 |
| LoRA target modules | q, v |
| Trainable parameters | 344,064 |
| Total parameters | 300,520,832 |
| Trainable percentage | ~0.1145% |
| Training hardware | CPU |
| PyTorch | 2.13.0+cpu |
| Transformers | 5.15.0 |
| PEFT | 0.19.1 |
Initial evaluation loss:
2.760820
Final evaluation loss:
0.004219
Total recorded training time:
1004.12 seconds
Approximately:
16.7 minutes
Held-Out Evaluation
The final model was evaluated using a balanced set of 16 held-out records.
Every held-out record was tested in both English and Arabic.
This produced:
32 classification tests
Results
| Language | Correct | Total | Accuracy |
|---|---|---|---|
| English | 16 | 16 | 100% |
| Arabic | 16 | 16 | 100% |
| Combined | 32 | 32 | 100% |
Each of the eight industrial modules contained two held-out records.
For every module, the classifier achieved:
English: 2 / 2
Arabic: 2 / 2
Combined: 4 / 4
The detailed benchmark results are available in:
controlled_action_evaluation.json
Important Benchmark Interpretation
The 100% accuracy result applies only to this specific small, balanced, synthetic held-out benchmark.
It does not mean that the model has 100% accuracy in:
- real factories
- refineries
- warehouses
- logistics facilities
- robotics deployments
- real worker-safety incidents
- real predictive-maintenance environments
- other unseen industrial conditions
No real-world industrial safety certification, regulatory validation, or field-validation claim is made.
The benchmark demonstrates successful controlled classification on the project's synthetic evaluation set.
Why Single-Token Numeric Classes?
Earlier AEGIS experiments used long semantic labels such as:
WORKER_SAFETY_STOP
PREDICTIVE_MAINTENANCE
DOCUMENT_GROUNDED_ANSWER
These labels tokenize into different sequence lengths.
For a sequence-to-sequence model, unequal label lengths can introduce undesirable generation and scoring behavior.
The final architecture therefore uses:
0
1
2
3
4
5
6
7
Each class code is represented as a single tokenizer token.
The numeric code is then mapped deterministically to the corresponding semantic industrial action.
This separates:
Model Classification
from:
Operational Response Rendering
Candidate Scoring
The AEGIS runtime does not rely on unrestricted text generation to decide the operational action.
Instead:
- A bilingual prompt is constructed from evidence, question, language, and the approved action menu.
- The prompt is passed through MT0 + the LoRA adapter.
- All eight candidate codes are evaluated.
- A loss value is calculated for every candidate.
- The candidate with the lowest loss is selected.
- The code is mapped to a semantic action ID.
- The final response is loaded from the approved action catalog.
Conceptually:
Evidence + Question
|
v
Score class 0
Score class 1
Score class 2
Score class 3
Score class 4
Score class 5
Score class 6
Score class 7
|
v
Lowest Loss
|
v
Selected Action
Controlled Response Design
The final operational response itself is not generated freely by the model.
For example:
Predicted class: 6
maps to:
WORKER_SAFETY_STOP
which maps to the approved English response:
Stop unsafe work, secure the area, and follow the approved safety procedure.
or the approved Arabic response:
أوقف العمل غير الآمن، وأمّن المنطقة، واتبع إجراء السلامة المعتمد.
This architecture was chosen to demonstrate a controlled-output design for an industrial AI prototype.
Example — English
Evidence
An unsafe condition has been confirmed around CONV-02.
Personnel are still performing work near the hazard,
access to the affected area remains open, and required
safety controls have not yet been completed.
Question
Based on the operational evidence, what action should be
taken for CONV-02?
Selected class
6
Semantic action
WORKER_SAFETY_STOP
Approved response
Stop unsafe work, secure the area, and follow the approved safety procedure.
Example — Arabic
الأدلة التشغيلية
تم تأكيد وجود حالة غير آمنة بالقرب من المعدة CONV-02.
لا يزال بعض العاملين يواصلون العمل بالقرب من مصدر الخطر،
كما أن الوصول إلى المنطقة المتأثرة ما زال مفتوحًا ولم تكتمل
ضوابط السلامة المطلوبة بعد.
السؤال
استنادًا إلى الأدلة التشغيلية، ما الإجراء الذي ينبغي اتخاذه للمعدة CONV-02؟
الفئة المختارة
6
Semantic Action ID
WORKER_SAFETY_STOP
الإجراء المعتمد
أوقف العمل غير الآمن، وأمّن المنطقة، واتبع إجراء السلامة المعتمد.
Loading the LoRA Adapter
The repository contains a PEFT LoRA adapter.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
from peft import PeftModel
repo_id = "syed7741/aegis-bilingual-industrial-action-classifier"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
base_model = AutoModelForSeq2SeqLM.from_pretrained(
"bigscience/mt0-small"
)
model = PeftModel.from_pretrained(
base_model,
repo_id,
)
model.eval()
Loading the LoRA adapter alone does not reproduce the complete AEGIS controlled inference pipeline.
The full system additionally performs candidate scoring across all eight numeric codes and deterministic response lookup using:
class_code_map.json
AEGIS AI Application Integration
The classifier is integrated into the larger AEGIS AI application.
The application includes:
- React frontend
- TypeScript
- Material UI
- FastAPI backend
- PostgreSQL
- JWT authentication
- role-based access control
- local Hugging Face models
- local RAG
- industrial document assistance
- robot monitoring
- worker safety
- predictive maintenance
- vision inspection
- workflow automation
- AI alerts
- industrial action classification
The Industrial Action AI interface supports:
- English evidence
- Arabic evidence
- English questions
- Arabic questions
- controlled classification
- approved response rendering
- class-code display
- semantic action IDs
- decision-margin display
Score Margin
The AEGIS API may expose a value called:
score_margin
This represents the difference between the best candidate loss and the next-best candidate loss.
It is useful for prototype diagnostics.
It is not a calibrated probability.
It should therefore not be interpreted as:
95% confidence
or another probabilistic confidence measurement without separate calibration.
Intended Uses
This repository is intended for:
- AI engineering demonstrations
- bilingual NLP experimentation
- industrial AI portfolio work
- LoRA / PEFT demonstrations
- controlled classification research
- English-Arabic model experimentation
- deterministic response-catalog architectures
- educational demonstrations
Out-of-Scope Uses
The model should not be used as an autonomous decision maker for:
- industrial machinery
- emergency shutdown systems
- worker safety systems
- medical systems
- life-critical infrastructure
- autonomous robot control
- regulatory compliance decisions
without appropriate real-world validation, engineering controls, qualified human oversight, and applicable certification.
Limitations
Important limitations include:
- The dataset is synthetic.
- Only 64 unique records were used.
- Only eight action classes are supported.
- Evaluation is performed on a small held-out synthetic benchmark.
- The model has not been validated on large real-world industrial datasets.
- The model may fail on out-of-distribution inputs.
- The score margin is not calibrated confidence.
- Real operational language may differ significantly from training examples.
- Arabic dialect variation was not comprehensively evaluated.
- Industrial terminology outside the dataset may be misunderstood.
- The model does not replace engineering judgment.
- The model has not undergone industrial safety certification.
Safety
AEGIS AI is a research and portfolio prototype.
It must not be treated as a substitute for:
- qualified engineers
- plant operators
- maintenance professionals
- safety officers
- emergency-response teams
- official operating procedures
- manufacturer documentation
- regulatory requirements
- site-specific safety rules
Human review is required for real-world operational decisions.
The controlled-action architecture is intended to demonstrate a more constrained output pattern for an industrial AI prototype.
It does not make the system inherently safe or certified for autonomous industrial deployment.
Repository Files
| File | Purpose |
|---|---|
adapter_config.json |
PEFT LoRA configuration |
adapter_model.safetensors |
Trained LoRA adapter weights |
tokenizer.json |
Tokenizer artifact |
tokenizer_config.json |
Tokenizer configuration |
class_code_map.json |
Numeric class → semantic action → EN/AR approved action |
controlled_action_evaluation.json |
Detailed held-out evaluation results |
training_summary.json |
Training configuration and experiment metadata |
README.md |
Model card |
Related Resources
Dataset
syed7741/aegis-bilingual-industrial-ai-dataset
Base Model
bigscience/mt0-small
AEGIS AI GitHub Repository
syedasim7741/AEGIS-AI
Reproducibility
The AEGIS AI GitHub repository contains the training and evaluation scripts used during development, including:
build_aegis_bilingual_dataset.py
train_aegis_bilingual_lora_cpu.py
train_aegis_bilingual_mt0_lora_cpu.py
train_aegis_controlled_action_mt0_lora_cpu.py
train_aegis_controlled_action_balanced_mt0_lora_cpu.py
train_aegis_single_token_balanced_mt0_lora_cpu.py
train_aegis_single_token_balanced_mt0_lora_512_cpu.py
evaluate_aegis_bilingual_mt0.py
The final winning experiment is represented by:
train_aegis_single_token_balanced_mt0_lora_512_cpu.py
Author
Sayyad Asim
AEGIS AI
Industrial Intelligence Platform
Hugging Face:
syed7741
GitHub:
syedasim7741
Portfolio Note
AEGIS AI was developed as an AI-engineering portfolio project demonstrating the combination of:
- bilingual model development
- synthetic dataset design
- LoRA fine-tuning
- controlled classification
- RAG
- FastAPI
- React
- industrial AI architecture
- model evaluation
- safety-aware output constraints
The project is a prototype and does not claim production certification.
- Downloads last month
- 9
Model tree for syed7741/aegis-bilingual-industrial-action-classifier
Base model
bigscience/mt0-small