HARP-RoPE — Rotary Positional Encoding for Long Contexts
HARP: an ongoing hierarchically-anchored rotary positional encoding for long-context transformers, validated by from-scratch pretraining of 160M/420M LLMs.
The idea
Transformers rely on positional encodings to sense word order and distance. The popular RoPE scheme packs local order, long-range distance and structure into one fixed global schedule — which recent analyses link to long-context retrieval failures and numerical fragility. HARP (Hierarchically Anchored Rotary Phases) is an ongoing project that instead factors a token's position into hierarchical coordinates — a coarse chunk index, a within-chunk offset and optional structure — each driving its own band of learnable phases, while leaving some channels unrotated as a content bypass.
Why it's promising
HARP is set up to contain RoPE exactly as a special case, so training only departs from that strong baseline when it actually helps — and its design is meant to control the numerical error that plagues long-context models in BF16. It's being validated by pretraining 160M- and 420M-parameter models from scratch. (Full formulation is held back while the work is under submission.)
Tech stack & key skills
Core tools, methods and skills demonstrated in this project: