CoolFace
Modelpublic

syed7741/aegis-industrial-rag-assistant

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
0likes17downloads
Model Card

AEGIS Industrial RAG Assistant

AEGIS Industrial RAG Assistant is a LoRA/PEFT adapter fine-tuned on the AEGIS Industrial AI Dataset for industrial question answering and Retrieval-Augmented Generation experiments.

The adapter was trained on top of:

text
google/flan-t5-small

using:

text
LoRA / PEFT

The project is part of AEGIS AI, an end-to-end industrial artificial intelligence platform combining RAG, document intelligence, semantic search, AI agents, computer vision, predictive maintenance, robotics monitoring, and workflow automation.


Model Status

✅ This repository contains a genuinely trained LoRA adapter.

The trained adapter weights are stored in:

text
adapter_model.safetensors

The LoRA configuration is stored in:

text
adapter_config.json

The adapter was trained locally on CPU using the public AEGIS synthetic industrial dataset.


Base Model

text
google/flan-t5-small

The original FLAN-T5-small parameters remain the base model.

AEGIS fine-tuning was performed using parameter-efficient LoRA adaptation rather than full-model fine-tuning.


Training Dataset

The adapter was trained using:

text
syed7741/aegis-industrial-ai-dataset

The dataset currently contains:

text
64 synthetic industrial records

covering:

  • —Worker Safety
  • —Predictive Maintenance
  • —Robot Monitoring
  • —Vision Inspection
  • —AI Alerts
  • —Workflow Automation
  • —Document Assistant
  • —Factory Status

Industries represented include:

  • —Manufacturing
  • —Oil & Gas
  • —Warehousing / Logistics
  • —Robotics

Training Data Preparation

The original 64 industrial records were split before prompt expansion to reduce leakage between the training and evaluation sets.

Training split:

text
54 records

Evaluation split:

text
10 records

Each source record was transformed into multiple instruction/question-answer formats.

Final training examples:

text
162

Final evaluation examples:

text
30

Fine-Tuning Method

The model was trained using LoRA — Low-Rank Adaptation through Hugging Face PEFT.

ParameterValue
Base modelgoogle/flan-t5-small
MethodLoRA / PEFT
TaskSEQ2SEQ_LM
LoRA rank4
LoRA alpha16
LoRA dropout0.05
Target modulesq, v
Learning rate3e-4
Batch size1
Gradient accumulation4
Epochs2
DeviceCPU

Trainable Parameters

The LoRA configuration trained:

text
172,032 parameters

out of approximately:

text
77.1 million total parameters

Trainable percentage:

text
0.223%

This demonstrates parameter-efficient adaptation without retraining the complete FLAN-T5-small model.


Training Results

Epoch 1

text
Training Loss:   1.6501
Evaluation Loss: 1.1663

Epoch 2

text
Training Loss:   1.1880
Evaluation Loss: 0.7744

Both training and evaluation loss decreased during the two training epochs.


Fine-Tuned Test Result

Test question:

text
What should I do before maintaining CONV-02?

Fine-tuned adapter response:

text
isolate all energy sources, apply lockout/tagout, verify zero-energy state, and record the responsible technician.

This example demonstrates that the trained adapter learned the expected industrial safety response from the AEGIS training examples.


Using the Adapter

Install the required libraries:

bash
pip install transformers peft torch sentencepiece

Load the AEGIS adapter:

python
from transformers import (
    AutoModelForSeq2SeqLM,
    AutoTokenizer,
)

from peft import (
    PeftConfig,
    PeftModel,
)


ADAPTER_ID = (
    "syed7741/"
    "aegis-industrial-rag-assistant"
)


config = PeftConfig.from_pretrained(
    ADAPTER_ID
)


base_model = (
    AutoModelForSeq2SeqLM
    .from_pretrained(
        config.base_model_name_or_path
    )
)


tokenizer = (
    AutoTokenizer
    .from_pretrained(
        ADAPTER_ID
    )
)


model = PeftModel.from_pretrained(
    base_model,
    ADAPTER_ID,
)


model.eval()

Example Inference

python
prompt = """
industrial qa:
Context: Before maintenance on CONV-02,
isolate all energy sources, apply lockout/tagout,
verify zero-energy state, and record the responsible
technician.

Question:
What should I do before maintaining CONV-02?
""".strip()


