The KoLMogorov-Test: Can CodeLMs lead to the next breakthrough in data compression?
The aim of the KoLMogorov-Test (KT) is to empirically evaluate the ability of CodeLMs to detect patterns in and compress sequences by writing short programs that output them.
The Task
Given a sequence, the CodeLM is asked to produce a short python program that outputs the sequence. The programs are compressed by a user-defined compressor before submission, and code length is measured in compressed form. In order to evaluate the correctness of a program, it is first decoded using a user-provided decoder and then executed. The decoder size counts towards the compressed length, and may contain e.g. a library of helper functions (DSL).The length of python and its standard library are not counted, but in order to prevent cheating the programs must pass a stringent check. Programs cannot import arbitrary modules, use advanced language features, access the internet, etc.
KT currently includes six modalities - text, DNA, three encodings of audio data (MFCC, 16-bit, and 8-bit), and synthetic sequences produced by random programs. Two dataset sizes are available: a small one with 1MB per modality, and a large one with 1GB (DNA and text only).
Getting Started
Access the data from the GitHub repo.In addition, we provide code to reproduce experiments from the paper including our DSL and evaluation code.
If you have any questions, please email us at thekolmogorovtest@gmail.com.
You are allowed to:
- Split the original sequence to subsequent sub-sequences.
- Use the standard python library including Gzip.
- Create new DSLs.
- Create new priors to encode the programs.
With the following restrictions:
- To prevent cases where compression of the data is performed by external code, we prevent access to the internet and usage of previous compression algorithms, excluding Gzip which is viewed as a strong baseline.
- We return the compression rate with and without the cost of the decoder. When reporting results, we consider the additional code as negligible if it is <100KB and does not scale with the length of the sequence. When reporting results for the 1GB seqeunces, please always report results including the decoder.
How can we achieve future progress?
In the paper we show that stronger models perform better on KT and thatn CodeLMs can outperform other compression methods on synthetic distributions when training data is avialable. Another exciting direction for future work is to encode programs as lambda experssions, making it feasible to fit a small interpreter of only 383 in the decoder as suggested here.
Making a New Submission
To make a new submission, upload three files - a file with the encoded program, a file that decodes the programs to executable code, and a file with the expected results. Let's consider a toy example for the sequence - [5, 10, 13, 14, 16, 5, 5, 5]
The programs file is a jsonl that follows the following format. We recommend submitting a single program for the whole sequence:
{"sub_sequence_start_index": 0, "sub_sequence_end_index": 7 (the length of the sequence), "encoded_program": "H4sIAI7Te2cC/8svLSkoLVGwVYg21VEwNABiYyA2AWIzHQVTCIoFAMxnYTIlAAAA (An encoding of the program whose execution results in the input sequence. This is the Gzip encoding of the program that returns the input sequence)."}
For simplicity, we allow splitting to subsequent sub-sequences:
{"sub_sequence_start_index": 0, "sub_sequence_end_index": k, "encoded_program": "An encoding of the program whose execution results in the subsequence between indeses [0, n]."}
{"sub_sequence_start_index": k+1, "sub_sequence_end_index": k+1+j, "encoded_program": "An encoding of the program whose execution results in the subsequence between indeses [n+1, n+1+m]."}
...
{"sub_sequence_start_index": n, "sub_sequence_end_index": len(sequence), "encoded_program": "An encoding of the program whose execution results in the subsequence between indeses [n, len(sequence)]."}
For decoding, upload a python file that implements the 'decode' method, which receives as input an programs from the programs file and returns the executable python program. Executing the decoded program must result in the input sequence. For example, this is a decoder that decompresses using Gzip.
import gzip
import base64
def decode(program):
return gzip.decompress(base64.b64decode(program)).decode('utf-8')
For the results, upload a Json file that matches the Result object returned from the official evaluation script. If you are interested in verification of your results, please send an email with the submission details. We will then execute the code and verify the execution matches the original sequece.
{
"compressed_programs_size": 64,
"decoder_size": 118,
"compressed_size": 182,
"compression_rate_without_decoder": 8.0,
"compression_rate": 22.75,
"accuracy": 1,
"gold_data_size": 8,
"first_error": null
}
KT Leaderboard - Can you beat Gzip on KT?
LLAMA-3.1-405B | 69.5 | 1.34 | 0.357 | ✓ |
LLAMA-3.1-405B | 54.2 | 1.94 | 0.714 | ✓ |
Gzip | 100 | 1 | 0.714 | ✓ |
GPT4-o | 54.2 | 1.94 | n/a | ✓ |
LLAMA-3.1-405B | 6.5 | 3.17 | n/a | ✓ |
LLAMA-3.1-70B | 9.6 | 3.17 | n/a | ✓ |
LLAMA-3.1-8B | 1.4 | 3.12 | n/a | ✓ |
LLAMA-3.1-405B | 36.4 | 1.43 | 0.398 | ✓ |
Gzip | 100 | 1 | 0.398 | ✓ |
GPT4-o | 36.4 | 1.43 | n/a | ✓ |
LLAMA-3.1-405B | 15 | 1.66 | n/a | ✓ |
LLAMA-3.1-70B | 10.1 | 1.67 | n/a | ✓ |
LLAMA-3.1-8B | 3.9 | 1.74 | n/a | ✓ |
LLAMA-3.1-405B | 69.5 | 1.34 | 0.92 | ✓ |
Gzip | 100 | 1 | 0.92 | ✓ |
GPT4-o | 69.5 | 1.34 | n/a | ✓ |
LLAMA-3.1-405B | 35.6 | 1.66 | n/a | ✓ |
LLAMA-3.1-70B | 18 | 1.96 | n/a | ✓ |
LLAMA-3.1-8B | 5.9 | 1.54 | n/a | ✓ |
LLAMA-3.1-405B | 83.8 | 1.33 | 0.903 | ✓ |
Gzip | 100 | 1 | 0.903 | ✓ |
GPT4-o | 83.8 | 1.33 | n/a | ✓ |
LLAMA-3.1-405B | 29.6 | 1.58 | n/a | ✓ |
LLAMA-3.1-70B | 24.2 | 1.56 | n/a | ✓ |
LLAMA-3.1-8B | 8.8 | 1.51 | n/a | ✓ |
SeqCoder-8B + Gzip | 44.7 | 0.64 | 0.593 | ✓ |
SeqCoder-8B + Gzip | 100 | 0.64 | 0.38 | ✓ |
Gzip | 100 | 1 | 0.593 | ✓ |
GPT4-o | 44.7 | 1.65 | n/a | ✓ |
LLAMA-3.1-405B | 24.8 | 2.06 | n/a | ✓ |
LLAMA-3.1-70B | 22.5 | 2.18 | n/a | ✓ |
LLAMA-3.1-8B | 3.7 | 2.34 | n/a | ✓ |
We would like to thank the GAIA team for sharing the source code for their leaderboard which we used as a template and HuggingFace for hosting the leaderboard.