diff --git a/docs/model-preparation.md b/docs/model-preparation.md index 33357406a..ce2f2e89d 100644 --- a/docs/model-preparation.md +++ b/docs/model-preparation.md @@ -1654,11 +1654,16 @@ comparison of BF16 cross-host reductions against single-host FP32 output. The `inkling-2-mini` alias selects [`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini/tree/ed40e7da625f594fc9c4990f5f66be24873c22d7) at revision `ed40e7da625f594fc9c4990f5f66be24873c22d7`. -The public checkpoint declares `Inkling2LoopForConditionalGeneration` and +The `tml-d24-varloop-research` alias selects +[`thinkingmachines/TML-d24-varloop-research`](https://huggingface.co/thinkingmachines/TML-d24-varloop-research/tree/657b53ba5da7baefe9ff15dca5cd25f5bd3dbaa2) +at revision `657b53ba5da7baefe9ff15dca5cd25f5bd3dbaa2`, which shares the same +looped geometry, quantization map, vision tower, and DSpark drafter while +recording `loop_config.is_varloop: true` and serving as `TML-d24-varloop-research`. +Both public checkpoints declare `Inkling2LoopForConditionalGeneration` and `model_type: inkling2_loop`. Mini reads its per-layer NVFP4/MXFP8 formats from `hf_quant_config.json`. -The recipe targets one SM120 or SM121 GPU (qualified on GB10 SM121; SM120 is -untested) and prepares text, vision, and the bundled DSpark drafter. +The recipe targets one SM120 or SM121 GPU (qualified on GB10 SM121 and +RTX PRO 6000 Blackwell SM120) and prepares text, vision, and the bundled DSpark drafter. `--language-model-only` omits vision; `--no-mtp` omits drafting. Mini stores 24 target layers. Layers 6 through 17 execute three times, for 48 @@ -1706,10 +1711,15 @@ admission. Mini's sampling defaults are temperature 1, top-p 1, no top-k filter, and neutral penalties. TMLv0 prompt encoding defaults to reasoning effort 0.9. -On one GB10 SM121 GPU (SM120 is untested), an exported native core at Mini's -declared defaults (concurrency 8, 8192-token prefill chunks, 64 speculative -target rows) passes all six service tests in `tests/server/test_inkling2_mini.py` -with drafting disabled and with seven fixed drafts. +On one GB10 SM121 GPU and on one RTX PRO 6000 Blackwell SM120 GPU, exported +native cores at Mini's declared defaults (concurrency 8, 8192-token prefill +chunks, 64 speculative target rows) pass all six service tests in +`tests/server/test_inkling2_mini.py` with drafting disabled and with seven fixed +drafts. On SM120, both `inkling-2-mini` and `tml-d24-varloop-research` pass the +six-test fixed-draft and plain-decode suites, the five-test adaptive-draft suite +with positive draft acceptance, and the checkpoint CUDA suites +(`test_inkling2_kernels_cuda.py`, `test_inkling2_mini.py`, and +`test_inkling2_dspark_cuda.py`). The tests cover text, streamed reasoning, tools, request isolation, prefix restore and branching above 8192 tokens, four ordered images across a prefill boundary, image-prefix reuse, and four concurrent image requests. Fixed-depth drafting diff --git a/ignition/recipes/inkling2/config.py b/ignition/recipes/inkling2/config.py index e8df898cf..9896b1be7 100644 --- a/ignition/recipes/inkling2/config.py +++ b/ignition/recipes/inkling2/config.py @@ -88,8 +88,8 @@ def from_dict(cls, value, layers, block): _known(value, {"core_start", "core_end", "num_passes", "gate_rank", "is_varloop"}, "loop_config") config = cls(*(_integer(value, key) for key in ("core_start", "core_end", "num_passes", "gate_rank"))) - if value.get("is_varloop", False) is not False: - raise ValueError("Inkling 2 preparation requires a fixed loop pass count") + if type(value.get("is_varloop", False)) is not bool: + raise ValueError("is_varloop must be a boolean") if not 0 < config.core_start < config.core_end <= layers: raise ValueError("loop core must follow a prelude and fit the decoder") if config.core_start % block or config.core_end % block: diff --git a/ignition/recipes/inkling2/recipe.py b/ignition/recipes/inkling2/recipe.py index 151015aad..7dac388a3 100644 --- a/ignition/recipes/inkling2/recipe.py +++ b/ignition/recipes/inkling2/recipe.py @@ -76,6 +76,10 @@ def usage(prepared): draft_head_quantizations=("nvfp4", "mxfp8"), markov_head_quantizations=("nvfp4",), checkpoints=(Checkpoint(alias="inkling-2-mini", repository="thinkingmachines/Inkling-2-Mini", revision="ed40e7da625f594fc9c4990f5f66be24873c22d7", architecture="Inkling2LoopForConditionalGeneration", + stored_bytes=19_525_870_752, device_bytes=20_263_810_112, draft_bytes=737_939_360), + Checkpoint(alias="tml-d24-varloop-research", repository="thinkingmachines/TML-d24-varloop-research", + revision="657b53ba5da7baefe9ff15dca5cd25f5bd3dbaa2", architecture="Inkling2LoopForConditionalGeneration", + served_model_name="TML-d24-varloop-research", stored_bytes=19_525_870_752, device_bytes=20_263_810_112, draft_bytes=737_939_360),), ranks=MappingProxyType({1: RankCosts(107_347_968, 2_621_440, 3 << 30)}), plain_ranks=MappingProxyType({1: RankCosts(98_435_072, 2_097_152, 3 << 30)})) diff --git a/tests/cli/test_inkling2.py b/tests/cli/test_inkling2.py index b7b40c31c..edaa712c4 100644 --- a/tests/cli/test_inkling2.py +++ b/tests/cli/test_inkling2.py @@ -28,6 +28,16 @@ def test_mini_directory_resolves_loop_architecture(tmp_path): model.recipe.speculation.token_capacity) == (8, 8192, 64) +def test_varloop_alias_and_repository_share_mini_recipe(): + mini = resolve("inkling-2-mini") + varloop = resolve("tml-d24-varloop-research") + assert varloop.recipe is MINI_RECIPE + assert resolve(varloop.checkpoint.repository).checkpoint is varloop.checkpoint + assert resolve(f"{varloop.checkpoint.repository}@{varloop.checkpoint.revision}").checkpoint is varloop.checkpoint + assert MINI_RECIPE.served_name(mini.checkpoint) == "inkling-2-mini" + assert MINI_RECIPE.served_name(varloop.checkpoint) == "TML-d24-varloop-research" + + def test_small_directory_retains_its_recipe(tmp_path): (tmp_path / "config.json").write_text(json.dumps({ "architectures": ["Inkling2ForConditionalGeneration"], "model_type": "inkling2"})) diff --git a/tests/cli/test_models.py b/tests/cli/test_models.py index 3385d2506..1263d6f4e 100644 --- a/tests/cli/test_models.py +++ b/tests/cli/test_models.py @@ -21,7 +21,7 @@ def test_declarations_import_without_model_dependencies(): result = subprocess.run( [sys.executable, "-c", "import sys; from ignition.recipes import aliases; from ignition import planning;" - " import ignition.cli.preparation; assert aliases() == ('qwen3.8-flash', 'qwen3.8-27b', 'qwen3.8-27b-qad', 'glm-5.3-flash', 'glm-5.3-flash-nvfp4', 'deepseek-v4.1-flash', 'deepseek-v4-flash', 'mimo-v2.6-pro-mopd', 'mimo-v2.6-flash-rl', 'kimi-k3-mxfp4-csf', 'kimi-k3', 'kimi-k3-dspark', 'kimi-k3.1-pro', 'step5-preview-nvfp4', 'nemotron-bolt-24gb', 'minimax-m3-1-flash', 'gemma-4-e2b', 'gemma-4-e4b', 'gemma-4-12b', 'gemma-4-26b-a4b', 'gemma-4-31b', 'gemma-4-e4b-nvfp4', 'gemma-4-12b-nvfp4', 'gemma-4-26b-a4b-nvfp4', 'gemma-4-31b-nvfp4', 'muse-spark-open-nvfp4', 'inkling-2-mini', 'inkling-2-small-nvfp4');" + " import ignition.cli.preparation; assert aliases() == ('qwen3.8-flash', 'qwen3.8-27b', 'qwen3.8-27b-qad', 'glm-5.3-flash', 'glm-5.3-flash-nvfp4', 'deepseek-v4.1-flash', 'deepseek-v4-flash', 'mimo-v2.6-pro-mopd', 'mimo-v2.6-flash-rl', 'kimi-k3-mxfp4-csf', 'kimi-k3', 'kimi-k3-dspark', 'kimi-k3.1-pro', 'step5-preview-nvfp4', 'nemotron-bolt-24gb', 'minimax-m3-1-flash', 'gemma-4-e2b', 'gemma-4-e4b', 'gemma-4-12b', 'gemma-4-26b-a4b', 'gemma-4-31b', 'gemma-4-e4b-nvfp4', 'gemma-4-12b-nvfp4', 'gemma-4-26b-a4b-nvfp4', 'gemma-4-31b-nvfp4', 'muse-spark-open-nvfp4', 'inkling-2-mini', 'tml-d24-varloop-research', 'inkling-2-small-nvfp4');" " assert not {'torch', 'transformers', 'flare_heliopause'} & set(sys.modules)"], cwd=ROOT, check=False, capture_output=True, text=True) assert result.returncode == 0, result.stderr diff --git a/tests/recipes/test_inkling2_mini.py b/tests/recipes/test_inkling2_mini.py index 803324755..f1c966f37 100644 --- a/tests/recipes/test_inkling2_mini.py +++ b/tests/recipes/test_inkling2_mini.py @@ -84,7 +84,22 @@ def test_public_precision_summary_loads_layer_map(mini_config_dir, tmp_path): assert ModelConfig.load(target).quantization == json.loads(precision) -@pytest.mark.parametrize("field,value", [("num_passes", 0), ("core_start", 7), ("core_end", 30), ("is_varloop", True)]) +def test_varloop_release_configuration(mini_config_dir): + raw = json.loads((mini_config_dir / "config.json").read_text()) + precision = json.loads((mini_config_dir / "hf_quant_config.json").read_text()) + raw.pop("dtype", None) + raw.update(architectures=["Inkling2LoopForConditionalGeneration"], quantization_config=precision) + raw["text_config"]["model_type"] = "inkling2_loop_text" + raw["text_config"]["loop_config"]["is_varloop"] = True + raw["vision_config"].update(model_type="inkling2_vision", text_hidden_size=2304) + for flag in ("pre_norm_pre_affine", "final_norm_pre_affine"): + raw["text_config"].pop(flag, None) + model = ModelConfig.from_dict(raw) + assert model.text.hidden == 2304 and len(model.text.visits) == 48 + assert model.quantization == precision + + +@pytest.mark.parametrize("field,value", [("num_passes", 0), ("core_start", 7), ("core_end", 30), ("is_varloop", "true")]) def test_invalid_loop_geometry(mini_config_dir, field, value): raw = json.loads((mini_config_dir / "config.json").read_text()) raw["quantization_config"] = json.loads((mini_config_dir / "hf_quant_config.json").read_text()) diff --git a/tests/server/test_inkling2_mini.py b/tests/server/test_inkling2_mini.py index 6ad838bd2..09d5bf0eb 100644 --- a/tests/server/test_inkling2_mini.py +++ b/tests/server/test_inkling2_mini.py @@ -24,7 +24,7 @@ def service(): url = url.rstrip("/") with urllib.request.urlopen(url + "/v1/models", timeout=10) as response: model = json.load(response)["data"][0] - assert model["id"] == "inkling-2-mini" + assert model["id"] in ("inkling-2-mini", "TML-d24-varloop-research") assert "text" in model["flare"]["input_modalities"] def ask(prompt, **options): @@ -39,7 +39,7 @@ def ask(prompt, **options): assert result["usage"]["completion_tokens"] == len(result["choices"][0]["token_ids"]) return result - return ask, model["flare"] + return ask, model["flare"], model["id"] def answer(result): @@ -47,7 +47,7 @@ def answer(result): def test_text_reasoning_and_request_isolation(service): - ask, settings = service + ask, settings, _ = service result = ask("What is 17 times 23? Put only the integer in the final answer.") assert answer(result) == "391" assert result["choices"][0]["message"]["reasoning_content"].strip() @@ -59,8 +59,9 @@ def test_text_reasoning_and_request_isolation(service): def test_streamed_reasoning_and_answer(service): + _, _, model_id = service url = os.environ["FLARE_INKLING2_MINI_TEST_URL"].rstrip("/") - body = dict(model="inkling-2-mini", messages=[dict(role="user", + body = dict(model=model_id, messages=[dict(role="user", content="What is 17 times 23? Put only the integer in the final answer.")], max_tokens=768, seed=1234, stream=True, stream_options=dict(include_usage=True)) request = urllib.request.Request(url + "/v1/chat/completions", json.dumps(body).encode(), @@ -84,7 +85,7 @@ def test_streamed_reasoning_and_answer(service): def test_chunked_prefix_restore_and_branching(service): - ask, settings = service + ask, settings, model_id = service # Cross the 1024-token local-attention ring and the largest prefill graph. count = max(200, settings["prefill_chunk_size"] // 8) prefix = " ".join(f"Item {i} records code {i * 17 % 997}." for i in range(count)) @@ -103,7 +104,7 @@ def test_chunked_prefix_restore_and_branching(service): # Timing probes can change decode capacity within a request. Exact # state transfer is checked separately, without cross-capacity arithmetic. prefix_ids = first["prompt_token_ids"] + first["choices"][0]["token_ids"][:64] - body = dict(model="inkling-2-mini", prompt=prefix_ids, max_tokens=1, seed=1234, + body = dict(model=model_id, prompt=prefix_ids, max_tokens=1, seed=1234, logprobs=20, return_tokens_as_token_ids=True, ignore_eos=True) completions = [] url = os.environ["FLARE_INKLING2_MINI_TEST_URL"].rstrip("/") @@ -118,11 +119,12 @@ def test_chunked_prefix_restore_and_branching(service): def test_tml_tool_call(service): + _, _, model_id = service tools = [dict(type="function", function=dict(name="lookup_weather", description="Get a city's weather.", parameters=dict(type="object", properties=dict(city=dict(type="string")), required=["city"])))] # Tool calls terminate with tool_calls, so inspect this response separately. url = os.environ["FLARE_INKLING2_MINI_TEST_URL"].rstrip("/") - body = dict(model="inkling-2-mini", messages=[dict(role="user", content="Use lookup_weather for Paris.")], + body = dict(model=model_id, messages=[dict(role="user", content="Use lookup_weather for Paris.")], tools=tools, tool_choice="required", max_tokens=768, seed=1234) request = urllib.request.Request(url + "/v1/chat/completions", json.dumps(body).encode(), {"Content-Type": "application/json"}) @@ -138,7 +140,7 @@ def test_tml_tool_call(service): def test_images_and_cached_image_prefixes(service): from .test_minimax_m3 import image - ask, settings = service + ask, settings, _ = service if "image" not in settings["input_modalities"]: pytest.skip("requires a vision-enabled Mini core") labels = ("FIRST 128", "SECOND 256", "THIRD 512", "FOURTH 1024") @@ -148,9 +150,11 @@ def test_images_and_cached_image_prefixes(service): *pictures, dict(type="text", text="Read all four image labels in order. Only output the labels.")] # A complete system message supplies an anchor independently of timing costs. # Prime snapshot and prefill estimates before testing optional prompt-end retention. + calibration_notes = " ".join( + f"Entry {i} calibration note." for i in range(settings["prefill_chunk_size"] // 4 + 100) + ) calibration = ask("", messages=[ - dict(role="system", content="Read these notes before answering. " - + "calibration " * (settings["prefill_chunk_size"] + 100)), + dict(role="system", content="Read these notes before answering. " + calibration_notes), dict(role="user", content="Repeat exactly the code CALIBRATED.")]) assert answer(calibration) == "CALIBRATED" assert calibration["usage"]["prompt_tokens"] > settings["prefill_chunk_size"]