DiJiang
A Pythia language model whose attention is replaced by DiJiang's linear, DCT-based kernelized attention.
Language · 432 operations Checked
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
- Task
- Language
- Parameters
- 72.2M
- Operations
- 432
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICML 2024
- Cited by
- 0 (as of 26 October 2026)
- Authors
- Hanting Chen, Zhicheng Liu, Xutao Wang and others
- Source
- GitHub: YuchuanTian/DiJiang
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m16077
- Graph hash
- a4a8cd5c112c6396a5fc653b50e6fbb2ff3f9dc5608189f134b8a0a149baa3f3
- Skeleton hash
- 1cf7ab227282b806a01015403cf14d0e5ce6d39d1f5176aa849a7e7deb7d3e21
- Architecture hash
- 4f8d355481caf95b8cf6c0bc50aff3fb383c3f1e5c3dde1eb8a48b9f293d38ad
- Diagram SHA-256
- 062325c38d9ba2794da3b87ab4ee126db78173ae0d26b92616c66dce5cb04daa
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
DiJiang is a method for turning a pre-trained vanilla Transformer language model into one whose attention has linear complexity, with little training cost. The paper's starting point is that earlier improvements to attention typically need extensive retraining, which is impractical for large language models.
The method maps the queries and keys of the attention mechanism to the frequency domain using a Discrete Cosine Transform (DCT). This mapping removes the softmax operation and makes the attention computation linear in complexity. The authors trace the main approximation error of earlier linear attention schemes to Monte Carlo sampling, and use weighted Quasi-Monte Carlo sampling instead.
The authors validated the method on Pythia, a model with a fully public dataset and training procedure. Each DiJiang model was fine-tuned from the pre-trained Pythia model. The evaluation used six public datasets used by Pythia: PIQA, WinoGrande, WSC, ARC-E, ARC-C and LogiQA. Across model sizes from 70M to 2.8B parameters, the paper reports that average performance on these datasets was nearly identical to that of the original Pythia, at about 1/16 of the training cost. The name comes from DiJiang, a mythical monster in Chinese tradition known for its capability to move quickly.
Key idea. DiJiang converts a pre-trained vanilla Transformer into a linear complexity model with little training cost, using a frequency domain kernelization of attention based on the Discrete Cosine Transform.
- dijiang
- linear attention
- frequency domain kernelization
- compact kernelization
- discrete cosine transform
- kernelized attention
- efficient large language model
- weighted quasi-monte carlo
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{chen2024dijiangefficientlargelanguage,
title={DiJiang: Efficient Large Language Models through Compact Kernelization},
author={Hanting Chen and Zhicheng Liu and Xutao Wang and Yuchuan Tian and Yunhe Wang},
year={2024},
eprint={2403.19928},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2403.19928},
}