Tool 02 · Algorithm Deep Dive
DeBERTa-v3 + Custom NER Pipeline
A requirement line is often two things at once — a functional ask and a compliance constraint. "Process 10,000 invoices per hour with SOX audit trail" is FUNC + NFR + COMP simultaneously. Standard multi-class classifiers force a single label, causing critical requirements to be miscategorized. Missing a COMP tag means $45k+ in validation work unaccounted for.
DeBERTa-v3 with multi-label classification head (6 sigmoid outputs). Disentangled Attention separates content from position, maintaining context across 50+ word SAP clauses. Multi-label architecture allows simultaneous tagging of FUNC, NFR, INT, DATA, COMP, and UX. Focal loss handles class imbalance.
DeBERTa-v3-base — 184M parameters, 12 transformer layers, disentangled attention mechanism.
6-label classification head: FUNC NFR INT DATA COMP UX
Focal Loss with γ=2.0 — down-weights easy examples, focuses on hard-to-classify edge cases.
66M-parameter student model for sub-80ms inference in production.
┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ REQUIREMENTS EXTRACTION PIPELINE │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ │
│ │ INPUT: │ "Process 10k invoices/hour with SOX audit trail and GDPR compliance" │
│ │ Requirement │ │
│ │ Text │ │
│ └──────┬───────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ STEP 1: TOKENIZATION │ │
│ │ SentencePiece BPE (128K vocab) → 512 token limit │ │
│ │ Tokens: [CLS] Process 10k invoices / hour with SOX ... [SEP] │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ STEP 2: DeBERTa-v3 ENCODING │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ 12 Transformer Layers │ │ │
│ │ │ │ │ │
│ │ │ Disentangled Attention Formula: │ │ │
│ │ │ A_ij = Content-to-Content(H_i, H_j) │ │ │
│ │ │ + Content-to-Position(H_i, P_j|i) │ │ │
│ │ │ + Position-to-Content(P_i|j, H_j) │ │ │
│ │ │ │ │ │
│ │ │ → Separates WHAT a word is from WHERE it appears │ │ │
│ │ │ → Maintains context across 18-word gaps │ │ │
│ │ └─────────────────────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ STEP 3: MULTI-LABEL CLASSIFICATION │ │
│ │ │ │
│ │ Pool [CLS] token → 6 Sigmoid Heads (independent probabilities) │ │
│ │ │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │ FUNC │ │ NFR │ │ INT │ │ DATA │ │ COMP │ │ UX │ │ │
│ │ │ σ=0.96 │ │ σ=0.89 │ │ σ=0.08 │ │ σ=0.12 │ │ σ=0.94 │ │ σ=0.03 │ │ │
│ │ │ ✓ │ │ ✓ │ │ │ │ │ │ ✓ │ │ │ │ │
│ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │ │
│ │ │ │
│ │ Binary Cross-Entropy Loss with Sigmoid: │ │
│ │ L = -1/N Σ [y_i·log(σ(x_i)) + (1-y_i)·log(1-σ(x_i))] │ │
│ │ │ │
│ │ Focal Loss variant (γ=2.0) for class imbalance │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ STEP 4: CALIBRATION & PRIORITY │ │
│ │ • Platt Scaling → Calibrated probabilities │ │
│ │ • Priority Classifier: Must (P>0.8) / Should (0.5-0.8) / Could (<0.5) │ │
│ │ • Confidence < 0.75 → Flag for Human Review │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ OUTPUT JSON: │ │
│ │ { │ │
│ │ "requirement": "Process 10k invoices/hour with SOX...", │ │
│ │ "labels": ["FUNC", "NFR", "COMP"], │ │
│ │ "probabilities": {"FUNC":0.96, "NFR":0.89, "COMP":0.94}, │ │
│ │ "priority": "Must", │ │
│ │ "confidence": 0.93, │ │
│ │ "human_review": false │ │
│ │ } │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────┘
Tool 02 is the CATEGORIZATION ENGINE — every downstream tool depends on accurate requirement tagging.
| Metric | Value | Benchmark |
|---|---|---|
| Micro F1 (Overall) | 91.8% | 4,400 human-labeled requirements |
| Macro F1 (per-class average) | 87.2% | 6-class balanced test set |
| FUNC Detection | 94.1% F1 | Most frequent class |
| COMP Detection | 89.3% F1 | Critical for compliance |
| Error Rate (w/ human review) | 3.1% | Threshold = 0.75 |
| Inference Latency (student) | 78ms | p99 on CPU |
Result: Requirement correctly tagged as Functional, Data, and Compliance. Fed to Tool 11 for GxP control pack activation and Tool 04 for compliance effort estimation.