# bilalahmed0060/deep-nlp-bertified architecture

> Architecture diagram of the GitHub repository bilalahmed0060/deep-nlp-bertified, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bilalahmed0060/deep-nlp-bertified
- Repository: https://github.com/bilalahmed0060/deep-nlp-bertified

## Overview

This repository is a coursework NLP modeling and evaluation project: it trains and evaluates BERT-based classifiers and similarity models across sentiment, paraphrase, semantic similarity, and paraphrase-type tasks, alongside BART paraphrase generation and detection. The principal workflow is task data → tokenized batches → task model → evaluation/predictions. The README documents QQP variants including contrastive, SBERT-style, and stemming approaches; other documented task branches are retained. Sampled excerpts are partial, so uncertain wiring between specialized training scripts and shared utilities is omitted.

Main entry points: [`datasets.py`](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/datasets.py) (Batch datasets), [`multitask_classifier.py`](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier.py) (Multitask BERT), [`multitask_classifier_qqp.py`](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier_qqp.py) (QQP variants), [`multitask_classifier_sts.py`](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier_sts.py) (STS variants)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Task data"]
  node_sstdata["SST data"]
  node_qqpdata["QQP data"]
  node_stsdata["STS data"]
  node_etpcdata["ETPC data"]
  node_datasets["Batch datasets<br/>[datasets.py]"]
end

subgraph group_bert["BERT tasks"]
  node_tokenizer["BERT tokenizer<br/>[tokenizer.py]"]
  node_multitask["Multitask BERT"]
  node_qqpmodel["QQP variants"]
  node_stsmodel["STS variants"]
  node_ssttune["SST fine-tuning"]
  node_sstrdrop["SST R-Drop"]
  node_bertcore["BERT encoder<br/>[bert.py]"]
end

subgraph group_bart["BART tasks"]
  node_bartgen["Paraphrase generation<br/>[bart_generation.py]"]
  node_bartdetect["ETPC detection"]
  node_bartdbl["Detection variant"]
  node_asltune["ASL tuning"]
end

subgraph group_eval["Evaluation and outputs"]
  node_evaluation["Task evaluation<br/>[evaluation.py]"]
  node_predictions["Prediction files"]
  node_bartpred["BART predictions"]
  node_metrics["ASL metrics<br/>[asl_metrics.csv]"]
end

node_researcher(("Researcher"))
node_hf["Pretrained model source"]

node_researcher -->|"starts training"| node_multitask
node_researcher -->|"selects approach"| node_qqpmodel
node_researcher -->|"starts training"| node_stsmodel
node_researcher -->|"starts generation"| node_bartgen
node_researcher -->|"starts detection"| node_bartdetect
node_sstdata -->|"loads examples"| node_datasets
node_qqpdata -->|"loads examples"| node_datasets
node_stsdata -->|"loads examples"| node_datasets
node_etpcdata -->|"loads examples"| node_datasets
node_datasets -->|"tokenizes batches"| node_tokenizer
node_multitask -->|"loads task data"| node_datasets
node_multitask -->|"encodes sentences"| node_bertcore
node_qqpmodel -->|"loads task data"| node_datasets
node_qqpmodel -->|"encodes pairs"| node_bertcore
node_stsmodel -->|"loads task data"| node_datasets
node_stsmodel -->|"encodes pairs"| node_bertcore
node_ssttune -->|"fine-tunes encoder"| node_bertcore
node_sstrdrop -->|"fine-tunes encoder"| node_bertcore
node_multitask -->|"evaluates model"| node_evaluation
node_qqpmodel -->|"evaluates model"| node_evaluation
node_stsmodel -->|"evaluates model"| node_evaluation
node_evaluation -->|"returns predictions"| node_predictions
node_bartgen -->|"saves generations"| node_bartpred
node_bartdetect -->|"loads labels"| node_etpcdata
node_asltune -->|"loads training data"| node_etpcdata
node_asltune -->|"records metrics"| node_metrics
node_multitask -.->|"loads checkpoint"| node_hf
node_qqpmodel -.->|"loads checkpoint"| node_hf
node_stsmodel -.->|"loads checkpoint"| node_hf
node_bartgen -.->|"loads checkpoint"| node_hf
node_bartdetect -.->|"loads checkpoint"| node_hf

