Papers › SeqPE: Transformer with Sequential Position Encoding

SeqPE: Transformer with Sequential Position Encoding

16 Jun 2025arXiv:2506.13277archive 2025-07-28

Huayang Li, Yahui Liu, Hongyu Sun, Deng Cai, Leyang Cui, Wei Bi, Peilin Zhao, Taro Watanabe

Since self-attention layers in Transformers are permutation invariant by design, positional encodings must be explicitly incorporated to enable spatial understanding. However, fixed-size lookup tables used in traditional learnable position embeddings (PEs) limit extrapolation capabilities beyond pre-trained sequence lengths. Expert-designed methods such as ALiBi and RoPE, mitigate this limitation but demand extensive modifications for adapting to new modalities, underscoring fundamental challenges in adaptability and scalability. In this work, we present SeqPE, a unified and fully learnable position encoding framework that represents each n-dimensional position index as a symbolic sequence and employs a lightweight sequential position encoder to learn their embeddings in an end-to-end manner. To regularize SeqPE's embedding space, we introduce two complementary objectives: a contrastive objective that aligns embedding distances with a predefined position-distance function, and a knowledge distillation loss that anchors out-of-distribution position embeddings to in-distribution teacher representations, further enhancing extrapolation performance. Experiments across language modeling, long-context question answering, and 2D image classification demonstrate that SeqPE not only surpasses strong baselines in perplexity, exact match (EM), and accuracy--particularly under context length extrapolation--but also enables seamless generalization to multi-dimensional inputs without requiring manual architectural redesign. We release our code, data, and checkpoints at https://github.com/ghrua/seqpe.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2506.13277")

Code

Syntology Ran 4 of 12 code samples harvested from 1 repository linked to this paper; 8 have no recorded run. Of those that ran: 2 ran · violated contract; 2 ran · our draft was wrong.

By repository: official repository: 12 samples from 1 repository, 4 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

ghrua/seqpe officialmentioned in papermentioned on GitHubjax report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

12 samples harvested; 4 ran; 0 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · violated contract
2ran · our draft was wrong
8unverified

Licence: 12 of the 12 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from ghrua/seqpe. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

is_image_file ghrua/seqpe/image_seqpe/eval/prepare_imagenet_c.py official repository ran · violated contract no licence file found · pointer only · 89c2cf3b97685684 · report
auc ghrua/seqpe/image_seqpe/eval/cal_imagenet_c.py official repository ran · violated contract fingerprinted no licence file found · pointer only · 7a93b4bf9b9553b9 · report
find_classes ghrua/seqpe/image_seqpe/eval/prepare_imagenet_c.py official repository ran · our draft was wrong no licence file found · pointer only · 9347fb42c15d6687 · report
make_dataset ghrua/seqpe/image_seqpe/eval/prepare_imagenet_c.py official repository ran · our draft was wrong no licence file found · pointer only · 87889f77c597efa2 · report
agreement ghrua/seqpe/image_seqpe/consistency.py official repository unverified no licence file found · pointer only · 165c5336f89f847c · report
build_scheduler ghrua/seqpe/image_seqpe/lr_scheduler.py official repository unverified no licence file found · pointer only · c02cc4e0b5720211 · report
conver_to_numpy ghrua/seqpe/image_seqpe/models/analysis_utils.py official repository unverified no licence file found · pointer only · c62cad01937c7c94 · report
create_logger ghrua/seqpe/image_seqpe/logger.py official repository unverified no licence file found · pointer only · 80450600f7f09b0a · report
get_config ghrua/seqpe/image_seqpe/config.py official repository unverified no licence file found · pointer only · a4c21041d0740a79 · report
grad_loss_breaching ghrua/seqpe/image_seqpe/gradvit/gradvit_losses.py official repository unverified no licence file found · pointer only · e2db69c3a1bd384a · report
image_loss ghrua/seqpe/image_seqpe/gradvit/gradvit_losses.py official repository unverified no licence file found · pointer only · 04948c144e3d948f · report
l2_norm_anl ghrua/seqpe/image_seqpe/models/analysis_utils.py official repository unverified no licence file found · pointer only · 4cd3558621f0286a · report

Tasks

Image ClassificationKnowledge DistillationLanguage ModelingLanguage ModellingQuestion Answeringimage-classification

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

ALiBiKnowledge Distillation

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections