Ulam-2-Small: A Model for Mathematical Proofs and STEM Research
2 min read
The new Ulam-2-Small model by the ulam.ai team, based on the Qwen2 architecture (3.1 billion parameters), was created using weight programming without any additional training steps or gradient updates (backpropagation). The model is designed for solving exploratory mathematical problems, verifying hypotheses, and multi-step quantitative STEM reasoning. The model outputs internal reasoning inside ... tags before the final answer.
Key features
- 3.09 billion parameters based on the Qwen2 architecture.
- Context length of up to 131,072 tokens.
- Built using structured component replacement and spectral modification without training.
- Designed for exploratory mathematical problem solving and quantitative STEM reasoning.
What you can do
- Solve complex math problems and draft proof outlines.
- Run the model locally using Hugging Face Transformers libraries.
- Integrate into local pipelines via vLLM for processing long contexts.
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "ulamai/Ulam-2-Small"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{
"role": "user",
"content": "Prove that for every positive integer n, gcd(n! + 1, (n + 1)! + 1) = 1.",
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
with torch.inference_mode():
output = model.generate(
**inputs,
do_sample=True,
temperature=0.6,
top_p=0.95,
max_new_tokens=16384,
)
completion = output[0, inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(completion, skip_special_tokens=True))
Read more
DetailsBased on Ulam-1-Small and VibeThinker-3B.
Weight type: BF16 (two .safetensors files).
License: MIT.










Comments