click node_sstdata "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/data/sst-sentiment-train.csv"
click node_qqpdata "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/data/quora-paraphrase-train.csv"
click node_stsdata "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/data/sts-similarity-train.csv"
click node_etpcdata "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/data/etpc-paraphrase-train.csv"
click node_tokenizer "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/tokenizer.py"
click node_datasets "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/datasets.py"
click node_multitask "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier.py"
click node_qqpmodel "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier_qqp.py"
click node_stsmodel "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier_sts.py"
click node_ssttune "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/sst_finetune_gradual_unfreezing.py"
click node_sstrdrop "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/sst_finetune_rdrop.py"
click node_bertcore "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/bert.py"
click node_bartgen "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/bart_generation.py"
click node_bartdetect "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/finetune_bart_detection_asl.py"
click node_bartdbl "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/finetune_bart_detection-dbloss.py"
click node_asltune "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/asl_hparam_tuner.py"
click node_evaluation "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/evaluation.py"
click node_predictions "https://github.com/bilalahmed0060/deep-nlp-bertified/tree/main/predictions/bert"
click node_bartpred "https://github.com/bilalahmed0060/deep-nlp-bertified/tree/main/predictions/bart"
click node_metrics "https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/metrics/asl_metrics.csv"

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_sstdata,node_qqpdata,node_stsdata,node_etpcdata,node_datasets toneBlue
class node_tokenizer,node_multitask,node_qqpmodel,node_stsmodel,node_ssttune,node_sstrdrop,node_bertcore toneAmber
class node_bartgen,node_bartdetect,node_bartdbl,node_asltune toneMint
class node_evaluation,node_predictions,node_bartpred,node_metrics toneRose
class node_researcher,node_hf toneIndigo
```

## Components

### Task data

- [SST data](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/data/sst-sentiment-train.csv): `data/sst-sentiment-train.csv`
- [QQP data](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/data/quora-paraphrase-train.csv): `data/quora-paraphrase-train.csv`
- [STS data](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/data/sts-similarity-train.csv): `data/sts-similarity-train.csv`
- [ETPC data](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/data/etpc-paraphrase-train.csv): `data/etpc-paraphrase-train.csv`
- [Batch datasets](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/datasets.py): `datasets.py`

### BERT tasks

- [BERT tokenizer](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/tokenizer.py): `tokenizer.py`
- [Multitask BERT](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier.py): `multitask_classifier.py`
- [QQP variants](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier_qqp.py): `multitask_classifier_qqp.py`
- [STS variants](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/multitask_classifier_sts.py): `multitask_classifier_sts.py`
- [SST fine-tuning](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/sst_finetune_gradual_unfreezing.py): `sst_finetune_gradual_unfreezing.py`
- [SST R-Drop](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/sst_finetune_rdrop.py): `sst_finetune_rdrop.py`
- [BERT encoder](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/bert.py): `bert.py`

### BART tasks

- [Paraphrase generation](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/bart_generation.py): `bart_generation.py`
- [ETPC detection](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/finetune_bart_detection_asl.py): `finetune_bart_detection_asl.py`
- [Detection variant](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/finetune_bart_detection-dbloss.py): `finetune_bart_detection-dbloss.py`
- [ASL tuning](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/asl_hparam_tuner.py): `asl_hparam_tuner.py`

### Evaluation and outputs

- [Task evaluation](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/evaluation.py): `evaluation.py`
- [Prediction files](https://github.com/bilalahmed0060/deep-nlp-bertified/tree/main/predictions/bert): `predictions/bert`
- [BART predictions](https://github.com/bilalahmed0060/deep-nlp-bertified/tree/main/predictions/bart): `predictions/bart`
- [ASL metrics](https://github.com/bilalahmed0060/deep-nlp-bertified/blob/main/metrics/asl_metrics.csv): `metrics/asl_metrics.csv`

### Other components

- **Researcher**
- **Pretrained model source**

## Connections

- Researcher → Multitask BERT: starts training
- Researcher → QQP variants: selects approach
- Researcher → STS variants: starts training
- Researcher → Paraphrase generation: starts generation
- Researcher → ETPC detection: starts detection
- SST data → Batch datasets: loads examples
- QQP data → Batch datasets: loads examples
- STS data → Batch datasets: loads examples
- ETPC data → Batch datasets: loads examples
- Batch datasets → BERT tokenizer: tokenizes batches
- Multitask BERT → Batch datasets: loads task data
- Multitask BERT → BERT encoder: encodes sentences
- QQP variants → Batch datasets: loads task data
- QQP variants → BERT encoder: encodes pairs
- STS variants → Batch datasets: loads task data
- STS variants → BERT encoder: encodes pairs
- SST fine-tuning → BERT encoder: fine-tunes encoder
- SST R-Drop → BERT encoder: fine-tunes encoder
- Multitask BERT → Task evaluation: evaluates model
- QQP variants → Task evaluation: evaluates model
- STS variants → Task evaluation: evaluates model
- Task evaluation → Prediction files: returns predictions
- Paraphrase generation → BART predictions: saves generations
- ETPC detection → ETPC data: loads labels
- ASL tuning → ETPC data: loads training data
- ASL tuning → ASL metrics: records metrics
- Multitask BERT → Pretrained model source: loads checkpoint
- QQP variants → Pretrained model source: loads checkpoint
- STS variants → Pretrained model source: loads checkpoint
- Paraphrase generation → Pretrained model source: loads checkpoint
- ETPC detection → Pretrained model source: loads checkpoint