inputs = tokenizer(
    prompt,
    return_tensors="pt",
)


output = model.generate(
    **inputs,
    max_new_tokens=96,
    num_beams=4,
    do_sample=False,
)


answer = tokenizer.decode(
    output[0],
    skip_special_tokens=True,
)


print(answer)

Expected response:

text
isolate all energy sources, apply lockout/tagout, verify zero-energy state, and record the responsible technician.

AEGIS RAG Architecture

The trained adapter is designed to work as part of the larger AEGIS Retrieval-Augmented Generation system.

text
User Question
      ↓
React / TypeScript
      ↓
FastAPI
      ↓
AEGIS RAG Service
      ↓
Sentence Transformer
      ↓
Semantic Vector Search
      ↓
Retrieved Industrial Knowledge
      ↓
AEGIS LoRA Adapter
      ↓
Grounded Response
      ↓
Source Attribution

Embedding Model

The AEGIS RAG pipeline currently uses:

text
sentence-transformers/all-MiniLM-L6-v2

Embedding dimensions:

text
384

The embedding model performs semantic retrieval over the industrial knowledge base before relevant context is supplied to the language model.


Technology Stack

AI / Machine Learning

  • —Hugging Face
  • —Transformers
  • —PEFT
  • —LoRA
  • —FLAN-T5
  • —Sentence Transformers
  • —Retrieval-Augmented Generation
  • —Semantic Search
  • —Vector Embeddings

Backend

  • —Python
  • —FastAPI
  • —REST APIs
  • —PostgreSQL

Frontend

  • —React
  • —TypeScript
  • —Material UI

AI Platform Components

  • —RAG
  • —AI Agents
  • —Document Intelligence
  • —Computer Vision
  • —Predictive Maintenance
  • —Robot Monitoring
  • —Worker Safety
  • —Workflow Automation

Current AEGIS Capabilities

Implemented:

  • —✅ Public Hugging Face industrial dataset
  • —✅ Dataset loader
  • —✅ Document construction
  • —✅ Text chunking
  • —✅ Sentence-transformer embeddings
  • —✅ Vector indexing
  • —✅ Semantic retrieval
  • —✅ Local language model
  • —✅ FastAPI RAG endpoint
  • —✅ React / TypeScript integration
  • —✅ Retrieved-source attribution
  • —✅ LoRA/PEFT fine-tuning
  • —✅ Trained adapter checkpoint
  • —✅ Hugging Face model repository
  • —✅ CPU-based training pipeline
  • —✅ No paid LLM API required

Development Roadmap

Planned improvements:

  • —Larger industrial training dataset
  • —Arabic + English training data
  • —Arabic industrial terminology
  • —Multilingual question answering
  • —RAG evaluation suite
  • —Base-model vs fine-tuned-model benchmarking
  • —Hybrid semantic + keyword retrieval
  • —Reranking
  • —AI agents
  • —Conversation memory
  • —Document ingestion
  • —Computer vision integration
  • —Workflow automation
  • —Cloud deployment

Enterprise AI Engineering

AEGIS demonstrates concepts applicable to enterprise AI systems including:

  • —LLM application development
  • —Parameter-efficient fine-tuning
  • —Retrieval-Augmented Generation
  • —Document intelligence
  • —Semantic search
  • —Conversational AI
  • —Multilingual AI
  • —AI backend APIs
  • —Workflow automation
  • —Grounded generation
  • —Source attribution

Safety Notice

The AEGIS training dataset contains synthetic industrial records created for:

  • —AI engineering experimentation
  • —learning
  • —prototyping
  • —research
  • —portfolio demonstration

The model must not be treated as an authoritative source for industrial safety or operational decisions.

Its outputs must not replace:

  • —approved operating procedures
  • —manufacturer documentation
  • —workplace safety requirements
  • —engineering review
  • —regulatory requirements
  • —qualified professional judgment

Related Work

Dataset

text
syed7741/aegis-industrial-ai-dataset

Model / Adapter

text
syed7741/aegis-industrial-rag-assistant

GitHub

text
github.com/syedasim7741/AEGIS-AI

Author

Sayyad Asim

AI Engineering • RAG • AI Agents • LLM Fine-Tuning • Document Intelligence • Computer Vision • Robotics • Industrial AI