All models

xlnet

An autoregressive language model that learns bidirectional context by permuting the factorization order.

Language · 816 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (29 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
360.3M
Operations
816
Framework
PyTorch
Recurrent
No
Published
2019
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m11315
Graph hash
0cac466f839004c76404f7e56baac1c919959f4c2a0fe51f16647a87b887d83d
Skeleton hash
2a7e1ec3addfe8fabf2f6e7f0ea349d248ca2bcf1259f3ca3fc391706c7beeae
Architecture hash
8b4b77cbbf27b02e8273f350e8b37847a7d2309af7bc5a66ac0a48aca8952bd3
Diagram SHA-256
f042204bc2107d3a3c0454eda4ed395a2be211a5b0a7dd4c21e3f74195939fb7
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

transformers.AutoModelForCausalLM.from_config()

What it is

XLNet is a language model pretrained with a generalized autoregressive method that still learns from context on both sides of a token. It does this by maximizing the expected likelihood over all permutations of the factorization order of the input sequence, and it is an extension of the Transformer-XL model. The paper sets it against BERT, which corrupts the input with masks and so neglects dependency between the masked positions and suffers from a pretrain-finetune discrepancy. It reports that, under comparable experiment settings, XLNet outperforms BERT on 20 tasks, including question answering, natural language inference, sentiment analysis, and document ranking.

The permutation is carried out with a mask: the sentence is fed to the model in the right order, and the mask hides the previous tokens in some given permutation. XLNet also uses the same recurrence mechanism as Transformer-XL to build long-term dependencies, and it has no sequence length limit.

Key idea. XLNet is a generalized autoregressive pretraining method that learns bidirectional contexts by maximizing the expected likelihood over all permutations of the factorization order.

  • xlnet
  • generalized autoregressive pretraining
  • permutation language modeling
  • autoregressive language model
  • bidirectional context
  • language understanding

AI-written summary, based on the model's documentation and checked automatically against it; not reviewed by a person. Corrections welcome.