Model reference · open weights
xlnet-cased is an open-weight language model from xlnet. xlnet-base-cased (BF16) weighs 467 MB; the smallest configuration that runs it is RTX 3060 12 GB.
For self-hosting, compare this build's requirements below with the GPU you plan to rent.
Summary of the xlnet/xlnet-base-cased model card, 2026-10-01
What it is
| Released by | xlnet |
|---|---|
| Released | 2022-03-02 |
| VRAM | 467 MB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory | |
|---|---|---|---|---|
| 8K each | 32K each | |||
| RTX 3060 12 GB | 35 | 8 | 128K | 11.6 GB |
| RTX 4060 Ti 16 GB | 47 | 11 | 128K | 15.4 GB |
| RTX 3090 24 GB | 74 | 18 | 128K | 23.4 GB |
| RTX 4090 24 GB | 74 | 18 | 128K | 23.4 GB |
| RTX 5090 32 GB | 99 | 24 | 128K | 31.0 GB |
| L40S 48 GB | 142 | 35 | 128K | 44.0 GB |
| A100 80 GB | 255 | 63 | 128K | 78.2 GB |
| H100 80 GB | 246 | 61 | 128K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 298 | 74 | 128K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 343 | 85 | 128K | 107 GB |
| H200 141 GB | 445 | 111 | 128K | 138 GB |
| B200 180 GB | 571 | 142 | 128K | 176 GB |
| Requests at once | 8K tokens each | 32K tokens each |
|---|---|---|
| 1 | 1.3 GB | 2.2 GB |
| 5 | 2.5 GB | 7.0 GB |
| 8 | 3.4 GB | 10.6 GB |
| 16 | 5.8 GB | 20.3 GB |
| 32 | 10.6 GB | 39.6 GB |
| 64 | 20.3 GB | 78.3 GB |
One card, with vLLM's small-card settings.
From the model card
XLNet model pre-trained on English language. It was introduced in the paper XLNet: Generalized Autoregressive Pretraining for Language Understanding by Yang et al. and first released in this repository.
Disclaimer: The team releasing XLNet did not write a model card for this model so this model card has been written by the Hugging Face team.
XLNet is a new unsupervised language representation learning method based on a novel generalized permutation language modeling objective. Additionally, XLNet employs Transformer-XL as the backbone model, exhibiting excellent performance for language tasks involving long context. Overall, XLNet achieves state-of-the-art (SOTA) results on various downstream language tasks including question answering, natural language inference, sentiment analysis, and document ranking.
The model is mostly intended to be fine-tuned on a downstream task. See the model hub to look for fine-tuned versions on a task that interests you.
Note that this model is primarily aimed at being fine-tuned on tasks that use the whole sentence (potentially masked) to make decisions, such as sequence classification, token classification or question answering. For tasks such as text generation, you should look at models like GPT2.
Here is how to use this model to get the features of a given text in PyTorch:
from transformers import XLNetTokenizer, XLNetModel
tokenizer = XLNetTokenizer.from_pretrained('xlnet-base-cased')
model = XLNetModel.from_pretrained('xlnet-base-cased')
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)
last_hidden_states = outputs.last_hidden_state
@article{DBLP:journals/corr/abs-1906-08237,
author = {Zhilin Yang and
Zihang Dai and
Yiming Yang and
Jaime G. Carbonell and
Ruslan Salakhutdinov and
Quoc V. Le},
title = {XLNet: Generalized Autoregressive Pretraining for Language Understanding},
journal = {CoRR},
volume = {abs/1906.08237},
year = {2019},
url = {http://arxiv.org/abs/1906.08237},
eprinttype = {arXiv},
eprint = {1906.08237},
timestamp = {Mon, 24 Jun 2019 17:28:45 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-1906-08237.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.