Practical overview
When it fits
Use it when you want a code-level PyTorch implementation to experiment with long-sequence attention or configure an autoregressive sequence model, rather than a hosted model or end-user application.
Who it is for
- Python and PyTorch developers prototyping long-sequence models.
- Researchers or practitioners exploring autoregressive sequence modeling with configurable local windows and sequence projection.
Documented uses
- Configure a model to process token sequences using local and projected global attention.
- Obtain per-position vocabulary logits from token IDs and a mask.
- Set up a causal, segmented configuration for autoregressive experiments.
Requirements & limits
The implementation is available as a public GitHub repository under the MIT license. The README documents installation with pip.
- The API returns vocabulary logits, so users need to provide token IDs and a mask and build their own surrounding workflow.
- The non-causal and autoregressive examples use different configurations; causal use requires
causal=Trueandsegment_size. - The README's enwik8 reference identifies
train.pyas an autoregressive test entry point.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Configure an autoregressive model
Set up the documented causal Long Short Transformer configuration and obtain per-position vocabulary logits.
Before you start
- Python and PyTorch
- The long-short-transformer package, installable with pip
- Token IDs and a boolean mask
- Model choices for vocabulary size, dimensions, depth, heads, sequence length, window size, segment size and projection value
Steps
Install the package with the command below.
pip install long-short-transformerImport
LongShortTransformerand configure it withcausal=Trueand asegment_sizealongside the other model dimensions.Pass token IDs and a boolean mask to the model.
Use the returned per-position vocabulary logits in your sequence-modeling workflow.
Expected outcome
A causal model configuration that returns vocabulary logits for each input position.
Guide limitations
- The README provides a configuration example, not a complete training workflow.
- The example uses synthetic token IDs and an all-true mask.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- lucidrains/long-short-transformer · Official homepage title · retained in its source language

