Skip to content

Sequence Diagrams

Sudhanshu edited this page Nov 11, 2026 · 1 revision

Sequence and Lifecycle Diagrams

Full fine-tuning runtime

sequenceDiagram
    autonumber
    participant User as Python/Jupyter user
    participant Data as Dataset + split
    participant Tok as AutoTokenizer
    participant Model as DistilBERT classifier
    participant Tr as HF Trainer
    participant Disk as Local artifacts
    User->>Data: Create 30 labeled examples; stratified 80/20 split
    Data->>Tok: map(tokenize_function)
    Tok-->>Data: token IDs and attention masks
    User->>Model: from_pretrained(distilbert-base-uncased, 4 labels)
    User->>Tr: create_trainer(model, args, datasets, collator, metrics)
    loop 4 epochs; batches of 8
      Tr->>Model: forward(batch)
      Model-->>Tr: logits / loss
      Tr->>Model: backward + optimizer step
      opt epoch evaluation
        Tr->>Model: validation forward
        Model-->>Tr: predictions
      end
    end
    Tr->>Disk: save_model(best_model)
    User->>Tok: save_pretrained(best_model)
    User->>Tr: evaluate(), predict()
    Tr-->>User: accuracy, weighted F1, report/confusion matrix
Loading

Saved artifacts

flowchart LR
    A[Training run] --> B[support_classifier checkpoints]
    B --> C[support_classifier/best_model]
    C --> D[Model weights + config]
    C --> E[Tokenizer files]
    A --> F[support_classifier_frozen runs]
    G[Proposed Phi-2 SFT] -.-> H[sft_output / sft_model]
    H -.-> I[dpo_output / dpo_model]
    J[.gitignore] -.->|excludes large weights, cache, venv| B
Loading

For the alternate frozen-backbone run, a separate Trainer is constructed after the full model's predictions are printed. The intended Phi-2 SFT/DPO sequence is available on Phi2-SFT-DPO-Design.

Clone this wiki locally