The model is not loaded. The model is visited.
Glacial is an exact, out-of-core decode prototype for causal language models. It proves that a model can be executed by visiting only the needed BF16 tensors from safetensors, instead of instantiating the full Hugging Face model.
The current working backend targets:
ibm-granite/granite-3.1-1b-a400m-instruct
Current status: slow, exact, greedy, checkpointable, inspectable, and OpenAI-compatible enough for local tools.
/v1/chat/completions shimGlacial is not a high-throughput inference server. It is a reference/runtime prototype for latency-insensitive exact decode. One generated token may be slow; operational correctness and resumability matter more than speed.
Sampling is supported with temperature, top-k, and top-p. The RNG state is persisted in checkpoints, so sampled sequences are reproducible and resumable. temperature=0 (the default) produces greedy argmax.
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
For the test harness:
python -m pip install -r requirements-dev.txt
The first run may download the Granite model from Hugging Face. Add --local-files-only once the model is cached.
python tools/glacial_generate.py \
--chat-user "Say hello in three words." \
--max-new-tokens 8 \
--show-token-telemetry
Checkpointed run:
python tools/glacial_generate.py \
--prompt "Hello" \
--max-new-tokens 1 \
--checkpoint-dir runs/hello \
--show-token-telemetry
Resume:
python tools/glacial_generate.py \
--resume-from runs/hello \
--max-new-tokens 1 \
--show-token-telemetry
Inspect:
python tools/inspect_checkpoint.py runs/hello \
--decode-tokens \
--show-tokens \
--local-files-only
Start the server:
python tools/glacial_openai_server.py \
--host 127.0.0.1 \
--port 8000 \
--served-model-name glacial-granite \
--local-files-only
Call it with curl:
curl http://127.0.0.1:8000/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "glacial-granite",
"messages": [{"role": "user", "content": "Say hello in three words."}],
"max_tokens": 8,
"temperature": 0
}'
See docs/openai-compatible-api.md for streaming and client examples.
The test suite proves correctness against the HF oracle. Slow tests require a cached model and are skipped by default.
# fast: just collect and verify skip behavior
python -m pytest tests/ -v
# slow: full integration tests against HF (requires model cache)
python -m pytest tests/ --runslow -v
Tests:
glacial/
weights.py safetensors byte-range loading + budget accounting
granite.py Granite MoE layer math (private to backend)
logits.py shared chunked LM head + greedy argmax helpers
sampler.py token sampler with checkpointable RNG state
generate.py shared generation utilities (embed, inputs, telemetry)
kv.py durable decode checkpoints
backends/ backend protocol and Granite adapter
tools/
glacial_generate.py CLI generator
glacial_openai_server.py OpenAI-compatible local API
inspect_checkpoint.py checkpoint inspector
hf_trace_*.py, probe_*.py development parity tools
tests/
conftest.py shared fixtures (model loading, decode helpers)
test_greedy_parity.py Glacial vs HF greedy parity
test_resume_parity.py checkpoint/resume vs uninterrupted
docs/cli.md — CLI usagedocs/openai-compatible-api.md — local API shimdocs/resumable-decode.md — checkpoint semanticsdocs/backend-abstraction.md — backend boundarydocs/mental-model.md — how to think about Glacialdocs/gemma4-reference.md — Gemma 4 architecture reference (research, not pursued — dense, not MoE)docs/lfm2-reference.md — LFM2.5-8B-A1B architecture reference (WIP — MoE, second backend target)docs/vision.md — project directiontorch.argmax(logits.float()), not topk()[0].token_ids.Python
100.0%
The model is not loaded. The model is visited.
Glacial is an exact, out-of-core decode prototype for causal language models. It proves that a model can be executed by visiting only the needed BF16 tensors from safetensors, instead of instantiating the full Hugging Face model.
The current working backend targets:
ibm-granite/granite-3.1-1b-a400m-instruct
Current status: slow, exact, greedy, checkpointable, inspectable, and OpenAI-compatible enough for local tools.
/v1/chat/completions shimGlacial is not a high-throughput inference server. It is a reference/runtime prototype for latency-insensitive exact decode. One generated token may be slow; operational correctness and resumability matter more than speed.
Sampling is supported with temperature, top-k, and top-p. The RNG state is persisted in checkpoints, so sampled sequences are reproducible and resumable. temperature=0 (the default) produces greedy argmax.
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
For the test harness:
python -m pip install -r requirements-dev.txt
The first run may download the Granite model from Hugging Face. Add --local-files-only once the model is cached.
python tools/glacial_generate.py \
--chat-user "Say hello in three words." \
--max-new-tokens 8 \
--show-token-telemetry
Checkpointed run:
python tools/glacial_generate.py \
--prompt "Hello" \
--max-new-tokens 1 \
--checkpoint-dir runs/hello \
--show-token-telemetry
Resume:
python tools/glacial_generate.py \
--resume-from runs/hello \
--max-new-tokens 1 \
--show-token-telemetry
Inspect:
python tools/inspect_checkpoint.py runs/hello \
--decode-tokens \
--show-tokens \
--local-files-only
Start the server:
python tools/glacial_openai_server.py \
--host 127.0.0.1 \
--port 8000 \
--served-model-name glacial-granite \
--local-files-only
Call it with curl:
curl http://127.0.0.1:8000/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "glacial-granite",
"messages": [{"role": "user", "content": "Say hello in three words."}],
"max_tokens": 8,
"temperature": 0
}'
See docs/openai-compatible-api.md for streaming and client examples.
The test suite proves correctness against the HF oracle. Slow tests require a cached model and are skipped by default.
# fast: just collect and verify skip behavior
python -m pytest tests/ -v
# slow: full integration tests against HF (requires model cache)
python -m pytest tests/ --runslow -v
Tests:
glacial/
weights.py safetensors byte-range loading + budget accounting
granite.py Granite MoE layer math (private to backend)
logits.py shared chunked LM head + greedy argmax helpers
sampler.py token sampler with checkpointable RNG state
generate.py shared generation utilities (embed, inputs, telemetry)
kv.py durable decode checkpoints
backends/ backend protocol and Granite adapter
tools/
glacial_generate.py CLI generator
glacial_openai_server.py OpenAI-compatible local API
inspect_checkpoint.py checkpoint inspector
hf_trace_*.py, probe_*.py development parity tools
tests/
conftest.py shared fixtures (model loading, decode helpers)
test_greedy_parity.py Glacial vs HF greedy parity
test_resume_parity.py checkpoint/resume vs uninterrupted
docs/cli.md — CLI usagedocs/openai-compatible-api.md — local API shimdocs/resumable-decode.md — checkpoint semanticsdocs/backend-abstraction.md — backend boundarydocs/mental-model.md — how to think about Glacialdocs/gemma4-reference.md — Gemma 4 architecture reference (research, not pursued — dense, not MoE)docs/lfm2-reference.md — LFM2.5-8B-A1B architecture reference (WIP — MoE, second backend target)docs/vision.md — project directiontorch.argmax(logits.float()), not topk()[0].token_ids.Python
100.0%