Instructions to use ulamai/Ulam-2-Small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ulamai/Ulam-2-Small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ulamai/Ulam-2-Small") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ulamai/Ulam-2-Small") model = AutoModelForCausalLM.from_pretrained("ulamai/Ulam-2-Small", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ulamai/Ulam-2-Small with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ulamai/Ulam-2-Small" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ulamai/Ulam-2-Small", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ulamai/Ulam-2-Small
- SGLang
How to use ulamai/Ulam-2-Small with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ulamai/Ulam-2-Small" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ulamai/Ulam-2-Small", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "ulamai/Ulam-2-Small" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ulamai/Ulam-2-Small", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ulamai/Ulam-2-Small with Docker Model Runner:
docker model run hf.co/ulamai/Ulam-2-Small
Ulam-2-Small
Ulam-2-Small (v1.0.0) is a 3,085,938,688-parameter (Qwen2ForCausalLM, bfloat16) mathematical and quantitative STEM reasoning model developed by ulam.ai. Released checkpoint W43 (W43_S2_simplex_uv_w12) was constructed via weight-space programming without additional gradient-based updates (0 backpropagation, adapter, or optimizer steps), combining proof-oriented ulamai/Ulam-1-Small (v1.0.0, $U$) with its ancestor WeiboAI/VibeThinker-3B ($V$) through structured component replacement, spectral modification, forward-pass second-moment routing, and depth-dependent three-vertex interpolation.
Built with Qwen. Upstream architectural and checkpoint lineage (Qwen2.5-3B, Qwen2.5-Coder-3B, WeiboAI/VibeThinker-3B, and ulamai/Ulam-1-Small) and exact weight-space modifications are recorded in NOTICE and provenance.json. The full technical paper, Ulam-2-Small: Weight-Space Programming, is included in paper/ulam2_small_technical_report.pdf, paper/ulam2_small_technical_report.md, and paper/ulam2_small_technical_report.tex.
The release targets exploratory mathematical problem solving, proof-style research reasoning, and multi-stage quantitative STEM derivations. It is not a formal proof-certification engine: candidate proofs, counterexamples, and categorical completion claims require independent expert or formal verification.
Model details
| Field | Value |
|---|---|
| Developer | ulam.ai |
| Repository | ulamai/Ulam-2-Small |
| Release | v1.0.0 |
| Architecture | Qwen2ForCausalLM (36 blocks, residual width 2,048, 16Q / 2KV GQA, SwiGLU width 11,008, tied 151,936 vocab) |
| Parameters | 3,085,938,688 |
| Weight dtype | BF16 (2 standalone .safetensors shards, round-to-nearest-even) |
| Architectural context length | 131,072 tokens (evaluated at 65,536โ102,400 tokens) |
| Selected checkpoint | W43 (W43_S2_simplex_uv_w12, depth-dependent three-vertex blend) |
| Gradient training steps | 0 (torch.set_grad_enabled(False)) |
Changed BF16 coordinates vs Ulam-1-Small |
106,241,413 / 3,085,938,688 (3.4428% across 274 / 434 tensors, $|\Delta_Q|_F = 0.423013$) |
| License | MIT License |
Weight-space programming construction
Qwen/Qwen2.5-3B
-> Qwen/Qwen2.5-Coder-3B
-> WeiboAI/VibeThinker-3B (V)
-> ulamai/Ulam-1-Small (U, v1.0.0)
-> [L01-06 spectral clipping + L04-27 coupled SwiGLU/Q-O second-moment routing + L04-24 GQA KV + L27-35 completion adjustments] -> Intermediate S = W12
-> [Depth-dependent three-vertex blend {U, V, S} + BF16 cast] -> ulamai/Ulam-2-Small (W43, v1.0.0)
Let $U$ denote ulamai/Ulam-1-Small (v1.0.0), $V$ denote WeiboAI/VibeThinker-3B (77bd2cced09193c8b9a59a32bd8577bbd1f3e01c), and $S = W_{12}$ denote the stored structured intermediate (88,116,709 changed BF16 coordinates, 2.8554%, $|\Delta_Q|F \approx 0.676$). Writing $S = U + M \odot (V - U) + R$โwhere $M$ is the binary routing mask for coupled SwiGLU triples and attention query/output head pairs ranked by domain-conditioned forward activation second moments, and $R$ holds early-layer singular-value clipping ($\sigma{1..3} \to 1.5\sigma_4$ in L01โL06), shared-key/value scaling ($\rho_g = 0.55,k_g/8$ in L04โL24), late loop/termination adjustments (L27โL35), and intermediate rounding residualsโUlam-2-Small (W43) applies the depth-dependent pre-rounding blend:
- Trunk blocks (
L00โL27): $$0.50,U + 0.15,V + 0.35,S = U + (0.15 + 0.35,M)\odot(V - U) + 0.35,R$$ Where $R = 0$, unselected coordinates receive donor coefficient0.15and routed coordinates receive0.50, before round-to-nearest-even BF16 storage. - Tail blocks (
L28โL35): $$0.85,U + 0.15,S = U + 0.15,M\odot(V - U) + 0.15,R$$ Omitting direct $V$ weight in the final eight blocks keeps late-layer representations closer to $U$ while attenuating $S$'s structured displacement. - Embeddings and final normalization: Input embeddings, the tied language-model head, and the final RMS normalization remain identically at $U$.
See paper/ulam2_small_technical_report.pdf for exact BF16 directional rounding thresholds (characterizing why 96.5572% of parameters remain unchanged in W43 and why doubling uniform interpolation from 0.15 in W24 to 0.30 in W25 increases Frobenius displacement by 1.99985x while expanding support by only 12.23%), stochastic-rounding variance bounds, and controlled comparisons against local activation-repair families and a matched-norm random rank-eight control.
Quick start with Transformers
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))
Ulam-2-Small emits internal reasoning enclosed in <think>...</think> delimiters before its final answer. Downstream applications should parse <think>...</think> explicitly and provision sufficient max_new_tokens (32,768โ65,536 recommended for hard proof and quantitative STEM problems).
Serving with vLLM
vllm serve ulamai/Ulam-2-Small \
--dtype bfloat16 \
--max-model-len 65536 \
--served-model-name ulamai/Ulam-2-Small
Example OpenAI-compatible request:
curl http://localhost:8000/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "ulamai/Ulam-2-Small",
"messages": [{"role": "user", "content": "Find all primes p such that p^2 + 2 is also prime, and prove no others exist."}],
"temperature": 0.6,
"top_p": 0.95,
"max_tokens": 16384
}'
Evaluation
1. Verifier-Scored Multi-Domain STEM & Math Reasoning (ulam.ai)
Candidate edits (W20โW43) were screened on Dev-Screen-600 (600 tasks, 278 connected-component task families, seeds = [42, 1042], temperature = 0.6, top_p = 0.95, max_model_len = 65,536, max_tokens = 57,344) against four point-estimate gates: exceeding $U$ (0.2026), $W_{12}$ (0.2107), first restoration candidate W20 (0.2085), and a matched-norm random rank-eight perturbation (0.2104). Only two uniform parent blends (W24 at 0.15, W25 at 0.30) and the three-vertex blend W43 cleared all four gates; every tested local activation-repair setting scored below the random control's point estimate (0.2010โ0.2085).
The surviving blends were evaluated on family-disjoint Dev-Confirm-600 (600 tasks, 355 families). After selecting W43 as Ulam-2-Small under a research-mathematics-first release priority, we ran a single pre-registered post-selection comparison against $U$ on untouched Lockbox-592 (592 tasks, 446 families, 2,368 rollouts):
Split / Pool (64K context, seeds = [42, 1042]) |
Role | Tasks (Families) |
Ulam-1-Small ($U$) |
Ulam-2-Small (W43) |
Paired W43 - U (95% Family CI) |
</think> Closure (U / W43) |
|---|---|---|---|---|---|---|
Post-selection Lockbox-592 |
Fixed-release final test | 592 (446) |
0.2010 |
0.2058 |
+0.0049 [-0.0073, +0.0172] (111W / 375T / 106L) |
76.9% / 77.2% |
Dev-Confirm-600 |
Held-out from screen (used in selection) | 600 (355) |
0.2245 |
0.2221 |
-0.0024 [-0.0128, +0.0091] |
78.0% / 77.8% |
Confirm + Lockbox (descriptive pool) |
Reused observations | 1,192 (801) |
0.2128 |
0.2140 |
+0.0012 [-0.0069, +0.0098] |
77.4% / 77.5% |
All 1792 (includes Dev-Screen-600) |
Descriptive summary | 1,792 (1,079) |
0.2094 |
0.2132 |
+0.0038 [-0.0025, +0.0104] |
77.7% / 78.3% |
Comparison across all five Dev-Confirm-600 checkpoints:
| Checkpoint | Dev-Screen-600 Mean@2 |
Dev-Confirm-600 Mean@2 |
Confirm vs U (95% Family CI) |
Confirm Full-Credit Pass@2 Tasks (/600) |
Pooled Dev-1200 Pass@2 |
|---|---|---|---|---|---|
Ulam-1-Small ($U$, v1.0.0) |
0.2026 |
0.2245 |
0.0000 (โ) |
17 |
2.83% |
W24 ($\operatorname{fl}(0.85U + 0.15V)$) |
0.2153 |
0.2241 |
-0.0004 [-0.0123, +0.0109] |
19 |
3.08% |
Ulam-2-Small (W43, released) |
0.2115 |
0.2221 |
-0.0024 [-0.0128, +0.0091] |
18 |
2.75% |
W12 (structured intermediate $S$) |
0.2107 |
0.2178 |
-0.0067 [-0.0155, +0.0025] |
20 |
2.83% |
W25 ($\operatorname{fl}(0.70U + 0.30V)$) |
0.2145 |
0.2132 |
-0.0113 [-0.0227, +0.0015] |
22 |
3.42% |
- Interpretation & domain behavior: Under the original confirmation-score rule,
W24placed first among edits (W43 - W24 = -0.0020,95% CI [-0.0157, +0.0127]), and neither reached the prespecified+0.015pooled development target (+0.0033forW43,+0.0061forW24). OnLockbox-592, the post-selection comparison (+0.0049,[-0.0073, +0.0172]) detects no aggregate reward difference relative to $U$ and accommodates both modest harm and modest benefit. Within domains,W43exceeded $U$ in confirmation Physics (0.4389vs0.4344) and Mathematics (0.1367vs0.1178) and had positive mathematics differences across screening (+0.0245), confirmation (+0.0189), and lockbox (+0.0121; exploratory271-task pool:0.1565vs0.1380,+0.0185,[+0.0030, +0.0348]), while trailing $U$ in the other five nonzero confirmation domains.
The 600-task Final Evaluation Benchmark and 1,200-task Weight-Editing Suite with deterministic Python verifiers are available at ulam.ai.
2. Research Mathematical Reasoning โ ErdosBench (ulam.ai/erdosbench)
Each checkpoint generated one cold response per problem across 226 proprietary research-level mathematics problems (seed = 42, temperature = 0.6, top_p = 0.95, max_model_len = 102,400, max_tokens = 100,000, without tools or reference answers), graded on a 0โ4 scale (0 = unusable or invalid central argument; 1 = limited valid content alongside material flaws; 2 = clean baseline progress; 3 = substantial rigorous partial progress; 4 = accepted resolution of the essential task or decisive central counterexample under the repair policy; max 904 total points). Finalists W24, W25, and W43 received two audit versions (A and B) on the same generated responses alongside retained historical anchor grades for $U$ and W12:
| Checkpoint / audit | Score 0 |
Score 1 |
Score >= 2 |
Score 4 |
Fatal central error | Total Points (/904) |
Declarations (Accepted) |
|---|---|---|---|---|---|---|---|
Ulam-1-Small ($U$), historical |
115 |
103 |
8 |
2 |
112 |
124 |
20 (1*) |
W12, historical |
124 |
89 |
13 |
3 |
121 |
123 |
27 (3) |
W24, Audit A |
126 |
84 |
16 |
4 |
125 |
126 |
31 (4) |
W25, Audit A |
125 |
84 |
17 |
3 |
121 |
125 |
22 (3) |
Ulam-2-Small (W43), Audit A |
125 |
83 |
18 |
4 |
123 |
129 |
25 (4) |
W24, Audit B |
137 |
77 |
12 |
6 |
132 |
114 |
31 (6) |
W25, Audit B |
134 |
81 |
11 |
3 |
130 |
109 |
22 (3) |
Ulam-2-Small (W43), Audit B |
127 |
89 |
10 |
5 |
123 |
120 |
25 (5) |
*Note: $U$'s second Score-4 response uses a partial-progress verdict rather than a solved/refuted declaration.
- Outcome redistribution & release tradeoff: Relative to
Ulam-1-Small($U$),Ulam-2-Small(W43) increases accepted full resolutions (Score 4) from2to4(Audit A) or5(Audit B) andScore >= 2responses from8to18(A) or10(B), while also increasing zero-score answers from115to125(A) /127(B) and fatal central errors from112to123. Aggregate points are+5above $U$ in A and-4below $U$ in B (W43 - UAudit B item-bootstrap95% CI [-0.1150, +0.0841]). AgainstW24,W43leads by+3points in A and+6points in B (W43 - W24Audit B95% CI [-0.0841, +0.1372], remaining+1to+19points ahead across all288combinations of seven cross-reviewed borderline records) with fewer fatal central errors (123vs125in A,123vs132in B) and fewer unaccepted completion declarations (21vs27in A,20vs25in B, compared with $U$'s19). We selectedW43for its accepted-resolution coverage and total-score edge overW24under both audits while reporting both tails of this distribution. Individual problem statements, identifiers, and solution witnesses are proprietary to ulam.ai/erdosbench and withheld from public artifacts.
Machine-readable summaries and confidence intervals are provided in evaluation_results.json.
Intended uses and limitations
Intended uses
- Exploratory mathematical problem solving and proof-sketch generation with human verification;
- Multi-stage quantitative STEM derivation and verifier-scored reasoning research;
- Precision-aware weight-space programming and model-merging research on open-weights checkpoints;
- Local or cloud inference via
TransformersandvLLMunder the MIT License.
Limitations and out-of-scope uses
- Not formally verified & higher tail failure count: Roughly
80%โ84%of self-declared solved/refuted declarations on research-level mathematics problems are not accepted under audit (21/25in Audit A,20/25in Audit B), andW43exhibits more fatal central errors (123vs112) thanUlam-1-Smallalongside its higher accepted-resolution count (4โ5vs2). Never treat outputs as certified theorems without independent expert or formal verification. - Generation horizon sensitivity: Measured reward depends strongly on
</think>termination and token budget (32Kโ64K+recommended; truncating below8,192tokens cuts off reasoning before answers are finalized). - Single-turn cold base evaluation: Base evaluations do not invoke external Python interpreters, CAS engines, or Lean proof checkers.
- High-stakes domains: Out of scope for clinical, safety-critical engineering, legal, or autonomous deployment. See RESPONSIBLE_USE.md.
Reproducibility and integrity
paper/ulam2_small_technical_report.pdf/.md/.texโ Full technical paper (Ulam-2-Small: Weight-Space Programming).release_manifest.jsonโ Complete file inventory, byte sizes, and SHA-256 digests.provenance.jsonโ Three-vertex blend weights, structural operator parameters, and parent/shard SHA-256 digests.evaluation_results.jsonโ Aggregate benchmark tables, domain means, and statistical claim boundaries.weight_edit_receipt.json,artifact_integrity_receipt.json, andvllm_validation_receipt.jsonโ Realized BF16 coordinate diff and runtime validation receipts.checksums.sha256โ Cryptographic SHA-256 manifest binding every file in the repository.
License
Ulam-2-Small, including its released BF16 model weights, is released under the MIT License. Upstream attribution and archived licenses are provided in NOTICE and UPSTREAM_LICENSES/.
Citation
@misc{ulam2026ulam2small,
title = {Ulam-2-Small: Weight-Space Programming},
author = {{ulam.ai}},
year = {2026},
month = nov,
howpublished = {Hugging Face model release and technical report},
url = {https://huggingface.co/ulamai/Ulam-2-Small}
}
Contact
For model inquiries, ErdosBench evaluation, or licensing the Ulam Multi-Domain Verifiable STEM & Math RL Suite, visit ulam.ai.
- Downloads last month
- 76
Model tree for ulamai/Ulam-2-Small
Evaluation results
- Mean@2 verifier reward on Ulam Multi-Domain Verifiable STEM RL Suite (Post-selection Lockbox-592, 2 seeds)Ulam AI Verifiable STEM RL Suite0.206
- Mean@2 verifier reward on Ulam Multi-Domain Verifiable STEM RL Suite (Dev-Confirm-600, 2 seeds)Ulam AI Verifiable STEM RL Suite0.222
- Full-credit Pass@2 on Ulam Multi-Domain Verifiable STEM RL Suite (Dev-Confirm-600, 2 seeds)Ulam AI Verifiable STEM RL Suite0.030
- Audit A total points (out of 904) on ErdosBench proof audit A and B (226 problems, 0-4 rubric)Ulam AI ErdosBench129.000
- Audit B total points (out of 904) on ErdosBench proof audit A and B (226 problems, 0-4 rubric)Ulam AI ErdosBench120.000