Downloads · 30 days
239
28% of all-time downloads
alea-institute/kl3m-004-correction-001
kl3m-004-correction-001 is a text generation model from alea-institute. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc-by-4.0.
kl3m-004-correction-001 is a small, ~500M parameter language model designed to assist in the correction of common typing, spelling, OCR, and format issues in English text, especially in the financial and legal domains.
Downloads · 30 days
239
28% of all-time downloads
All-time downloads
839
Public
Parameters
478M
1.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.9 GB · 100%
From the Hugging Face model README
kl3m-004-correction-001 is a small, ~500M parameter language model designed to assist in the correction of common typing, spelling, OCR, and format issues in English text, especially in the financial and legal domains.
Notably, this model has been trained on the alea-institute/kl3m-004-char-8k-cased tokenizer, which is a BPE tokenizer trained with a 3-character maximum token constraint. This character-level tokenization enables the model to effectively handle character-level corrections and transformations.
kl3m-004-correction-001 is particularly effective for:
Simply prompt the model with the original text, followed by the <|sep|> token, and wait for stop token (<|end|>) generation. You can use pipeline to handle this for you.
In many situations, deterministic correction (i.e., most probable logit sequence) is fine.
from transformers import pipeline
p = pipeline('text-generation', 'alea-institute/kl3m-004-correction-001', device='cpu')
text = "Tne Uni+ed 5tates is nct responsib|e for 5uch pr0duction"
correction = p(text + "<|sep|>", max_new_tokens=512, return_full_text=False)[0]['generated_text']
# Output: The United States is not responsible for such production
In other situations, it can be useful to generate multiple corrections with a sampler and evaluate the distribution. For example:
from transformers import pipeline
from collections import Counter
p = pipeline('text-generation', 'alea-institute/kl3m-004-correction-001', device='cuda')
text = "Tne Uni+ed 5tates is nct responsib|e for 5uch pr0duction"
corrections = Counter(
[
g['generated_text']
for g in p(
text + "<|sep|>",
max_new_tokens=512,
return_full_text=False,
temperature=0.5,
# top_p, top_k, custom sampler, etc.
do_sample=True,
num_return_sequences=10
)
]
).most_common(3)
# Output: [('The United States is not responsible for such production', 7), ('the United States is not responsible for such production', 3)]
The model supports various parameters to control the generation process:
temperature: Controls randomness (lower = more deterministic)top_p: Nucleus sampling parameter (lower = more focused)top_k: Limits vocabulary selection to top k tokensmax_new_tokens: Maximum number of tokens to generatedo_sample: Whether to use sampling vs. greedy decodingnum_return_sequences: Number of different sequences to generateThis model was originally trained for 3 days on 1xRTX3090, and a larger ~3B parameter MoE version is pending release.
This model was trained on a dataset generated with the KL3M data collection and the alea-data-generator library, which can create realistic synthetic samples using traditional (non-generative) techniques.
The source code to retrieve and process this dataset is available here: https://github.com/alea-institute/kl3m-data
Some pre-tokenized subsets of the KL3M data collection are available on Hugging Face: https://huggingface.co/datasets?sort=most_rows&search=kl3m-data
Complete, raw data is available upon request at this time via S3 under a Requester Pays model. We are actively working on a zero-cost distribution model as soon as we can obtain additional support.
kl3m-004-correction-001 uses the following special tokens from the kl3m-004-char-8k-cased tokenizer:
<|start|>: Token ID 0<|end|>: Token ID 1<|pad|>: Token ID 2<|unk|>: Token ID 3<|sep|>: Token ID 4 (used as a separator between the input text and corrected output)<|cls|>: Token ID 5<|mask|>: Token ID 6This model is intended for use in:
https://github.com/alea-institute/kl3m-model-research
@misc{kl3m-004-correction-001,
author = {ALEA Institute},
title = {kl3m-004-correction-001: A Character-Level Text Correction Model},
year = {2024},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/alea-institute/kl3m-004-correction-001}}
}
@article{bommarito2025kl3m,
title={KL3M Tokenizers: A Family of Domain-Specific and Character-Level Tokenizers for Legal, Financial, and Preprocessing Applications},
author={Bommarito, Michael J and Katz, Daniel Martin and Bommarito, Jillian},
journal={arXiv preprint arXiv:2503.17247},
year={2025}
}
Model weights are released under the CC-BY 4.0 License.
The KL3M model family is maintained by the ALEA Institute. For technical support, collaboration opportunities, or general inquiries:
