Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/research/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ Findings from building and running this pipeline, each kept with its evidence. C
| 39 | 2026-10-04 | MediaTek | At 16k, LFM2.5 built once no chunk held more than one attention layer; a 4-chunk build with two in some chunks did not. LFM2.5-1.2B-Instruct (attention at layers 2, 5, 8, 10, 12, 14 of 16) at 16k in 4 chunks lost MediaTek's local compiler service while compiling chunk 2, after calibration had finished; its heretic finetune, the same architecture, in 8 chunks (two layers, at most one attention layer each) built and was published: 3,235 s, peak 14,361,923,584 B in use on a 16 vCPU runner. LFM2.5-2.6B (attention at 2, 5, 9, 13, 17, 21, 24, 27 of 30) needs 10 chunks for one attention layer each, and its heretic finetune built at 16k that way: 5,891 s, peak 26,554,892,288 B. Two successes and one failure, so one attention layer per chunk is a working heuristic for these architectures; that it is necessary, and why the compiler service died, are not shown. 32k was started for all three LFM2.5 models (8 and 10 chunks) and cancelled mid-calibration for budget. | measured + inference | run 35994412279 (4 chunks, failed at chunk 2), run 37171790063 (8 chunks, published), run 37176914465 (2.6B-heretic, 10 chunks, 16k published, 32k cancelled); `mtk/mt6991/export-report-16k.json` in `experimentalmachines/LFM2.5-1.2B-Instruct-heretic-ExecuTorch` and `…/LFM2.5-2.6B-heretic-ExecuTorch` | Dispatch 16k with `max_chunks` at the smallest count that leaves one attention layer per chunk (8 for the 1.2B, 10 for the 2.6B); `mtk.max_chunks` stays 4 for the windows that build at it. The successful builds peaked at 13.4 and 24.7 GiB; what killed the failed run's compiler service is not known. LFM2.5-2.6B (base) at 16k and every 32k remain unbuilt. |
| 40 | 2026-10-07 | Runner | The Namespace profile `namespace-profile-execupack` has 4 x86_64 CPUs, MemTotal 16,438,740 kB (15.7 GiB), a 101 GB overlay disk shared by / and /mnt, and no swap: `swapon` on a swap file is refused ("Operation not permitted"), so the 24 to 96 GiB the Blacksmith jobs added cannot be had. Against `sizing.host_need_bytes` and `export_mtk.calibration_bytes` that leaves: Vulkan up to 8k for the 0.1B to 1.2B models (Qwen3-0.6B, Qwen2.5-0.5B, SmolLM2, Llama-3.2-1B) and up to 16k for LFM2.5-1.2B, 2k-4k for Qwen2.5-1.5B, Qwen3-1.7B and LFM2.5-2.6B, nothing at 3B and above; XNNPACK up to 8k for the sub-1B models, 2k-4k for Llama-3.2-1B and LFM2.5-1.2B, nothing from 1.5B up; MediaTek Qwen3-0.6B at 512 only, Llama-3.2-1B to 2k, SmolLM2-135M to 4k, and no LFM2.5 at any window by the current estimate (about 17.4 GiB for the 1.2B). Of the windows built before, every 32k window and every 16k except LFM2.5-1.2B's on Vulkan now fall outside it, as do the MediaTek 16k builds of finding 39. That last is the estimate's call, not a measured limit: `calibration_bytes` puts the 1.2B at about 17.4 GiB from the 14.4 to 15.7 bytes per parameter measured on 4-chunk builds, while the 8-chunk 16k build peaked at 13.4 GiB, which this RAM would hold; refitting the estimate for more chunks could bring the 1.2B back. | measured + estimate | CI run 37606922033 (the runner step); `tests/test_namespace_runner.py` pins the tier and the windows; the coverage is the sizing model's, not exports run on the profile | `config/pipeline.yaml` has the one tier with swap_gib 0; `prepare-host.sh` carries on without swap where it is refused; a model no window fits stops at the targets job instead of failing an empty matrix. The wider windows need a larger Namespace profile added as a second tier. QNN has no tier: its export peaked at 15.6 GB of RSS for Qwen3-0.6B (finding 8), at the edge of this profile. |
| 41 | 2026-10-07 | Runner | Modal runs the XNNPACK and Vulkan exports and the solve. A Sandbox may ask for at most 344064 MiB (336 GiB) and 64 physical cores: larger requests are refused at creation with InvalidError ("memory request must be <= 344064 MiB", "CPU request must be <= 64000 mCPU"), so every window ever built fits, Qwen3-4B at 32k (about 134 GiB) included. Inside a Sandbox /proc/meminfo shows the host's memory (680 GiB to 1.3 TiB), not the request, so the export's own memory gate passes there and the request computed from `sizing.host_need_bytes` is what sizes the run; nproc does reflect the request. SmolLM2-135M at 2k: the Vulkan file came out byte-identical to the published one (sha256 0de5a249...), peaking at 1.9 GiB of a 6.1 GiB request; the XNNPACK file exported and passed the smoke test ("The capital of France is Paris") in the same Sandbox. Both were slower than on Blacksmith: 361 s against 145 s for Vulkan and 1,308 s against 348 s for XNNPACK, though the published files were built with ExecuTorch 1.4.0 and these with 1.5.1, so the runner is not the only difference. | measured | `pipeline/remote.py` runs from this workstation, 2026-10-07 (the sandbox limits probed by request; the two exports with their export reports); the published reports in `experimentalmachines/SmolLM2-135M-Instruct-ExecuTorch` | xnnpack and vulkan runner_tiers are one `modal` tier at Modal's ceiling, each window's memory_mib is its need times modal.memory_margin, and the XNNPACK export, smoke test and decision gate share one Sandbox, so the separate verify job is gone. Per-export time is the open cost question: modal.cpu is 8 cores, and whether more cores or a 1.5.1-to-1.4.0 difference explains the gap is not measured. |
| 42 | 2026-10-31 | XNNPACK | LiquidAI's LFM3-1.7B (`Lfm3ForCausalLM`, remote code only: transformers has no LFM3 and ExecuTorch 1.5.1 none either, the newest release on 2026-10-31) cannot be described by ExecuTorch 1.5.1's transformer: of 24 layers 13 are width-7 gated short convolutions (`ShortConvBlock` hard-codes 3), 6 attend globally with a zero-tail partial RoPE (the first quarter of each head rotated at theta 1e6, frequencies over the full head dimension) and 5 attend over a 256-token window with full RoPE at theta 1e4 (one RoPE table per model upstream; `sliding_window` and `local_rope_theta` are declared in `ModelArgs` and never read), every attention output is gated per head by `sigmoid(gate_proj(x))` (hidden to 16; upstream's `use_attn_o_gate` is per element), and each operator and feed-forward is followed by its own RMSNorm (`post_attention_norm` is declared and never read). `pipeline/lfm3_model.py` builds it from ExecuTorch's parts and is applied in every process that builds the model, as the LFM2 state fix is. The windowed layers keep a ring of window + prefill chunk slots on `update_cache_with_indices` and a masked `custom_sdpa` (upstream's `RingKVCache` holds 2 x window and asserts a chunk fits, which a 2,048-token prefill does not), so no layer holds a full-window cache it cannot use and no window-squared mask exists. On the real checkpoint (ac2586a3) against the checkpoint's own `modeling_lfm3.py`, fp32: without a cache, identical logits over a 559-token app prompt and a 17-token one (max difference 0, top-1 100%); with the cache and export_llm's custom-op transforms, 96-token prefill chunks (the ring wraps), 40 decode steps and a second prompt at position zero, max logit difference 1.8e-4, top-1 100%, KL under 4e-7. The remote config does not load under transformers 5.17.0 (`standardize_rope_params` looks up a RoPE block for every layer type, `conv` included: KeyError); 5.22.1 loads it. | measured + source | `lfm3_check.py` harness (HF fp32 vs the module, no cache and cached); `examples/models/llama/{llama_transformer,model_args,attention}.py` and `examples/models/lfm2/short_conv.py` at v1.5.1 | XNNPACK only (Vulkan has no short-convolution kernel; neither vendor path has a definition). The app has no LFM3 chat template, so the family is exported ahead of it (`naming.AHEAD_OF_APP`) and the model card says so; `-Base` stays unpublished under the chat-only rule, LFM3-VL and the audio models are multimodal. The first published reports counted the 5 windowed layers at a full-window KV cache (1,476,395,008 B at 32k); since eba9368 `sizing` counts them as their fixed ring (852,492,288 B at 32k, 47,185,920 B of it the rings), and `correct-reports` rewrote the five published reports, `config.json` and README in Hub commit fd07e07 without touching a `.pte`. The decision gate first failed all three GPTQ windows on quiet rows: it reads one token, and LFM3's template opens a `<think>` block in the generation prompt, so that token is the first word of the reasoning (fp32 'The' at 0.52 to 0.73 against 'We'), which the 4-bit file tipped the other way on two of four rows without calling anything. Qwen3's published gates had the same blind spot (`<think>` at 0.9999 on every row, `measures_tool_calling` false). With `enable_thinking=False` the prompt ends in `<think></think>`, and fp32's first token is `<tool_call>` at 1.000 on all 12 search rows and the answer on the quiet ones (0.98, 0.99, 0.95; 'Who wrote Pride and Prejudice?' undecided at 0.27); the 32k GPTQ file then keeps 12 of 12 calls at 0.9991 against 0.9998 and 3 of 4 quiet rows, `measures_tool_calling` true. `gate.prompts` now renders with the reasoning switched off for every family; templates without the switch are unchanged, and calibration still renders at the template's default. ExecuTorch 1.6.0-rc1 (tagged 2026-10-30, wheel on PyTorch's test channel, torch 2.15.0) has no LFM3 model either, though its `ShortConv` takes a width: under it the same module matches Hugging Face (identical logits without a cache, 2.1e-4 with the custom-op cache and the ring), and a 2k 8da4w export (1,239,187,968 B, 597 s with the base model's solve on the same CPUs) answers the smoke test through 1.6.0's own runner. Nothing was published from it: the apps ship the 1.5.1 runtime, which `EXECUTORCH_VERSION` keeps every export on. LFM3-1.7B-Base (545fc8f4) was published on request (`--allow-base`; the chat-only default stands for the watcher): its fp32 model puts a newline first on all 12 calling rows (0.71 to 0.86) and is undecided on three of four quiet rows, so its gate tracks fp32 without measuring tool calling, and every window kept 12 of 12 (0.9786 against 0.76) and completed the smoke prefix with ' Paris'. Both repos' ten files match their reports' sha256 on the Hub. |
| 42 | 2026-10-31 | XNNPACK | LiquidAI's LFM3-1.7B (`Lfm3ForCausalLM`, remote code only: transformers has no LFM3 and ExecuTorch 1.5.1 none either, the newest release on 2026-10-31) cannot be described by ExecuTorch 1.5.1's transformer: of 24 layers 13 are width-7 gated short convolutions (`ShortConvBlock` hard-codes 3), 6 attend globally with a zero-tail partial RoPE (the first quarter of each head rotated at theta 1e6, frequencies over the full head dimension) and 5 attend over a 256-token window with full RoPE at theta 1e4 (one RoPE table per model upstream; `sliding_window` and `local_rope_theta` are declared in `ModelArgs` and never read), every attention output is gated per head by `sigmoid(gate_proj(x))` (hidden to 16; upstream's `use_attn_o_gate` is per element), and each operator and feed-forward is followed by its own RMSNorm (`post_attention_norm` is declared and never read). `pipeline/lfm3_model.py` builds it from ExecuTorch's parts and is applied in every process that builds the model, as the LFM2 state fix is. The windowed layers keep a ring of window + prefill chunk slots on `update_cache_with_indices` and a masked `custom_sdpa` (upstream's `RingKVCache` holds 2 x window and asserts a chunk fits, which a 2,048-token prefill does not), so no layer holds a full-window cache it cannot use and no window-squared mask exists. On the real checkpoint (ac2586a3) against the checkpoint's own `modeling_lfm3.py`, fp32: without a cache, identical logits over a 559-token app prompt and a 17-token one (max difference 0, top-1 100%); with the cache and export_llm's custom-op transforms, 96-token prefill chunks (the ring wraps), 40 decode steps and a second prompt at position zero, max logit difference 1.8e-4, top-1 100%, KL under 4e-7. The remote config does not load under transformers 5.17.0 (`standardize_rope_params` looks up a RoPE block for every layer type, `conv` included: KeyError); 5.22.1 loads it. | measured + source | `lfm3_check.py` harness (HF fp32 vs the module, no cache and cached); `examples/models/llama/{llama_transformer,model_args,attention}.py` and `examples/models/lfm2/short_conv.py` at v1.5.1 | XNNPACK only (Vulkan has no short-convolution kernel; neither vendor path has a definition). The app has no LFM3 chat template, so the family is exported ahead of it (`naming.AHEAD_OF_APP`) and the model card says so; `-Base` stays unpublished under the chat-only rule, LFM3-VL and the audio models are multimodal. The first published reports counted the 5 windowed layers at a full-window KV cache (1,476,395,008 B at 32k); since eba9368 `sizing` counts them as their fixed ring (852,492,288 B at 32k, 47,185,920 B of it the rings), and `correct-reports` rewrote the five published reports, `config.json` and README in Hub commit fd07e07 without touching a `.pte`. The decision gate first failed all three GPTQ windows on quiet rows: it reads one token, and LFM3's template opens a `<think>` block in the generation prompt, so that token is the first word of the reasoning (fp32 'The' at 0.52 to 0.73 against 'We'), which the 4-bit file tipped the other way on two of four rows without calling anything. Qwen3's published gates had the same blind spot (`<think>` at 0.9999 on every row, `measures_tool_calling` false). With `enable_thinking=False` the prompt ends in `<think></think>`, and fp32's first token is `<tool_call>` at 1.000 on all 12 search rows and the answer on the quiet ones (0.98, 0.99, 0.95; 'Who wrote Pride and Prejudice?' undecided at 0.27); the 32k GPTQ file then keeps 12 of 12 calls at 0.9991 against 0.9998 and 3 of 4 quiet rows, `measures_tool_calling` true. `gate.prompts` now renders with the reasoning switched off for every family; templates without the switch are unchanged, and calibration still renders at the template's default. ExecuTorch 1.6.0-rc1 (tagged 2026-10-30, wheel on PyTorch's test channel, torch 2.15.0) has no LFM3 model either, though its `ShortConv` takes a width: under it the same module matches Hugging Face (identical logits without a cache, 2.1e-4 with the custom-op cache and the ring), and a 2k 8da4w export (1,239,187,968 B, 597 s with the base model's solve on the same CPUs) answers the smoke test through 1.6.0's own runner. Nothing was published from it: the apps ship the 1.5.1 runtime, which `EXECUTORCH_VERSION` keeps every export on. LFM3-1.7B-Base (545fc8f4) was published on request (`--allow-base`; the chat-only default stands for the watcher): its fp32 model puts a newline first on all 12 calling rows (0.71 to 0.86) and is undecided on three of four quiet rows, so its gate tracks fp32 without measuring tool calling, and every window kept 12 of 12 (0.9786 against 0.76) and completed the smoke prefix with ' Paris'. Both repos' ten files match their reports' sha256 on the Hub. On a phone (Snapdragon 8 Elite Gen 5, SM8850, Android 16, through ExecuTorch's `llama_main` for arm64 built from main 98755608): the 2k file reasons and answers 'Paris' at 43 tok/s (1.87 GB resident), emits LFM3's XML `<tool_call>` for the app-shaped search prompt and answers the quiet one without a call; the 2k base file continues 'The capital of France is' with ' Paris.'; the 32k file reads a 5,870-token prompt in 2,047-token chunks (the ring wraps twice) and returns the code from its first line, prefill 307 tok/s, 2.62 GB resident. That last run needs a runner that chunks by the forward bound: the stock runner fails it, as it fails any prompt of 2,048 tokens or more on every `export_llm` file from 1.1.0 to 1.5.1 (the upstream bound bug, not LFM3's). [Evidence](evidence/lfm3-sm8850-llama_main.txt). |
29 changes: 29 additions & 0 deletions docs/research/evidence/lfm3-sm8850-llama_main.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
LFM3 on a Snapdragon 8 Elite Gen 5 (SM8850) QRD, Android 16, Qualcomm Device Cloud, 2026-10-31.
Runner: ExecuTorch llama_main for Android arm64 (NDK 27.3, XNNPACK), built from main 98755608277f;
llama_main_fixed adds the prefill-chunk change (chunks of the forward bound, 2047, instead of get_max_seq_len 2048).
Files: experimentalmachines/LFM3-1.7B-ExecuTorch and -Base-ExecuTorch as published (8da4w GPTQ). Greedy (temperature 0).

== llama_main_fixed, LFM3-1.7B-8da4w-gptq-32k.pte, prompts/needle_nothink.txt (code on line 1, ~5.8k tokens of filler, question at the end)
executorch:llm_runner_helper.cpp:137] Metadata: get_max_context_len = 32768
executorch:llm_runner_helper.cpp:196] Prefill chunk size 2047: forward accepts at most 2047 tokens per call, get_max_seq_len is 2048
executorch:text_llm_runner.cpp:92] RSS after loading model: 2619.511719 MiB (0 if unsupported)
executorch:text_llm_runner.cpp:208] Max new tokens resolved: 30, given pos_ 5870, num_prompt_tokens 5870, max_context_len 32768
481I 00:00:20.473049 executorch:text_llm_runner.cpp:231] RSS after prompt prefill: 2619.511719 MiB (0 if unsupported)
executorch:text_llm_runner.cpp:261] RSS after finishing text generation: 2619.511719 MiB (0 if unsupported)
executorch:stats.h:179] Prompt Tokens: 5870 Generated Tokens: 2
executorch:stats.h:203] Prompt evaluation: 19.149000 (seconds) Rate: 306.543423 (tokens/second)
executorch:stats.h:215] Generated 2 tokens: 0.077000 (seconds) Rate: 25.974026 (tokens/second)
output: '4817<|im_end|>'

== llama_main (stock), same 32k file and prompt
E executorch:tensor_impl.cpp:161] Attempted to resize a bounded tensor with a maximum capacity of 2047 elements to 2048 elements.
(the upstream prefill-chunk bound bug, every export_llm release 1.1.0-1.5.1; not LFM3's)

== llama_main (stock), LFM3-1.7B-8da4w-gptq-2k.pte
chat prompt, thinking on, 22 tokens -> "...</think>Paris<|im_end|>"; prefill 255.8 tok/s, decode 43.1 tok/s, RSS 1869.5 MiB
app prompt with tools, "What is Concord the capital of?" + trailer, thinking off, 560 tokens ->
"<tool_call>\n<function=web_search>\n<parameter=query>\nConcord capital of\n</parameter>\n</function>\n</tool_call><|im_end|>"; prefill 391.6 tok/s, decode 37.1 tok/s
app prompt with tools, "What is the capital of Norway?", thinking off, 533 tokens -> "...The capital of Norway is **Oslo**.<|im_end|>" (no call); prefill 369.1 tok/s, decode 40.1 tok/s

== llama_main (stock), LFM3-1.7B-Base-8da4w-gptq-2k.pte
"<|startoftext|>The capital of France is" -> " Paris. The capital of Japan is Tokyo. The capital of Brazil is Brasília. ..."; decode 42.9 tok/s, RSS 1869.5 MiB
Loading