distilbart-mnli-12-3

valhalla/distilbart-mnli-12-3

valhalla 192K downloads mpl Zero-Shot Classification
Frameworkstransformerspytorchjax
Datasetsmnli
Tagsbarttext-classificationdistilbartdistilbart-mnlizero-shot-classification
Downloads
192K
License
mpl
Pipeline
Zero-Shot Classification
Author
valhalla

Run distilbart-mnli-12-3 locally on a Q4KM hard drive

Accelerate your AI workloads with Q4KM’s high‑performance SSDs pre‑loaded with distilbart‑mnli‑12‑3 . Get instant, out‑of‑the‑box zero‑shot classification on your own hardware—no download, no setup....

Shop Q4KM Drives

Technical Overview

Model ID: valhalla/distilbart-mnli-12-3
Model Name: distilbart‑mnli‑12‑3
Author: valhalla
Pipeline Tag: zero‑shot‑classification

DistilBart‑MNLI‑12‑3 is a compact, distilled version of the large‑scale bart‑large‑mnli sequence‑to‑sequence model. It is purpose‑built for zero‑shot text classification using the Multi‑Genre Natural Language Inference (MNLI) dataset as a supervisory signal. By leveraging the “No Teacher Distillation” technique, the model copies alternating encoder/decoder layers from the teacher (bart‑large‑mnli) and then fine‑tunes the reduced architecture on the same MNLI data. The result is a model with only 12 encoder layers and 3 decoder layers, dramatically shrinking the parameter count while preserving most of the original performance.

Key Features & Capabilities

  • Zero‑shot classification out‑of‑the‑box – no task‑specific fine‑tuning required.
  • Fast inference thanks to a 3‑layer decoder (≈ ⅓ of the teacher’s decoder depth).
  • Compatible with Hugging Face transformers pipelines, Azure deployment, and JAX/PyTorch back‑ends.
  • Supports both “matched” and “mismatched” MNLI evaluation splits, making it robust across domains.

Architecture Highlights

  • Base architecture: BART (Bidirectional and Auto‑Regressive Transformers).
  • Encoder: 12 layers (identical to the teacher’s encoder).
  • Decoder: 3 layers – a thin slice of the original 12‑layer decoder, selected by alternating‑layer copying.
  • Parameter count: roughly 30 % of bart‑large‑mnli, yielding a model size of ~ 400 MB (exact size varies with tokenizer).
  • Training regime: “No Teacher Distillation” – no teacher‑student loss; the student is initialized from the teacher’s weights and then fine‑tuned on MNLI.

Intended Use Cases

  • Rapid prototyping of text‑classification pipelines where labeled data are scarce.
  • Deployments on edge or cloud environments with limited GPU memory (e.g., Azure Functions, on‑premise servers).
  • Multi‑domain sentiment, intent, or topic detection using a single model.
  • Research experiments that need a lightweight BART‑style encoder‑decoder for zero‑shot inference.

Benchmark Performance

The primary benchmark for distilbart‑mnli‑12‑3 is the MNLI suite, which reports two accuracy numbers:

  • Matched accuracy – 88.1 %
  • Mismatched accuracy – 88.19 %

These figures are only a few points below the full‑size bart‑large‑mnli baseline (89.9 % / 90.01 %). Compared with other distilled variants (distilbart‑mnli‑12‑1, 12‑6, 12‑9), the 12‑3 version strikes a sweet spot: it outperforms the 12‑1 model (87.08 % / 87.5 %) while staying well under the 12‑6 (89.19 % / 89.01 %) and 12‑9 (89.56 % / 89.52 %) checkpoints in terms of memory footprint and inference latency.

Why MNLI matters: the dataset is a standard benchmark for natural‑language inference, and zero‑shot classification pipelines are typically evaluated by treating the hypothesis as a candidate label. High matched/mismatched scores indicate that the model can generalize across genres (e.g., spoken, written, and mixed‑domain texts) without additional fine‑tuning, which is essential for production systems that must handle unpredictable input streams.

Hardware Requirements

