AI Glossary / MLOps and deployment / Intermediate

Burrows - Wheeler transform

Definition

The Burrows - Wheeler transform (BWT) is a reversible rearrangement of a block of symbols that can make the block easier to compress. It groups symbols according to surrounding context while retaining enough information to recover their original order. The transform itself does not reduce the number of symbols.

What it means

Reordering can help compression even without removing anything. If symbols that tend to occur in similar contexts are placed near one another, a later coding stage can exploit that local regularity.

BWT is therefore a preprocessing transform rather than a complete compressor. A practical compression pipeline may follow it with move-to-front processing, run coding or entropy coding. The choice and overhead of those stages determine the final size.

The name refers to Michael Burrows and David Wheeler, whose 1994 report describes the block-sorting compression approach.

How it works

A conceptual construction forms every cyclic rotation of a block and sorts those rotations lexicographically. It then collects the final symbol of each sorted row. That last column is the transformed block.

The construction also records which sorted row corresponds to the original block. Alternatively, presentations may use a unique end marker with suitable conventions. The decoder needs the appropriate information to identify the original sequence rather than merely one of its rotations.

Inversion relies on the relationship between the sorted first column and the last column. Matching repeated symbols in their stable order lets the decoder follow predecessor relationships and rebuild the input.

Efficient implementations do not have to store the entire square matrix used in classroom demonstrations. Sorting and indexing structures avoid that enormous representation. Block size still affects memory, processing and how much context a compressor can exploit.

Three practical examples

1. Text compression: A block-sorting compressor can rearrange text so later stages encode repeated local patterns effectively. The complete file includes information needed to reverse all stages.

2. Sequence indexing research: BWT-related representations support compressed indexing techniques used to search symbol sequences. Such an index adds data structures and search rules beyond the transform alone.

3. Compression education: A small rotation table demonstrates how a reversible rearrangement can expose structure without deleting symbols. It also shows why the original-row information matters.

Think of it this way

Think of sorting cards by the text that follows a marked position, then collecting the symbols just before those positions. Cards with similar continuations become neighbors, so their preceding symbols can become easier to predict.

The analogy does not mean simply alphabetizing the original characters. Ordinary sorting of the characters would lose their original arrangement. BWT retains a specific relationship that supports reconstruction.

Worked example

Worked example

Use the invented block CABA, with alphabet order A before B before C. Its four cyclic rotations are CABA, ABAC, BACA and ACAB.

Sorting them gives these rows, numbered from zero: row 0 is ABAC; row 1 is ACAB; row 2 is BACA; row 3 is CABA. Reading their last characters produces CBAA. Record original-row index 3.

To see inversion, sort the last-column characters CBAA to obtain first column AABC. Match the first A in the last column with the first A in the first column, and likewise for the second A. B and C each have one occurrence. This produces the last-to-first mapping [3, 2, 0, 1].

Start at original row 3. Read last-column A, then follow the mapping to row 1 and read B, then row 2 and read A, then row 0 and read C. These are the original characters in reverse order: A, B, A, C. Reversing them gives CABA.

The transformed column still contains four symbols, with exactly the same symbol counts. The row index adds information rather than removing it. Any actual size reduction must come from subsequent coding, and this short example does not establish a useful compression ratio.

Illustrative case study

Illustrative case study - fictional

A fictional archive team experiments with block-sorting compression for logs. A prototype writes the transformed characters but omits the original-row index. Tests on some repetitive examples appear plausible, but general reconstruction is incomplete.

The team adds the required metadata and checks exact decoding on empty, repeated and mixed-symbol blocks. It then compares complete compressed sizes and memory use across block choices.

The evaluation includes the later coding stages rather than crediting the transform alone with compression. This invented case illustrates correctness and accounting; it does not report a real archive result.

Common misconceptions and mistakes

  • BWT rearranges symbols; it does not itself shorten the block.
  • Sorting the original characters alphabetically is not the same operation.
  • Original-row or equivalent end-marker information is essential under the chosen construction.
  • A conceptual rotation matrix is not a requirement to allocate quadratic storage in practice.
  • More visible runs in one example do not guarantee better compression on every input.

Business use

BWT is useful background when evaluating block-sorting formats or compressed sequence indexes. For storage decisions, compare complete encoders rather than transforms in isolation.

Check memory, block latency and the decoding access pattern alongside file size. Large blocks may expose more context but also change resource requirements. For AI datasets, preserve exact bytes when losslessness is required, and keep text normalization or other semantic preprocessing distinct from reversible compression. A smaller representation does not clean the dataset or improve its labels.

People also ask

Can the transform be reversed?

Yes, with the metadata or marker conventions required by the chosen form of the transform.

Does it always create long runs of identical characters?

No. It groups symbols by context, and the resulting local patterns depend on the input. Subsequent coding may exploit more than simple runs.

Is BWT the same as bzip2?

No. BWT is a transform used as part of block-sorting compression designs. A complete format such as bzip2 includes additional processing and framing.

Check your understanding

A four-symbol block becomes another four-symbol block after BWT. Has the transform failed because the length did not shrink?

Answer: No. Preserving symbol count is expected. The purpose is to create a representation that later coding stages may compress more effectively.

Related terms

  • Move-to-front transform
  • Entropy coding
  • Run-length encoding
  • Lossless compression
  • block sorting
  • suffix array
  • compressed index

Learn next

Transform a longer block with repeated substrings and compare local symbol patterns before and after. Then apply a simple coding stage and count its complete output, including the original-row index.

More in MLOps and deployment

  • Bit rate - Bit rate is the number of binary digits, or bits, transferred or represented per unit of time, normally measured in bits per second.
  • Bitstream format - A bitstream format is the set of rules that defines how information is arranged and interpreted in a sequence of bits.
  • Brotli - Brotli is a general-purpose lossless compression format and algorithm family for representing data in fewer bytes when its patterns permit.
  • Canonical Huffman code - A canonical Huffman code is a Huffman-style prefix code whose bit patterns are assigned by a fixed ordering rule once each symbol's code length is known.
  • CDR coding - CDR coding is a technique for reducing the memory occupied by Lisp list cells.
  • Checkpoint - A checkpoint is a saved representation of a computation's state at a particular point.

Sources

Sources: Burrows and Wheeler, A Block-sorting Lossless Data Compression Algorithm, 1994: https://www.cs.jhu.edu/~langmea/resources/burrows_wheeler.pdf ; NIST Dictionary of Algorithms and Data Structures: https://xlinux.nist.gov/dads/HTML/burrowsWheelerTransform.html . The original report's transform and inversion sections and NIST's indexed attribution were reviewed. The CABA example was independently calculated. Source-label correction remains an editorial requirement.

Previous: Bundle adjustment Next: Burst buffer

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer