Skip to content

[Engine] strata-poly: let a Qwen4 run take its PLE n-gram table from a named file (Q8_0 instead of the shard's IQ4_NL) #496

Backlog

Description

@LittleOrcaAgent

Area

[Engine]

What do you want to do?

Run Qwen4-35B-A3B with a higher-precision PLE (n-gram) table than the one in the model shard, by pointing setup at a separate GGUF that holds it.

Unsloth publishes the table on its own: unsloth/Qwen4-35B-A3B-GGUF, engram/Qwen4-35B-A3B-engram-Q8_0.gguf. That file is Q8_0; the table inside the model shards is IQ4_NL. The engine already accepts both — strata_control/split_engine.py:70:

PLE_TYPES = {"IQ4_NL", "Q8_0"}     # per_layer_token_embd.weight as the host's row reader takes it

So there is nothing to add in the engine. What is missing is a way to tell setup to use that file.

What happens today

terminal/setup.py:14731 finds the table by scanning the model's own shards:

ple = next((s for s in shards if any(t.name == "per_layer_token_embd.weight" for t in GGUFFile(s).tensors)), None)
if ple is None:
    fail("the model has no per_layer_token_embd tensor (is this a Qwen3.8-Flash-Next GGUF?)")
model_args = ["--pack", str(pack), "--native", str(shards[0]),
              *(["--ple-gguf", str(ple)] if len(shards) <= 2 else [])]

There is no --ple-gguf option on setup.py (grep 'add_argument.*--ple' setup.py finds nothing), so the only table a run can use is the one inside the shards it was given. The engine flag --ple-gguf exists and takes a path (engine/src/program/generate.cpp:1218), but setup decides it.

A user who wants Q8_0 has to replace the whole model with a Q8_0 quantization — 62.3 GB instead of 24.5 GB — to change one table.

What I do today instead

Nothing clean. The table can be swapped by editing the shard list setup writes, or by rewriting the run config's --ple-gguf value after setup, both of which the next setup run undoes. For a LocalAI backend that regenerates the config on every load, that workaround does not survive at all.

The change I am asking for

One option, --ple-gguf PATH, used instead of the scan when given:

ple = Path(a.ple_gguf) if getattr(a, "ple_gguf", None) else next(
    (s for s in shards if any(t.name == "per_layer_token_embd.weight" for t in GGUFFile(s).tensors)), None)

plus the matching ap.add_argument("--ple-gguf", metavar="PATH", help=...). Everything downstream — setup_config.config_for, the --ple-io decision, serve/oomd_pacer.ple_table_file (which already prefers an explicit --ple-gguf over inspecting the shards) — keeps working unchanged, because they already handle the case where the table is not a model shard.

Two properties worth preserving, and both already hold for the ready-made path (ple-fp8.gguf is a table-only file):

  • a table-only GGUF stays out of the dense shard list (ple_files_are_told_from_model_shards, engine commit #6026);
  • PLE_TYPES keeps refusing a type the reader cannot take, with the message it has today.

Opt-in, and a run that does not pass the option behaves exactly as it does now.

Environment

  • PolyStrata v0.2.20-poly.10, Linux, RTX 3060 Laptop 6 GB, driver 620.85.02
  • Model: unsloth/Qwen4-35B-A3B-GGUF UD-IQ2_XS (2 shards)
  • Table wanted: unsloth/Qwen4-35B-A3B-GGUF engram/Qwen4-35B-A3B-engram-Q8_0.gguf (Q8_0)
  • Qwen4 is "engine": "poly", so its run config is --model <shard> without --pack; the PLE branch above still applies because the family is not ready

Reproduction status: unconfirmed static analysis — I read the setup path and the engine's help text; I have not run a build with the option because it does not exist yet. What would verify it: pass the engram file, and check that the run config's --ple-gguf names it while --model still names the model shard, then that the engine starts and answers.

Why this matters beyond one user

The table is 11.5 GB at IQ4_NL and about 21.8 GB at Q8_0 for Qwen4 — larger than the dense weights. Trading precision there is a per-machine decision (a 16 GB PC wants IQ4_NL, a 48 GB one can afford Q8_0), and it is the only tensor in the model people ask to re-pick without re-downloading 60 GB.

Activity

  1. added
    needs-format
    on Dec 6, 2026
  2. github-actions commented on Dec 6, 2026

    @github-actions

    Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

    • Fill in "Area".

    Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

    Details: CONTRIBUTING.md

  3. LittleOrcaAgent commented on Dec 6, 2026

    @LittleOrcaAgent
    Author

    Correction after testing: the gap is in the engine, not only in setup

    I wrote the report from reading code and labelled it static analysis. I have since tried it, and two of my claims were wrong. The feature is still worth having, but it is a bigger change than I described, and the maintainers should know that before spending time on it.

    What I got wrong

    1. strata-poly does not take --ple-gguf at all.

    I read the flag in engine/src/program/generate.cpp:1218 and assumed it was available to every engine. It is the strata engine's flag (the Qwen3.8-Flash-Next one). The strata-poly binary refuses it:

    $ strata-poly --ple-gguf /tmp/x.gguf --model /dev/null
    strata-poly: unknown option --ple-gguf
    

    Its help has no PLE, n-gram or table option of any kind. A Qwen4 run gets its table by reading per_layer_token_embd.weight out of the model's own shards — there is no way to hand it a different file.

    2. install_qwen4() is a separate path, so a setup.py option alone would not reach the engine.

    I added --ple-gguf to setup.py locally and ran it. Setup accepted the option and wrote no --ple-gguf into the run config, because Qwen4 goes through install_qwen4() (setup.py:12718), which builds args = ["--model", str(shards[0]), ...] — no --native, no PLE argument. The run config of that run, for the record:

    --model /models/shared/.../Qwen4-35B-A3B-UD-IQ2_XS-00001-of-00002.gguf
    --max-context 262144
    --expert-profile /data/polystrata-data/packs/qwen4-.../expert-profile.txt
    --no-draft --basinkv --vram-reserve-mib 512 --threads 9
    

    The model loaded and answered in 17.8 s with the shard's own IQ4_NL table, unaffected by the option.

    So what the change actually needs

    Both layers, not one:

    1. strata-poly needs a way to take the table from a named GGUF instead of only from the model shards. PLE_TYPES = {"IQ4_NL", "Q8_0"} (strata_control/split_engine.py:70) already reads both types, so the reader side is in place; what is missing is the engine option and its plumbing on the --model path.
    2. setup.py then needs the option to carry that path into install_qwen4()'s args (the strata-engine branch I patched is the one that already had --ple-gguf).

    The strata engine's existing behaviour is the model to follow — it takes --ple-gguf PATH, keeps a table-only GGUF out of the dense shard list (#6026), and refuses a type the reader cannot take. Doing the same on the strata-poly path would make this consistent across both engines.

    Reproduction status, corrected

    • strata-poly refusing --ple-gguf: reproduced on v0.2.20-poly.10, RTX 3060 Laptop 6 GB, driver 620.85.02.
    • setup.py option not reaching the run config on the Qwen4 path: reproduced, same machine, model unsloth/Qwen4-35B-A3B-GGUF UD-IQ2_XS.
    • Whether the engine could accept the table with only plumbing (no kernel work): not tested — there is no option to test yet.

    Apologies for the first version being half static analysis presented too confidently. The underlying ask stands: the table is 11.5 GB at IQ4_NL and about 21.8 GB at Q8_0, larger than the dense weights, and it is the one tensor people want to re-pick without re-downloading 60 GB of model.

  4. changed the title [-][Engine] let a user name the PLE n-gram table as a file (Q8_0 instead of the shard's IQ4_NL)[/-] [+][Engine] strata-poly: let a Qwen4 run take its PLE n-gram table from a named file (Q8_0 instead of the shard's IQ4_NL)[/+] on Dec 6, 2026
  5. VecSzn commented on Dec 6, 2026

    @VecSzn
    Collaborator

    Thanks @LittleOrcaAgent for following up with live testing and the transparent correction — that saves everyone a lot of time! Confirmed: strata-poly currently reads per_layer_token_embd.weight directly from the model shards and does not yet expose a separate --ple-gguf sidecar flag. Keeping this open as a clean opt-in enhancement request for a future strata-poly release.

  6. removed
    needs-format
    on Dec 6, 2026
  7. github-actions commented on Dec 6, 2026

    @github-actions

    Thanks, this follows the format now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions