Instructions to use infosave/TML-d24-varloop-research-cmf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- cortiq
How to use infosave/TML-d24-varloop-research-cmf with cortiq:
# one Rust binary, no additional dependencies cargo install cortiq-cli # or a prebuilt binary from github.com/infosave2007/cmf/releases hf download infosave/TML-d24-varloop-research-cmf --include "*.cmf" --local-dir . ls *.cmf # some repos ship more than one quantization
cortiq run FILE.cmf --prompt "What is the capital of France?"
cortiq serve FILE.cmf --port 8080 # OpenAI-compatible server
- Notebooks
- Google Colab
- Kaggle
TML-d24-varloop-research — CMF
TML-d24-varloop-research is Thinking Machines'
variable-looped research counterpart of Inkling 2 Mini: a 26.4B mixture-of-experts model whose 12 middle layers run as
many times as you choose when you run it (trained at 1 to 5 passes, mostly 3; 3.4B active parameters a token at 1
pass, 5.4B at 3, 7.4B at 5). Here it is packaged as a single CMF file for
cortiq, a Rust inference engine with no Python and no ML framework: NVIDIA GPUs through CUDA or Vulkan, AMD and Intel
GPUs through Vulkan/DX12, Apple silicon through Metal, and the CPU. The file holds the language model and the release's
DSpark drafter; the vision tower is not in it. Measured:
- 15.12 GB, every weight on one 24 GB card. NVIDIA L4, CUDA, 3 passes: 50.9 tok/s; a 2 048-token prompt is read in 1.38 s and a 32 768-token one in 32.0 s.
- Passes are a run-time switch:
--loops 1decodes 98.5 tok/s,--loops 534.7; WikiText-2 perplexity goes from 9.930 at one pass to 9.239 at three and 9.218 at five. - DSpark speculative decoding on CUDA: the drafter shipped with the release proposes tokens that the model checks in one call; 78.2 tok/s on code and 68.7 on JSON instead of 50.6.
- The same card over Vulkan: 35.7 tok/s; MacBook Air M4 (24 GB): 21.8 tok/s through Metal, 10.8 on the CPU alone.
Quick start
cargo install cortiq-cli --features cuda
hf download infosave/TML-d24-varloop-research-cmf TML-d24-varloop-research-q4tp.cmf --local-dir .
CMF_GPU=cuda cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "Why is the sky blue? Answer in three sentences."
CMF_GPU=cuda cortiq run TML-d24-varloop-research-q4tp.cmf --loops 5 --prompt "Prove that there are infinitely many primes."
Use cortiq 0.9.13 or later; prebuilt binaries for Linux, macOS and Windows are on the
releases page. Leave out --features cuda and CMF_GPU=cuda for Vulkan,
Metal or the CPU.
Passes
--loops N sets how many times the 12 middle layers run (CMF_INKLING_PASSES=N does the same); without it the file
runs 3, the count the model was post-trained at. Each pass adds about 1B active parameters a token.
| passes | WikiText-2 ppl | f32 reference | decode, tok/s | first token after 2 048 tokens, s |
|---|---|---|---|---|
| 1 | 9.930 | 9.784 | 98.5 | 0.61 |
| 2 | 9.627 | — | 66.7 | 0.99 |
| 3 | 9.239 | 9.134 | 50.6 | 1.37 |
| 4 | 9.231 | — | 41.4 | 1.80 |
| 5 | 9.218 | 9.118 | 34.7 | 2.21 |
Perplexity over 12 windows of 512 tokens of WikiText-2 test on CUDA; the reference runs the release's layers in f32
(transformers PR #51050 with the pass count set) and was measured at 1, 3 and 5 passes. Speed: NVIDIA L4, CUDA,
cortiq bench --core without speculative decoding. The release notes that 3 passes dominated its training, so other
counts may understate what a model trained for them would do.
Files
| file | quantization | size | WikiText-2 ppl | Rust ppl | Python ppl | WikiText-2, 4 096-token windows |
|---|---|---|---|---|---|---|
TML-d24-varloop-research-q4tp.cmf |
4-bit: routed experts, attention and the other dense matrices; head 8-bit; drafter 8-bit | 15.12 GB | 9.239 | 3.047 | 2.883 | 7.580 |
| reference: Transformers f32 | the release's NVFP4 / MXFP8 experts, decoded | 19.53 GB | 9.134 | 3.030 | 2.857 | 7.499 |
At 3 passes: perplexity over 12 windows of 512 tokens on WikiText-2 test, 1.8 MB of Rust and 477 KB of Python, and over 2 windows of 4 096 tokens of WikiText-2, the same windows for every row, on CUDA. The release ships its routed experts in NVFP4 (layers 0–19) and MXFP8 (20–23); they are decoded and re-encoded as q4tp. The attention, its output gate and relative-position projections are GPTQ-rounded on 3 072 tokens of prose, Rust and Python that the evaluation texts do not hold; the head is 8-bit, the embedding f16, the routers, convolutions, block-mixing queries and message gates f32. The drafter's matrices are 8-bit, its norms and recurrence f32.
The same file on the other backends (3 passes):
| backend | WikiText-2 ppl | WikiText-2, 4 096-token windows |
|---|---|---|
| CUDA (NVIDIA L4) | 9.239 | 7.580 |
| Vulkan (NVIDIA L4) | 9.237 | 7.576 |
| Metal (Apple M4) | 9.241 | 7.579 |
Speculative decoding (DSpark)
The release ships a drafter (mtp.safetensors): three dense layers that read the model's hidden states at three of
its 48 layer applications and its final state, and a recurrent head that writes up to seven tokens ahead. On CUDA,
cortiq runs it after every token when decoding greedily (--greedy, or temperature 0 through the server): the drafts
and the token before them go through the model in one call, the drafts it agrees with are kept, the rest rolled
back. How many drafts a round offers follows what a round costs and how often drafts are kept, measured as it runs;
on text the drafter does not predict it falls back to plain decoding. CMF_INKLING_SPEC=0 turns it off,
CMF_INKLING_SPEC=N pins N drafts.
| text | plain, tok/s | DSpark, tok/s | speed-up | drafts kept |
|---|---|---|---|---|
| Python code | 50.6 | 78.2 | ×1.55 | 65 % |
| JSON | 50.5 | 68.7 | ×1.36 | 57 % |
| a short story | 50.5 | 52.0 | ×1.03 | 42 % |
| advice in prose | 50.9 | 51.2 | ×1.01 | 34 % |
NVIDIA L4, CUDA, 3 passes, greedy, 384 tokens after a one-line prompt with --no-think. The kept tokens are
the model's own greedy picks; a verify call adds its rows in another order than a one-token call, so at a near tie
the text can take another branch than plain decoding.
Performance
One stream, cortiq bench --core, cortiq 0.9.13, 3 passes, without speculative decoding (CMF_INKLING_SPEC=0): the
time to the first token of a prompt of that length and the decode speed after it (64 tokens). Card memory is the
peak nvidia-smi shows during the run. Read each backend's section on its own.
CUDA · NVIDIA L4
Stand: NVIDIA L4 (24 GB), Google Colab, the CUDA backend (CMF_GPU=cuda). Without a prompt: 50.9 tok/s. A
prompt is read 512 rows a call: the dense matrices, the message gates and the attention through cuBLAS, the routed
experts on tensor cores grouped so that each is read once a call.
| prompt, tokens | first token, s | decode, tok/s | peak card memory, GB |
|---|---|---|---|
| 512 | 0.47 | 48.4 | 14.7 |
| 2 048 | 1.38 | 47.6 | 14.8 |
| 8 192 | 5.97 | 45.1 | 15.1 |
| 16 384 | 12.8 | 43.0 | 15.3 |
| 32 768 | 32.0 | 39.1 | 15.9 |
Vulkan · NVIDIA L4
Stand: the same NVIDIA L4 (24 GB), over Vulkan (the default backend). Without a prompt: 35.7 tok/s. A prompt is read 128 rows a call, its 4-bit matrices and routed experts on the cooperative-matrix units.
| prompt, tokens | first token, s | decode, tok/s | peak card memory, GB |
|---|---|---|---|
| 512 | 2.59 | 31.6 | 13.7 |
| 2 048 | 12.9 | 27.9 | 13.7 |
| 8 192 | 60.7 | 23.6 | 14.6 |
| 16 384 | 149.3 | 19.1 | 15.5 |
Metal · MacBook Air M4
Stand: MacBook Air M4 (24 GB), fanless, Metal. Without a prompt: 21.8 tok/s. The file stays memory-mapped; a prompt is read 256 rows a call, the routed experts as simdgroup GEMMs.
| prompt, tokens | first token, s | decode, tok/s |
|---|---|---|
| 512 | 3.17 | 21.0 |
| 2 048 | 15.3 | 19.7 |
| 8 192 | 74.2 | 17.5 |
CPU
| stand | decode, tok/s |
|---|---|
MacBook Air M4 (10 cores, 24 GB), CMF_GPU=0 |
10.8 |
Usage
cortiq run TML-d24-varloop-research-q4tp.cmf # interactive chat
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." # one answer, with its reasoning
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --loops 1 # one pass: the fastest
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --no-think # the least reasoning
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --reasoning-effort low
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt-file task.txt --max-tokens 2048
The embedded template is the model's own: a turn opens with a thinking-effort line (high by default; none,
minimal, low, medium, xhigh or a number from 0 to 0.99 with --reasoning-effort), and the model writes a
thinking part before its answer, shown between <think> and </think>. --no-think asks for effort none; the
model may still reason a little in its answer. The file carries the release's sampling (temperature 1.0); --greedy
gives deterministic output and, on CUDA, the speculative rounds.
OpenAI-compatible server
cortiq serve puts the file behind an OpenAI-compatible HTTP API, with a web dashboard on the same port. The pass
count is the server's: CMF_INKLING_PASSES=N in its environment.
CMF_GPU=cuda cortiq serve TML-d24-varloop-research-q4tp.cmf --port 8080 --host 127.0.0.1
curl http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "tml-d24-varloop-research",
"messages": [{"role": "user", "content": "Plan a three-step migration from MySQL to Postgres."}],
"max_tokens": 1024,
"reasoning_effort": "low"
}'
| endpoint | what it does |
|---|---|
POST /v1/chat/completions |
a chat turn; stream: true sends the answer as it is decoded, tools lets the model call functions |
POST /v1/completions |
the continuation of a prompt |
GET /v1/models |
the served model |
GET / |
the web dashboard |
- The thinking part comes back as
message.reasoning_content;"enable_thinking": falseasks for effortnone,reasoning_effortsets it as in the CLI. - Tools go in
toolsin the OpenAI format; the model's JSON tool calls come back asmessage.tool_calls. - One sequence at a time: the server runs this file with one slot.
--host 127.0.0.1keeps it local; no API key is checked.
Long context
The model holds 1 048 576 positions; cortiq caps a conversation at 32 768 by default (CMF_MAX_SEQ sets it). It has
no rotary positions: attention adds a learned relative bias over the last 1 024 distances, 20 of its 24 layers
attend over a 1 024-token window, and past 8 192 positions the 4 full layers scale their queries with the logarithm
of the position. Each layer application keeps its own keys and values (48 at 3 passes, 72 at 5).
Verify the download
sha256sum -c TML-d24-varloop-research-q4tp.cmf.sha256
cortiq info TML-d24-varloop-research-q4tp.cmf
| file | sha256 |
|---|---|
TML-d24-varloop-research-q4tp.cmf |
8bfbdf2fc3fc25beb699521d465d67c32ae5d190330974296069de64acea624c |
License
Apache-2.0, as the original release (LICENSE); use of the model is also subject to Thinking Machines' acceptable use policy. The weights were converted to CMF and quantized by cortiq. This is a research release; the original model card's notes on intended use, limitations and safety apply to this file as well.
Документация на русском
TML-d24-varloop-research — исследовательская модель
Thinking Machines, вариант Inkling 2 Mini с переменным числом проходов: смесь экспертов на 26,4 млрд параметров, 12
средних слоёв которой выполняются столько раз, сколько вы зададите при запуске (обучена на 1–5 проходах, в основном на
3; активных параметров на токен 3,4 млрд при 1 проходе, 5,4 млрд при 3, 7,4 млрд при 5). Здесь она упакована в один
файл CMF для cortiq — движка на Rust без Python и ML-фреймворков: GPU NVIDIA
через CUDA или Vulkan, AMD и Intel через Vulkan/DX12, Apple silicon через Metal, а также CPU. В файле языковая модель и
драфтер DSpark из релиза; визуального энкодера в нём нет. Измерено:
- 15,12 ГБ, все веса на одной карте 24 ГБ. NVIDIA L4, CUDA, 3 прохода: 50,9 ток/с; промпт из 2 048 токенов читается за 1,38 с, из 32 768 — за 32,0 с.
- Число проходов задаётся при запуске:
--loops 1— 98,5 ток/с,--loops 5— 34,7; перплексия WikiText-2 — 9,930 при одном проходе, 9,239 при трёх и 9,218 при пяти. - Спекулятивная генерация DSpark на CUDA: драфтер из релиза предлагает токены, модель проверяет их одним вызовом; 78,2 ток/с на коде и 68,7 на JSON вместо 50,6.
- Та же карта через Vulkan: 35,7 ток/с; MacBook Air M4 (24 ГБ): 21,8 ток/с через Metal, 10,8 на одном CPU.
Быстрый старт
cargo install cortiq-cli --features cuda
hf download infosave/TML-d24-varloop-research-cmf TML-d24-varloop-research-q4tp.cmf --local-dir .
CMF_GPU=cuda cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "Почему небо голубое? Ответь в трёх предложениях."
CMF_GPU=cuda cortiq run TML-d24-varloop-research-q4tp.cmf --loops 5 --prompt "Докажи, что простых чисел бесконечно много."
Нужен cortiq 0.9.13 или новее; готовые сборки для Linux, macOS и Windows — на
странице релизов. Для Vulkan, Metal или CPU уберите --features cuda и
CMF_GPU=cuda.
Проходы
--loops N задаёт, сколько раз выполняются 12 средних слоёв (то же делает CMF_INKLING_PASSES=N); без него файл
выполняет 3 — столько, на скольких модель дообучалась. Каждый проход добавляет около 1 млрд активных параметров на токен.
| проходов | ppl WikiText-2 | эталон f32 | генерация, ток/с | первый токен после 2 048 токенов, с |
|---|---|---|---|---|
| 1 | 9,930 | 9,784 | 98,5 | 0,61 |
| 2 | 9,627 | — | 66,7 | 0,99 |
| 3 | 9,239 | 9,134 | 50,6 | 1,37 |
| 4 | 9,231 | — | 41,4 | 1,80 |
| 5 | 9,218 | 9,118 | 34,7 | 2,21 |
Перплексия на 12 окнах по 512 токенов WikiText-2 test, CUDA; эталон — слои релиза в f32 (transformers PR #51050 с
заданным числом проходов), измерен при 1, 3 и 5 проходах. Скорость: NVIDIA L4, CUDA, cortiq bench --core без
спекулятивной генерации. Релиз отмечает, что в обучении преобладали 3 прохода, так что при другом числе модель может
уступать модели, обученной именно на нём.
Файлы
| файл | квантование | размер | ppl WikiText-2 | ppl Rust | ppl Python | WikiText-2, окна по 4 096 токенов |
|---|---|---|---|---|---|---|
TML-d24-varloop-research-q4tp.cmf |
4 бита: маршрутизируемые эксперты, внимание и остальные плотные матрицы; голова 8 бит; драфтер 8 бит | 15,12 ГБ | 9,239 | 3,047 | 2,883 | 7,580 |
| эталон: Transformers f32 | эксперты релиза в NVFP4 / MXFP8, раскодированные | 19,53 ГБ | 9,134 | 3,030 | 2,857 | 7,499 |
При 3 проходах: перплексия на 12 окнах по 512 токенов WikiText-2 test, 1,8 МБ кода на Rust и 477 КБ на Python и на 2 окнах по 4 096 токенов WikiText-2, окна одинаковые для всех строк, CUDA. Релиз хранит маршрутизируемых экспертов в NVFP4 (слои 0–19) и MXFP8 (20–23); они раскодированы и заново закодированы в q4tp. Внимание, его выходной гейт и проекции относительных позиций округлены GPTQ на 3 072 токенах прозы, Rust и Python, которых нет в оценочных текстах; голова 8-битная, эмбеддинг f16, роутеры, свёртки, запросы смешивания блоков и гейты сообщений — f32. Матрицы драфтера 8-битные, его нормы и рекуррентная часть — f32.
Тот же файл на других бэкендах (3 прохода):
| бэкенд | ppl WikiText-2 | WikiText-2, окна по 4 096 токенов |
|---|---|---|
| CUDA (NVIDIA L4) | 9,239 | 7,580 |
| Vulkan (NVIDIA L4) | 9,237 | 7,576 |
| Metal (Apple M4) | 9,241 | 7,579 |
Спекулятивная генерация (DSpark)
В релизе есть драфтер (mtp.safetensors): три плотных слоя, которые читают скрытые состояния модели на трёх из 48
применений слоёв и её итоговое состояние, и рекуррентная голова, пишущая до семи токенов вперёд. На CUDA cortiq
запускает его после каждого токена при жадной генерации (--greedy или температура 0 через сервер): черновики и токен
перед ними проходят через модель одним вызовом, согласованные с ней черновики остаются, остальные откатываются.
Сколько черновиков предлагать в раунде, определяется на ходу по стоимости раунда и доле принятых; на тексте, который
драфтер не угадывает, генерация возвращается к обычной. CMF_INKLING_SPEC=0 выключает DSpark, CMF_INKLING_SPEC=N
фиксирует N черновиков.
| текст | без DSpark, ток/с | DSpark, ток/с | ускорение | принято черновиков |
|---|---|---|---|---|
| код на Python | 50,6 | 78,2 | ×1,55 | 65 % |
| JSON | 50,5 | 68,7 | ×1,36 | 57 % |
| рассказ | 50,5 | 52,0 | ×1,03 | 42 % |
| советы прозой | 50,9 | 51,2 | ×1,01 | 34 % |
NVIDIA L4, CUDA, 3 прохода, жадная генерация, 384 токенов после однострочного промпта с --no-think.
Оставленные токены — собственный жадный выбор модели; проверочный вызов складывает строки в другом порядке, чем
однотокенный, поэтому при почти равных логитах текст может пойти по другой ветке, чем при обычной генерации.
Производительность
Один поток, cortiq bench --core, cortiq 0.9.13, 3 прохода, без спекулятивной генерации (CMF_INKLING_SPEC=0): время до
первого токена после промпта такой длины и скорость генерации после него (64 токена). Память карты — пик по
nvidia-smi за прогон. Каждый раздел — свой бэкенд.
CUDA · NVIDIA L4
Стенд: NVIDIA L4 (24 ГБ), Google Colab, бэкенд CUDA (CMF_GPU=cuda). Без промпта: 50,9 ток/с. Промпт читается
по 512 строк за вызов: плотные матрицы, гейты сообщений и внимание — через cuBLAS, маршрутизируемые эксперты — на
тензорных ядрах, сгруппированными так, что каждый читается один раз за вызов.
| промпт, токенов | первый токен, с | генерация, ток/с | пик памяти карты, ГБ |
|---|---|---|---|
| 512 | 0,47 | 48,4 | 14,7 |
| 2 048 | 1,38 | 47,6 | 14,8 |
| 8 192 | 5,97 | 45,1 | 15,1 |
| 16 384 | 12,8 | 43,0 | 15,3 |
| 32 768 | 32,0 | 39,1 | 15,9 |
Vulkan · NVIDIA L4
Стенд: та же NVIDIA L4 (24 ГБ) через Vulkan (бэкенд по умолчанию). Без промпта: 35,7 ток/с. Промпт читается по 128 строк за вызов, 4-битные матрицы и маршрутизируемые эксперты — на кооперативных матрицах.
| промпт, токенов | первый токен, с | генерация, ток/с | пик памяти карты, ГБ |
|---|---|---|---|
| 512 | 2,59 | 31,6 | 13,7 |
| 2 048 | 12,9 | 27,9 | 13,7 |
| 8 192 | 60,7 | 23,6 | 14,6 |
| 16 384 | 149,3 | 19,1 | 15,5 |
Metal · MacBook Air M4
Стенд: MacBook Air M4 (24 ГБ), без вентилятора, Metal. Без промпта: 21,8 ток/с. Файл остаётся отображённым в память; промпт читается по 256 строк за вызов, маршрутизируемые эксперты — GEMM на simdgroup-матрицах.
| промпт, токенов | первый токен, с | генерация, ток/с |
|---|---|---|
| 512 | 3,17 | 21,0 |
| 2 048 | 15,3 | 19,7 |
| 8 192 | 74,2 | 17,5 |
CPU
| стенд | генерация, ток/с |
|---|---|
MacBook Air M4 (10 ядер, 24 ГБ), CMF_GPU=0 |
10,8 |
Использование
cortiq run TML-d24-varloop-research-q4tp.cmf # интерактивный чат
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." # один ответ с рассуждением
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --loops 1 # один проход: быстрее всего
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --no-think # минимум рассуждения
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --reasoning-effort low
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt-file task.txt --max-tokens 2048
Встроенный шаблон — собственный шаблон модели: ход начинается со строки об усилии рассуждения (по умолчанию high;
none, minimal, low, medium, xhigh или число от 0 до 0,99 через --reasoning-effort), и модель пишет часть
рассуждения перед ответом — она выводится между <think> и </think>. --no-think просит усилие none; модель всё
равно может немного рассуждать в ответе. Файл несёт сэмплирование релиза (температура 1,0); --greedy даёт
детерминированный вывод и, на CUDA, спекулятивные раунды.
OpenAI-совместимый сервер
cortiq serve отдаёт файл через HTTP API, совместимый с OpenAI, с веб-панелью на том же порту. Число проходов задаётся
серверу: CMF_INKLING_PASSES=N в его окружении.
CMF_GPU=cuda cortiq serve TML-d24-varloop-research-q4tp.cmf --port 8080 --host 127.0.0.1
curl http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "tml-d24-varloop-research",
"messages": [{"role": "user", "content": "Составь план миграции с MySQL на Postgres в три шага."}],
"max_tokens": 1024,
"reasoning_effort": "low"
}'
| эндпоинт | что делает |
|---|---|
POST /v1/chat/completions |
ход чата; stream: true присылает ответ по мере генерации, tools позволяет модели вызывать функции |
POST /v1/completions |
продолжение prompt |
GET /v1/models |
обслуживаемая модель |
GET / |
веб-панель |
- Часть рассуждения приходит в
message.reasoning_content;"enable_thinking": falseпросит усилиеnone,reasoning_effortзадаёт его, как в CLI. - Инструменты передаются в
toolsв формате OpenAI; JSON-вызовы модели возвращаются вmessage.tool_calls. - Одна последовательность за раз: сервер запускает этот файл с одним слотом.
--host 127.0.0.1оставляет сервер локальным; ключ API не проверяется.
Длинный контекст
Модель держит 1 048 576 позиций; cortiq по умолчанию ограничивает разговор 32 768 токенами (задаётся CMF_MAX_SEQ).
Ротационных позиций у неё нет: внимание добавляет обученный относительный сдвиг по последним 1 024 расстояниям, 20 из
24 слоёв смотрят в окно 1 024 токена, а 4 полных слоя после 8 192 позиций масштабируют запросы логарифмом позиции.
Каждое применение слоя хранит свои ключи и значения (48 при 3 проходах, 72 при 5).
Проверка загрузки
sha256sum -c TML-d24-varloop-research-q4tp.cmf.sha256
cortiq info TML-d24-varloop-research-q4tp.cmf
| файл | sha256 |
|---|---|
TML-d24-varloop-research-q4tp.cmf |
8bfbdf2fc3fc25beb699521d465d67c32ae5d190330974296069de64acea624c |
Лицензия
Apache-2.0, как у исходного релиза (LICENSE); использование модели также подчиняется политике допустимого использования Thinking Machines. Веса сконвертированы в CMF и квантованы cortiq. Это исследовательский релиз; замечания исходной карточки о назначении, ограничениях и безопасности относятся и к этому файлу.
中文文档
TML-d24-varloop-research 是 Thinking Machines 发布的
Inkling 2 Mini 可变循环研究版:264 亿参数的混合专家模型,中间 12 层的运行遍数可在推理时自行设定(在 1 到 5 遍上训练,
以 3 遍为主;每个 token 的激活参数 1 遍为 34 亿、3 遍为 54 亿、5 遍为 74 亿)。这里打包为单个
CMF 文件,由 cortiq 运行——一个不依赖 Python 和机器学习框架的 Rust 推理引擎:
NVIDIA 显卡走 CUDA 或 Vulkan,AMD、Intel 显卡走 Vulkan/DX12,Apple silicon 走 Metal,也可在 CPU 上运行。文件包含语言
模型和发布版的 DSpark 草稿模型;视觉编码器不在其中。实测:
- 15.12 GB,全部权重放在一块 24 GB 显卡上。 NVIDIA L4,CUDA,3 遍:50.9 tok/s;2 048 token 的提示词读取 1.38 秒,32 768 token 读取 32.0 秒。
- 遍数在运行时设定:
--loops 1生成 98.5 tok/s,--loops 5为 34.7;WikiText-2 困惑度从 1 遍的 9.930 降到 3 遍的 9.239 和 5 遍的 9.218。 - CUDA 上的 DSpark 推测解码: 发布版自带的草稿模型提出 token,模型在一次调用中校验;代码 78.2 tok/s,JSON 68.7 tok/s,不用时为 50.6。
- 同一块显卡,Vulkan: 35.7 tok/s;MacBook Air M4(24 GB): Metal 21.8 tok/s,仅 CPU 10.8。
快速开始
cargo install cortiq-cli --features cuda
hf download infosave/TML-d24-varloop-research-cmf TML-d24-varloop-research-q4tp.cmf --local-dir .
CMF_GPU=cuda cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "天空为什么是蓝色的?用三句话回答。"
CMF_GPU=cuda cortiq run TML-d24-varloop-research-q4tp.cmf --loops 5 --prompt "证明素数有无穷多个。"
需要 cortiq 0.9.13 或更高版本;Linux、macOS 和 Windows 的预编译程序见发布页面。
使用 Vulkan、Metal 或 CPU 时去掉 --features cuda 和 CMF_GPU=cuda。
遍数
--loops N 设定中间 12 层运行的次数(CMF_INKLING_PASSES=N 效果相同);不设时文件运行 3 遍,即模型后训练所用的遍数。
每多一遍,每个 token 约增加 10 亿激活参数。
| 遍数 | WikiText-2 困惑度 | f32 参考 | 生成,tok/s | 2 048 token 后首 token,秒 |
|---|---|---|---|---|
| 1 | 9.930 | 9.784 | 98.5 | 0.61 |
| 2 | 9.627 | — | 66.7 | 0.99 |
| 3 | 9.239 | 9.134 | 50.6 | 1.37 |
| 4 | 9.231 | — | 41.4 | 1.80 |
| 5 | 9.218 | 9.118 | 34.7 | 2.21 |
困惑度在 WikiText-2 test 的 12 个 512 token 窗口上计算,CUDA;参考在 f32 下运行发布版的各层(transformers PR #51050,
设定遍数),测于 1、3、5 遍。速度:NVIDIA L4,CUDA,cortiq bench --core,不用推测解码。发布版指出训练以 3 遍为主,
因此其他遍数的表现可能低于专门以该遍数训练的模型。
文件
| 文件 | 量化 | 大小 | WikiText-2 困惑度 | Rust 困惑度 | Python 困惑度 | WikiText-2,4 096 token 窗口 |
|---|---|---|---|---|---|---|
TML-d24-varloop-research-q4tp.cmf |
4 位:路由专家、注意力及其他稠密矩阵;输出头 8 位;草稿模型 8 位 | 15.12 GB | 9.239 | 3.047 | 2.883 | 7.580 |
| 参考:Transformers f32 | 发布版的 NVFP4 / MXFP8 专家,解码后 | 19.53 GB | 9.134 | 3.030 | 2.857 | 7.499 |
3 遍下:困惑度在 WikiText-2 test 的 12 个 512 token 窗口、1.8 MB Rust 和 477 KB Python 代码上计算,另有 WikiText-2 的 2 个 4 096 token 窗口,各行使用相同窗口,CUDA。发布版的路由专家以 NVFP4(第 0–19 层)和 MXFP8(第 20–23 层)存储,这里 解码后重新编码为 q4tp。注意力、其输出门和相对位置投影用 GPTQ 在 3 072 个 token 的散文、Rust 和 Python 上取整(评测文本 中不含这些内容);输出头为 8 位,词嵌入为 f16,路由器、卷积、块混合查询和消息门为 f32。草稿模型的矩阵为 8 位,其归一化 与循环部分为 f32。
同一文件在其他后端上(3 遍):
| 后端 | WikiText-2 困惑度 | WikiText-2,4 096 token 窗口 |
|---|---|---|
| CUDA(NVIDIA L4) | 9.239 | 7.580 |
| Vulkan(NVIDIA L4) | 9.237 | 7.576 |
| Metal(Apple M4) | 9.241 | 7.579 |
推测解码(DSpark)
发布版附带一个草稿模型(mtp.safetensors):三个稠密层读取模型在 48 次层应用中三处的隐藏状态及其最终状态,再由一个
循环头向前写出最多七个 token。在 CUDA 上,贪心生成时(--greedy,或经服务器以温度 0 请求)cortiq 在每个 token 之后运行
它:草稿连同其前的 token 在一次调用中通过模型,模型认可的草稿保留,其余回滚。每轮提出多少草稿,按运行中测得的每轮代价
和保留比例决定;草稿模型猜不中的文本会回到普通生成。CMF_INKLING_SPEC=0 关闭,CMF_INKLING_SPEC=N 固定为 N 个草稿。
| 文本 | 普通,tok/s | DSpark,tok/s | 加速 | 草稿保留 |
|---|---|---|---|---|
| Python 代码 | 50.6 | 78.2 | ×1.55 | 65 % |
| JSON | 50.5 | 68.7 | ×1.36 | 57 % |
| 短篇故事 | 50.5 | 52.0 | ×1.03 | 42 % |
| 散文式建议 | 50.9 | 51.2 | ×1.01 | 34 % |
NVIDIA L4,CUDA,3 遍,贪心,单行提示词加 --no-think 之后生成 384 个 token。保留的 token 都是模型自身的贪心
选择;校验调用对各行的累加顺序与单 token 调用不同,因此在 logits 几乎相等处,文本可能与普通生成走向不同的分支。
性能
单路,cortiq bench --core,cortiq 0.9.13,3 遍,不用推测解码(CMF_INKLING_SPEC=0):给定长度提示词后的首 token 时间
及其后的生成速度(64 个 token)。显存为运行期间 nvidia-smi 显示的峰值。各后端的小节请分别阅读。
CUDA · NVIDIA L4
测试平台:NVIDIA L4(24 GB),Google Colab,CUDA 后端(CMF_GPU=cuda)。无提示词时:50.9 tok/s。提示词每次调用
读取 512 行:稠密矩阵、消息门和注意力走 cuBLAS,路由专家在张量核心上按专家分组,每次调用每个专家只读一次。
| 提示词,token | 首 token,秒 | 生成,tok/s | 显存峰值,GB |
|---|---|---|---|
| 512 | 0.47 | 48.4 | 14.7 |
| 2 048 | 1.38 | 47.6 | 14.8 |
| 8 192 | 5.97 | 45.1 | 15.1 |
| 16 384 | 12.8 | 43.0 | 15.3 |
| 32 768 | 32.0 | 39.1 | 15.9 |
Vulkan · NVIDIA L4
测试平台:同一块 NVIDIA L4(24 GB),Vulkan(默认后端)。无提示词时:35.7 tok/s。提示词每次调用读取 128 行, 4 位矩阵和路由专家在协作矩阵单元上计算。
| 提示词,token | 首 token,秒 | 生成,tok/s | 显存峰值,GB |
|---|---|---|---|
| 512 | 2.59 | 31.6 | 13.7 |
| 2 048 | 12.9 | 27.9 | 13.7 |
| 8 192 | 60.7 | 23.6 | 14.6 |
| 16 384 | 149.3 | 19.1 | 15.5 |
Metal · MacBook Air M4
测试平台:MacBook Air M4(24 GB),无风扇,Metal。无提示词时:21.8 tok/s。文件保持内存映射;提示词每次调用读取 256 行,路由专家以 simdgroup 矩阵 GEMM 计算。
| 提示词,token | 首 token,秒 | 生成,tok/s |
|---|---|---|
| 512 | 3.17 | 21.0 |
| 2 048 | 15.3 | 19.7 |
| 8 192 | 74.2 | 17.5 |
CPU
| 测试平台 | 生成,tok/s |
|---|---|
MacBook Air M4(10 核,24 GB),CMF_GPU=0 |
10.8 |
使用
cortiq run TML-d24-varloop-research-q4tp.cmf # 交互式对话
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." # 单次回答,含推理
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --loops 1 # 1 遍:最快
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --no-think # 最少推理
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt "..." --reasoning-effort low
cortiq run TML-d24-varloop-research-q4tp.cmf --prompt-file task.txt --max-tokens 2048
内置模板是模型自己的:每轮以一行推理强度开头(默认 high;可用 --reasoning-effort 设为 none、minimal、low、
medium、xhigh 或 0 到 0.99 的数字),模型在回答前先写推理部分,显示在 <think> 与 </think> 之间。--no-think
请求强度 none;模型在回答中仍可能有少量推理。文件带有发布版的采样设置(温度 1.0);--greedy 给出确定性输出,并在
CUDA 上启用推测轮次。
OpenAI 兼容服务器
cortiq serve 以 OpenAI 兼容的 HTTP API 提供该文件,同一端口上还有网页面板。遍数由服务器决定:在其环境中设置
CMF_INKLING_PASSES=N。
CMF_GPU=cuda cortiq serve TML-d24-varloop-research-q4tp.cmf --port 8080 --host 127.0.0.1
curl http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"model": "tml-d24-varloop-research",
"messages": [{"role": "user", "content": "制定一个从 MySQL 迁移到 Postgres 的三步计划。"}],
"max_tokens": 1024,
"reasoning_effort": "low"
}'
| 端点 | 作用 |
|---|---|
POST /v1/chat/completions |
一轮对话;stream: true 边生成边返回,tools 让模型调用函数 |
POST /v1/completions |
续写 prompt |
GET /v1/models |
所服务的模型 |
GET / |
网页面板 |
- 推理部分在
message.reasoning_content中返回;"enable_thinking": false请求强度none,reasoning_effort的设置与 CLI 相同。 - 工具以 OpenAI 格式放在
tools中;模型的 JSON 工具调用以message.tool_calls返回。 - 一次一个序列:服务器以单槽运行该文件。
--host 127.0.0.1使服务器只在本机可访问;不校验 API key。
长上下文
模型支持 1 048 576 个位置;cortiq 默认将一次对话限制为 32 768 个 token(用 CMF_MAX_SEQ 设置)。模型没有旋转位置编码:
注意力在最近 1 024 个距离上加入学习得到的相对偏置,24 层中有 20 层在 1 024 token 的窗口内注意,4 个全注意力层在 8 192 个
位置之后按位置的对数缩放查询。每次层应用各自保留键和值(3 遍为 48 次,5 遍为 72 次)。
校验下载
sha256sum -c TML-d24-varloop-research-q4tp.cmf.sha256
cortiq info TML-d24-varloop-research-q4tp.cmf
| 文件 | sha256 |
|---|---|
TML-d24-varloop-research-q4tp.cmf |
8bfbdf2fc3fc25beb699521d465d67c32ae5d190330974296069de64acea624c |
许可证
Apache-2.0,与原始发布版相同(LICENSE);模型的使用还须遵守 Thinking Machines 的 可接受使用政策。权重由 cortiq 转换为 CMF 并量化。这是一个 研究发布版;原始模型卡中关于预期用途、局限性和安全性的说明同样适用于本文件。
- Downloads last month
- -
Model tree for infosave/TML-d24-varloop-research-cmf
Base model
thinkingmachines/TML-d24-varloop-research










