Instructions to use dragonscale-ai/kniv-deberta-nlp-base-en-xsmall with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dragonscale-ai/kniv-deberta-nlp-base-en-xsmall with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="dragonscale-ai/kniv-deberta-nlp-base-en-xsmall")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("dragonscale-ai/kniv-deberta-nlp-base-en-xsmall", device_map="auto") - Notebooks
- Google Colab
- Kaggle
kniv-deberta-nlp-base-en-xsmall
A compact multi-task NLP student model that performs the same 5 language analysis tasks as our production teacher from a single DeBERTa-v3-xsmall encoder pass: POS tagging, Named Entity Recognition, Dependency Parsing, Semantic Role Labeling, and Dialog Act Classification.
This is the smallest deployable variant in the kniv cascade family — optimized for resource-constrained environments (edge devices, low-latency applications, embedded contexts) while preserving the full 5-head capability of the teacher.
Part of the Rustic initiative by Dragonscale Industries Inc.
| Source code | GitHub |
| Teacher | kniv-deberta-nlp-base-en-large (443M) |
| Encoder | DeBERTa-v3-xsmall (384d, 12 layers) |
| Parameters | 74.7M (70.7M encoder + 4.0M heads) |
| Compression | 5.9× smaller than teacher |
| Download | 299 MB (PyTorch) / 300 MB (ONNX FP32) / 92 MB (ONNX INT8) |
| License | CC-BY-SA-4.0 |
Quick Start
ONNX
pip install torch transformers==5.6.2 onnxruntime
import onnxruntime as ort
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("dragonscale-ai/kniv-deberta-nlp-base-en-xsmall")
session = ort.InferenceSession("onnx/cascade.onnx")
pos, ner, arc, label, srl, cls = session.run(None, {
"input_ids": input_ids, # int64 [batch, seq]
"attention_mask": attention_mask, # int64 [batch, seq]
"predicate_idx": predicate_idx, # int64 [batch] — verb token index (0 if unused)
})
PyTorch
pip install torch transformers==5.6.2 seqeval
python examples/cascade_demo.py --model models/kniv-deberta-nlp-base-en-xsmall
The demo script loads the model, runs all 5 heads, and prints POS tags, NER entities, dependency tree, SRL frames, and dialog acts.
Benchmark Results
All benchmarks use standard public test sets. No benchmark data was used during training. Results are reproducible via the included benchmark scripts.
| Head | Score | Metric | Benchmark | Split |
|---|---|---|---|---|
| POS | 0.963 | Accuracy | UD English EWT | test |
| NER | 0.774 | F1 | CoNLL-2003 (mapped) | test |
| DEP | 0.942 / 0.920 | UAS / LAS | UD English EWT | test |
| SRL | 0.829 | F1 | PropBank EWT | test |
| CLS | 0.938 | Macro F1 | SGD + GPT (8 labels, internal) | dev |
NER on CoNLL-2003 was evaluated by mapping our 18 OntoNotes entity types to the 4 CoNLL types (PER, ORG, LOC, MISC). Numeric entities (DATE, MONEY, PERCENT, QUANTITY, ORDINAL, CARDINAL, TIME) have no CoNLL equivalent and are mapped to O — this is a strictly harder protocol than CoNLL-trained baselines.
CLS DailyDialog cross-evaluation accuracy: 0.585 (with lossy 8→4 label mapping; informationally lossy comparison).
# Reproduce benchmarks
python models/download_benchmarks.py
python models/student_benchmark_standard.py \
--model-dir models/kniv-deberta-nlp-base-en-xsmall --backend all
Runtime Performance
Single-call latency on NVIDIA RTX 4070 Laptop GPU (CUDA 13.0, ONNX Runtime 1.25.1 with CUDA 13 build):
| Runtime | bs=1 seq=64 | bs=1 seq=128 | bs=32 seq=128 (sent/s) |
|---|---|---|---|
| ONNX FP32 CUDA | 5.79 ms | 8.09 ms | 502 |
| PyTorch CUDA | 12.15 ms | 12.92 ms | 599 |
| ONNX INT8 CPU | 22.22 ms | 34.49 ms | 61 |
| ONNX FP32 CPU | 24.75 ms | 43.14 ms | 47 |
| PyTorch CPU | 129.17 ms | 63.51 ms | 30 |
Recommended runtimes:
- GPU server: ONNX FP32 CUDA at 8 ms latency
- CPU edge / embedded: ONNX INT8 CPU at 34 ms, 92 MB model size
INT8 quality drops vs FP32: POS −0.21, NER −0.99, DEP −0.03, SRL −0.84, CLS internal −0.87.
Architecture
Identical cascade structure to the teacher, with all sizes auto-scaled to the smaller encoder hidden dimension (384d):
DeBERTa-v3-xsmall + pred_embedding
│
├─ ScalarMix(all) → Linear(17) → POS
├─ ScalarMix(all) → BiLSTM(96) → +POS probs → MLP(37) → NER [Viterbi]
├─ ScalarMix(all) → BiLSTM(96) → +POS/NER probs → Biaffine → DEP
├─ ScalarMix(all) → +pred interaction features +POS+DEP probs
│ → BiLSTM(192) → MLP(42) → SRL [Viterbi]
└─ ScalarMix(all) → AttentionPool → MLP(8) → CLS
The architecture mirrors the teacher's design (see the teacher's model card for the full ScalarMix / cascade / predicate embedding rationale). The student auto-scales each head's internal dimensions proportionally to the encoder width.
Training
This model is a distilled student of
kniv-deberta-nlp-base-en-large.
The training pipeline is two-stage:
Stage 1 — Distillation (~8 epochs): student learns from teacher's soft logits (KL on POS/NER/SRL/CLS, hard CE for DEP arc/relation), teacher's intermediate hidden states (PKD-style MSE matching), and consistency regularization (R-Drop).
Stage 2 — Fine-tune: SRL gold + teacher silver supervision, then CLS fine-tune with frozen encoder/SRL components to preserve the SRL peak achieved in Stage 2a.
See docs/design-knowledge-distillation.md
for the distillation methodology in full.
Limitations
- English only. Encoder and training data are English.
- Capacity-bound for SRL. The 384d hidden dimension limits the model's
ability to track long argument spans; the larger
smallvariant scores marginally higher on SRL benchmarks. - Same data caveats as teacher. NER trained on silver labels (SpanMarker); CLS trained on dialog data (may misclassify news/documents); SRL requires predicate index; DEP uses greedy decoding (no MST).
- Requires
transformers==5.6.2. Other versions produce incorrect outputs.
Model Family
| Model | Encoder | Params | Compression | SRL F1 |
|---|---|---|---|---|
| kniv-deberta-nlp-base-en-xsmall | DeBERTa-v3-xsmall (384d, 12L) | 74.7M | 5.9× | 0.829 |
| kniv-deberta-nlp-base-en-small | DeBERTa-v3-small (768d, 6L) | 157.1M | 2.8× | 0.831 |
| kniv-deberta-nlp-base-en-large | DeBERTa-v3-large (1024d, 24L) | 443M | — | 0.843 |
Citation
@misc{kniv-cascade-2026,
title={kniv-deberta-nlp-base-en-xsmall: Distilled Multi-Task NLP Cascade},
author={Dragonscale Industries Inc.},
year={2026},
url={https://huggingface.co/dragonscale-ai/kniv-deberta-nlp-base-en-xsmall}
}
License
CC-BY-SA-4.0
Built by Dragonscale Industries Inc. | Rustic
Model tree for dragonscale-ai/kniv-deberta-nlp-base-en-xsmall
Base model
microsoft/deberta-v3-xsmallDatasets used to train dragonscale-ai/kniv-deberta-nlp-base-en-xsmall
dragonscale-ai/kniv-corpus-en
Collection including dragonscale-ai/kniv-deberta-nlp-base-en-xsmall
Evaluation results
- POS Accuracy on UD English EWTtest set self-reported0.963
- F1 (mapped 18→4 types) on CoNLL-2003test set self-reported0.774
- UAS on UD English EWTtest set self-reported0.942
- LAS on UD English EWTtest set self-reported0.920
- F1 on PropBank EWTtest set self-reported0.829
- Macro F1 on SGD + GPTself-reported0.938