VRAM for Inference – The distilled model fits comfortably in 4 GB of GPU memory when using a batch size of 1–8 and the default tokenizer. For larger batches (≥ 32) a 6–8 GB GPU is recommended to avoid out‑of‑memory errors.

Recommended GPU – Any modern NVIDIA GPU with at least 4 GB of VRAM (e.g., GTX 1650, RTX 2060) will run the model at sub‑100 ms latency for a single sentence. For high‑throughput workloads, a 12 GB RTX 3070 or an A100 (40 GB) can process thousands of sentences per second.

CPU Requirements – On CPU‑only inference, a 12‑core Xeon or AMD Ryzen 9 processor with 32 GB RAM can achieve ~ 30 ms per sentence using the torchscript or ONNX Runtime back‑ends. Multi‑threading (setting torch.set_num_threads) improves throughput.

Storage – The model files (config, tokenizer, and weights) occupy roughly 450 MB. Adding the optional onnx export adds another ~ 150 MB. A standard SSD (≥ 1 GB free) is sufficient.

Performance Characteristics – Compared with the full‑size BART‑large‑mnli, inference speed improves by 2–3× while memory usage drops by ~ 70 %. The trade‑off is a < 2 % absolute drop in MNLI accuracy, which is often acceptable for real‑time applications.

Use Cases

DistilBart‑MNLI‑12‑3 shines in scenarios where rapid, domain‑agnostic text classification is needed without the overhead of task‑specific fine‑tuning.

  • Content moderation: Classify user‑generated posts into categories such as “spam,” “harassment,” or “safe” in real time.
  • Customer support routing: Detect intent (e.g., “billing issue,” “technical bug”) from incoming tickets and forward them to the appropriate team.
  • Market research: Perform zero‑shot sentiment or topic analysis on social‑media streams across multiple languages (BART’s tokenizer supports multilingual vocabularies).
  • Enterprise search: Enrich search results with inferred tags, improving relevance without building a bespoke classifier for each tag.
  • Azure deployment: The model is tagged “deploy:azure,” making it straightforward to host as a containerized endpoint on Azure Machine Learning or Azure Functions.

Training Details

Methodology – The model is built using the “No Teacher Distillation” approach. First, alternating encoder/decoder layers are copied from the full‑size facebook/bart-large-mnli checkpoint, producing a student architecture with 12 encoder layers and 3 decoder layers. The student is then fine‑tuned on the MNLI dataset without any teacher‑student loss; only the standard cross‑entropy loss on the NLI labels is used.

Datasets – The training data is the official MNLI corpus (part of the GLUE benchmark). The README references a helper script download_glue_data.py to fetch the data.

Compute Requirements – Fine‑tuning was performed on a single GPU (e.g., NVIDIA V100) with a batch size of 32, taking roughly 4–5 hours to converge. The reduced decoder depth cuts training time by ~ 30 % compared to the full‑size teacher.

Fine‑tuning Capabilities – After the initial MNLI fine‑tuning, the model can be further adapted to domain‑specific NLI or zero‑shot classification tasks using the standard run_glue.py script. Because the model retains the BART encoder‑decoder interface, it can also be repurposed for summarisation or translation with additional task‑specific heads, though the primary design goal remains zero‑shot classification.

Licensing Information

The model card lists the license as “unknown.” In practice, this means the repository does not explicitly attach a standard open‑source license (e.g., MIT, Apache 2.0, or CC‑BY). When a license is unspecified, the safest legal stance is to treat the model as “all‑rights‑reserved” until the author clarifies its status.

Commercial Use – Without a clear permissive license, commercial exploitation carries risk. Many organizations adopt a “risk‑averse” policy, only using such models internally after obtaining explicit permission from the author or by checking the underlying data (MNLI) which is publicly available under a permissive license.

Restrictions & Requirements

  • Do not redistribute the model weights or code without consent.
  • If you publish research that uses the model, cite the original author (valhalla) and the Hugging Face model card.
  • Check the Hugging Face discussions for any community‑provided clarification on licensing.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives