The KL3M Data Project: Copyright-Clean Training Resources for Large Language Models
Paper • 2504.07854 • Published
How to use alea-institute/kl3m-006-170m-checkpoint-33000 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="alea-institute/kl3m-006-170m-checkpoint-33000") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("alea-institute/kl3m-006-170m-checkpoint-33000")
model = AutoModelForCausalLM.from_pretrained("alea-institute/kl3m-006-170m-checkpoint-33000", device_map="auto")How to use alea-institute/kl3m-006-170m-checkpoint-33000 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "alea-institute/kl3m-006-170m-checkpoint-33000"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "alea-institute/kl3m-006-170m-checkpoint-33000",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/alea-institute/kl3m-006-170m-checkpoint-33000
How to use alea-institute/kl3m-006-170m-checkpoint-33000 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "alea-institute/kl3m-006-170m-checkpoint-33000" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "alea-institute/kl3m-006-170m-checkpoint-33000",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "alea-institute/kl3m-006-170m-checkpoint-33000" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "alea-institute/kl3m-006-170m-checkpoint-33000",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use alea-institute/kl3m-006-170m-checkpoint-33000 with Docker Model Runner:
docker model run hf.co/alea-institute/kl3m-006-170m-checkpoint-33000
docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "alea-institute/kl3m-006-170m-checkpoint-33000" \
--host 0.0.0.0 \
--port 30000# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "alea-institute/kl3m-006-170m-checkpoint-33000",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'A 170M parameter language model trained on legal agreements using the Muon optimizer with spectral clamping.
Generates coherent, fluent legal text with no repetition issues. Best for legal/contractual content.
from transformers import pipeline
# Create text generation pipeline
generator = pipeline(
"text-generation",
model="alea-institute/kl3m-006-170m-checkpoint-33000",
torch_dtype="auto",
device_map="auto"
)
# Generate text
outputs = generator(
"This Agreement is entered into as of",
max_new_tokens=100,
temperature=0.7,
top_p=0.95,
repetition_penalty=1.15
)
print(outputs[0]['generated_text'])
For technical details, see the paper: https://arxiv.org/abs/2504.07854
@misc{kl3m2025,
title={KL3M: Knowledge-Guided Language Model Training},
author={Alea Institute},
year={2025},
url={https://arxiv.org/abs/2504.07854},
note={Trained with Muon optimizer and spectral clamping}
}
Apache 2.0
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "alea-institute/kl3m-006-170m-checkpoint-33000" \ --host 0.0.0.0 \ --port 30000# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alea-institute/kl3m-006-170m-checkpoint-33000", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'