# moodsyingers/mini-cybert-for-cybersecurity-using-ner architecture

> Architecture diagram of the GitHub repository moodsyingers/mini-cybert-for-cybersecurity-using-ner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner
- Repository: https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner

## Overview

This is a cybersecurity named-entity-recognition research project and demo. Its main user workflow sends text from the React interface to a Flask API, which runs the fine-tuned SecBERT model and returns entities for display. The broader lifecycle includes fine-tuning on CyberNER, vocabulary-based prediction enhancement, and evaluation; the repository also contains a separate MCC evaluation and paper-table workflow. Training and model-loading details are documented in the README; the shown source excerpts only partially expose backend internals.

Main entry points: [`backend/ner_api.py`](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/backend/ner_api.py) (Flask NER API), [`train_secbert_ner.ipynb`](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/train_secbert_ner.ipynb) (Fine-tuning), [`frontend/src/App.jsx`](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/frontend/src/App.jsx) (NER interface), [`datasets/cyber/cyberner_clean.csv`](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/datasets/cyber/cyberner_clean.csv) (CyberNER dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Model Development"]
  node_cyberner[("CyberNER dataset<br/>[cyberner_clean.csv]")]
  node_labels["BIO label schema"]
  node_training["Fine-tuning"]
  node_trainedmodel[("Fine-tuned model")]
  node_vocabbuild["Vocabulary builder"]
  node_vocab[("Entity vocabulary")]
end

subgraph group_serve["NER Demo"]
  node_frontend["NER interface<br/>[App.jsx]"]
  node_header["Health status header<br/>[Header.jsx]"]
  node_api["Flask NER API<br/>[ner_api.py]"]
  node_inference["SecBERT inference<br/>[ner_api.py]"]
  node_enhance["Vocabulary enhancement<br/>[ner_api.py]"]
end

subgraph group_eval["Evaluation"]
  node_evaluation["NER evaluation<br/>[evaluate_ner.py]"]
end

subgraph group_paper["MCC Reporting"]
  node_mcc_eval["MCC evaluation"]
  node_mcc_results["MCC evaluation results"]
  node_tablegen["MCC table generation"]
  node_papergen["Paper table orchestration"]
  node_paperresults["Paper tables and metrics"]
end

node_researcher(("Researcher"))
node_secbert{{"Pretrained SecBERT"}}
node_user(("Demo user"))

node_researcher -->|"fine-tunes"| node_training
node_secbert -->|"initializes from"| node_training
node_cyberner -->|"trains on"| node_training
node_labels -->|"defines labels"| node_training
node_training -->|"saves model"| node_trainedmodel
node_researcher -.->|"builds vocabulary"| node_vocabbuild
node_cyberner -.->|"derives terms"| node_vocabbuild
node_vocabbuild -->|"writes vocabulary"| node_vocab
node_user -->|"enters text"| node_frontend
node_frontend -->|"requests analysis"| node_api
node_frontend -->|"renders"| node_header
node_header -->|"checks health"| node_api
node_api -->|"runs inference"| node_inference
node_trainedmodel -->|"loads model"| node_api
node_api -->|"enhances predictions"| node_enhance
node_vocab -->|"supplies terms"| node_enhance
node_api -->|"returns entities"| node_frontend
node_researcher -->|"evaluates model"| node_evaluation
node_cyberner -->|"evaluates against"| node_evaluation
node_researcher -->|"runs evaluation"| node_mcc_eval
node_mcc_eval -->|"writes metrics"| node_mcc_results
node_mcc_results -->|"provides metrics"| node_tablegen
node_papergen -->|"imports reporting"| node_mcc_eval
node_papergen -->|"runs table generation"| node_tablegen
node_tablegen -->|"writes tables"| node_paperresults
node_papergen -->|"writes paper outputs"| node_paperresults

click node_cyberner "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/datasets/cyber/cyberner_clean.csv"
click node_labels "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/config/ner_cyber_labels.json"
click node_training "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/train_secbert_ner.ipynb"
click node_vocabbuild "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/scripts/build_dataset_vocabulary.py"
click node_vocab "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/datasets/cyber/entity_vocabulary.json"
click node_frontend "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/frontend/src/App.jsx"
click node_header "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/frontend/src/components/Header.jsx"
click node_api "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/backend/ner_api.py"
click node_inference "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/backend/ner_api.py"
click node_enhance "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/backend/ner_api.py"
click node_evaluation "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/scripts/evaluate_ner.py"
click node_mcc_eval "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/final-edits/evaluate_with_mcc.py"
click node_mcc_results "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/final-edits/results/evaluation_with_mcc.json"
click node_tablegen "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/final-edits/generate_tables_8_9_mcc.py"
click node_papergen "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/final-edits/generate_paper_tables.py"
click node_paperresults "https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/tree/main/final-edits/results"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cyberner,node_labels,node_training,node_trainedmodel,node_vocabbuild,node_vocab,node_user toneBlue
class node_frontend,node_header,node_api,node_inference,node_enhance toneAmber
class node_evaluation toneMint
class node_mcc_eval,node_mcc_results,node_tablegen,node_papergen,node_paperresults toneRose
class node_researcher,node_secbert toneIndigo
```

## Components

### Model Development

- [CyberNER dataset](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/datasets/cyber/cyberner_clean.csv): `datasets/cyber/cyberner_clean.csv`
- [BIO label schema](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/config/ner_cyber_labels.json): `config/ner_cyber_labels.json`
- [Fine-tuning](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/train_secbert_ner.ipynb): `train_secbert_ner.ipynb`
- **Fine-tuned model**
- [Vocabulary builder](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/scripts/build_dataset_vocabulary.py): `scripts/build_dataset_vocabulary.py`
- [Entity vocabulary](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/datasets/cyber/entity_vocabulary.json): `datasets/cyber/entity_vocabulary.json`

### NER Demo

- [NER interface](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Health status header](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/frontend/src/components/Header.jsx): `frontend/src/components/Header.jsx`
- [Flask NER API](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/backend/ner_api.py): `backend/ner_api.py`
- [SecBERT inference](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/backend/ner_api.py): `backend/ner_api.py`
- [Vocabulary enhancement](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/backend/ner_api.py): `backend/ner_api.py`

### Evaluation

- [NER evaluation](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/scripts/evaluate_ner.py): `scripts/evaluate_ner.py`

### MCC Reporting

- [MCC evaluation](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/final-edits/evaluate_with_mcc.py): `final-edits/evaluate_with_mcc.py`
- [MCC evaluation results](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/final-edits/results/evaluation_with_mcc.json): `final-edits/results/evaluation_with_mcc.json`
- [MCC table generation](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/final-edits/generate_tables_8_9_mcc.py): `final-edits/generate_tables_8_9_mcc.py`
- [Paper table orchestration](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/blob/main/final-edits/generate_paper_tables.py): `final-edits/generate_paper_tables.py`
- [Paper tables and metrics](https://github.com/moodsyingers/mini-cybert-for-cybersecurity-using-ner/tree/main/final-edits/results): `final-edits/results`

### Other components

- **Researcher**
- **Pretrained SecBERT**
- **Demo user**

## Connections

- Researcher → Fine-tuning: fine-tunes (evidence: `README.md`)
- Pretrained SecBERT → Fine-tuning: initializes from (evidence: `README.md`)
- CyberNER dataset → Fine-tuning: trains on (evidence: `README.md`)
- BIO label schema → Fine-tuning: defines labels (evidence: `README.md`)
- Fine-tuning → Fine-tuned model: saves model (evidence: `README.md`)
- Researcher → Vocabulary builder: builds vocabulary
- CyberNER dataset → Vocabulary builder: derives terms
- Vocabulary builder → Entity vocabulary: writes vocabulary (evidence: `README.md`)
- Demo user → NER interface: enters text (evidence: `README.md`)
- NER interface → Flask NER API: requests analysis (evidence: `frontend/src/App.jsx`)
- NER interface → Health status header: renders (evidence: `frontend/src/App.jsx`)
- Health status header → Flask NER API: checks health (evidence: `frontend/src/components/Header.jsx`)
- Flask NER API → SecBERT inference: runs inference (evidence: `backend/ner_api.py`)
- Fine-tuned model → Flask NER API: loads model (evidence: `README.md`)
- Flask NER API → Vocabulary enhancement: enhances predictions (evidence: `README.md`)
- Entity vocabulary → Vocabulary enhancement: supplies terms (evidence: `README.md`)
- Flask NER API → NER interface: returns entities (evidence: `README.md`)
- Researcher → NER evaluation: evaluates model (evidence: `README.md`)
- CyberNER dataset → NER evaluation: evaluates against (evidence: `README.md`)
- Researcher → MCC evaluation: runs evaluation (evidence: `final-edits/evaluate_with_mcc.py`)
- MCC evaluation → MCC evaluation results: writes metrics (evidence: `final-edits/evaluate_with_mcc.py`)
- MCC evaluation results → MCC table generation: provides metrics (evidence: `final-edits/generate_tables_8_9_mcc.py`)
- Paper table orchestration → MCC evaluation: imports reporting (evidence: `final-edits/generate_paper_tables.py`)
- Paper table orchestration → MCC table generation: runs table generation (evidence: `final-edits/generate_paper_tables.py`)
- MCC table generation → Paper tables and metrics: writes tables (evidence: `final-edits/generate_tables_8_9_mcc.py`)
- Paper table orchestration → Paper tables and metrics: writes paper outputs (evidence: `final-edits/generate_paper_tables.py`)
