# Efficient Lempel-Ziv Prediction with the Run-Length BWT

DevFeed: [Efficient Lempel-Ziv Prediction with the Run-Length BWT](<https://devfeed.tech/articles/efficient-lempel-ziv-prediction-with-the-run-length-bwt-114618.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.01874>)

Author: Ohad Avnery

Published: 2026-11-03T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [Compression](<https://devfeed.tech/topics/compression.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [algorithms](<https://devfeed.tech/tags/algorithms.md>), [alphabet](<https://devfeed.tech/tags/alphabet.md>), [bits](<https://devfeed.tech/tags/bits.md>), [bwt](<https://devfeed.tech/tags/bwt.md>), [computer-science](<https://devfeed.tech/tags/computer-science.md>), [cs-ds](<https://devfeed.tech/tags/cs-ds.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [history](<https://devfeed.tech/tags/history.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [improvement](<https://devfeed.tech/tags/improvement.md>), [lz77](<https://devfeed.tech/tags/lz77.md>), [mistakes](<https://devfeed.tech/tags/mistakes.md>), [online](<https://devfeed.tech/tags/online.md>), [prediction](<https://devfeed.tech/tags/prediction.md>), [sigma](<https://devfeed.tech/tags/sigma.md>), [string](<https://devfeed.tech/tags/string.md>), [symbols](<https://devfeed.tech/tags/symbols.md>), [time](<https://devfeed.tech/tags/time.md>), [update](<https://devfeed.tech/tags/update.md>)

## AI overview

The paper gives efficient online implementations of Lempel-Ziv Plurality (LZP) and a new Lempel-Ziv Majority (LZM) predictor, both with an O(z log n) mistake bound for strings with z LZ77 phrases. The RLBWT-based LZP uses O(z log z log² n) bits, with update time O(log z + log log n) and prediction time O(σ(log z + log log n)); its update time is reported as an exponential improvement over Kosoy's implementation. LZM keeps the same mistake bound and update time but predicts in O(1) time, independent of alphabet size. Both accept symbols without knowing the alphabet in advance. When the alphabet is known, a different structure takes O(σ(1 + log z / log log n)) time per symbol, constant for constant σ and polylogarithmic z.

## Source excerpt

arXiv:2611.01874v1 Announce Type: cross Abstract: Lempel-Ziv Plurality (LZP) is an algorithm of Kosoy that predicts the next symbol of a string by using its Lempel-Ziv factorization, and makes at most $O(z\log n)$ mistakes on every string of length $n$ with $z$ LZ77 phrases. We give efficient online implementations of LZP and of a new variant of it. Our first implementation maintains a run-length encoded Burrows-Wheeler transform (RLBWT) of the reversed history. It implements LZP, uses $O(z\log z\log^2 n)$ bits, and has worst-case update and prediction times $O(\log z+\log\log n)$ and $O(\sigma(\log z+\log\log n))$, respectively, where $\sigma$ is the size of the alphabet. This is an exponential improvement over Kosoy's implementation, whose update time is $O(z\log^7 n)$. We then introduce the Lempel-Ziv Majority (LZM) predictor, which has the same mistake bound and update time, and predicts in $O(1)$ time independently of $\sigma$. These two predictors accept new symbols at any time, without knowing the alphabet in advance. For an alphabet known in advance, a different data structure gives $O(\sigma(1+\log z/\log\log n))$ time per symbol, which is constant when $\sigma=O(1)$ and $z=\mathrm{polylog}(n)$.