Skip to content

feat(strata): run Tencent Hy4-Flash on the strata-hy4 engine - #13389

Merged
mudler merged 2 commits into
masterfrom
feat/strata-hy4-flash
Nov 22, 2026
Merged

mudler merged 2 commits into
masterfrom
feat/strata-hy4-flash

Conversation

@mudler-agent

Copy link
Copy Markdown
Collaborator

What

Makes the experimental strata backend run Tencent Hy4-Flash. Strata v0.2.18 ships it as a separate engine program, strata-hy4, plus Hugging Face repository strata-engine/Hy4-Flash-Strata. This adds a hy4 family to the backend, the engine packages to the image, and three gallery entries (SQ-64, SQ-96, SQ-128).

Draft: not run on real hardware. No machine available to me had both the memory and a fast drive for the model (at least 64 GiB of RAM, a GPU, about 130 GB of fast disk) and was free to use. Nothing here has loaded the real model. See "Not verified".

How strata-hy4 works (read from the Strata sources at v0.2.18)

  • Same --serve line protocol as the other engine (READY, GEN, T, DONE, STOP, QUIT), but a short flag list and a strict parser: an unknown flag or GEN key is an error. So none of the Qwen flags are sent.
  • Start line: --native <build> --engram <file> --max-context N [--vision <file>] [--vram-experts-gb X] [--ram-experts-gb Y] [--draft dfly2]. There is no pack directory.
  • strata-hy4 --info <build> prints arch=hy4flash ... drafter=dfly2 images=1. Strata's own server asks for the drafter and the vision file only when the engine says it has them; the backend does the same.
  • The tokenizer (byte-level BPE) and the Jinja chat template are in Section 0 of the .strata file (a zstd JSON manifest at the end). Strata's tools/hy4_tokenizer.py turns it into the tokenizer directory.
  • Pictures are files. One image=<path> key per picture on the GEN line, one image placeholder per picture in the prompt, expanded by the engine. No encoder program, no GENI.
  • Reasoning and tool calls are tagged tokens (<think:opensource>, <tool_calls:opensource>, ...). Strata translates them with serve/hy4_dialect.py and uses Hy4OutputParser; the template takes reasoning_effort of no_think, high or max.
  • No logprobs and no logit bias. DFly2 speculative decoding is inside the model file.

Changes

  • backend/go/strata: family:hy4 (new hy4.go). Options: native, engram, vision, drafter, vram_experts_gb, ram_experts_gb. Reads Section 0 in Go (zstd), runs the Strata tool to make the tokenizer directory next to the build file (staged and renamed, stamped with the file name and size), probes --info, writes pictures to scratch files, stops on <hy_end> and <hy_EOT>. The helper uses Hy4's parser, effort words and literal tags for this family only. The Qwen path is unchanged.
  • Packaging: engines-hy4/ in the image, filled by make engine from strata-hy4-<version>-<target>.tar.gz packages, each pinned with its own tag, version and SHA-256 (STRATA_HY4_*). strata-engine picks them with STRATA_ENGINE_FAMILY=hy4. .github/bump_strata.sh and scripts/build/strata-pins_test.sh read both families. The Python sources fetched at the pinned commit add hy4_tokenizer.py, hy4_dialect.py and toolformat.py. The image grows by the Hy4 engine packages (same targets as the existing engines).
  • Gallery: hy4-flash-sq-64-strata, -96-, -128-, pinned to Hugging Face commit 995bac227ab7e0d221772be641e2b5954a9fac06, with the SHA-256 values of the build, Engram and vision files (checked against the Hugging Face API). The three entries share one model directory, so the 67.6 GB Engram file is downloaded once. Licence key tencent-hy-license (Tencent Hy License 1.0, Apache-derived with extra terms for very large MaaS businesses), named in the description. core/gallery/strata_entries_test.go covers the new family and licence; the Qwen checks are unchanged.
  • Docs: docs/content/models/engines/strata.md (hardware, models table, options) and the backend README. The memory and disk figures are the vendor's, marked as such.

Checks run

  • go vet, golangci-lint and the backend unit tests (new tests cover option parsing, the start line, --info, Section 0 reading, the tokenizer stamp, picture keys, EOS and logprobs refusal against the stub engine).
  • go test ./core/gallery/, scripts/build/strata-pins_test.sh, make check-pins.
  • Tokenizer helper run on the real Section 0 of Hy4-Flash-SQ-64.strata (read by range request): tokenizer conversion, prompt rendering with and without thinking, image placeholders, quoted tag kept as text, and a streamed reply with reasoning and a tool call parsed into events.
  • make engine-packages-hy4 fetched and checksum-verified the real x86_64 CUDA 12 package; the launcher ran it (strata-hy4 0.1.64).
  • bump_strata.sh against the live release rewrote a deliberately wrong pin back to the pinned value, so all nine Hy4 SHA-256 pins match the release's SHA256SUMS.txt and GitHub's digests.

Not verified

  • No Hy4 engine has loaded a real model through this backend. --info, the --serve start with these flags, DFly2, images, memory placement and speed are untested here.
  • A card with little memory may need vram_experts_gb and ram_experts_gb; Strata's launcher computes them, this backend only passes them through and sets none by default. Unified-memory machines are the case Strata documents without them.
  • EXIF rotation of JPEG pictures is not applied (same as the Qwen path).
  • The images that ship both engines were not built here.

🤖 Generated with Claude Code

Hy4-Flash does not run on the engine that serves the Qwen models. Strata
ships a separate program, strata-hy4, that speaks the same --serve line
protocol with its own short list of flags. Add a hy4 family to the strata
backend:

- family:hy4 reads a .strata build file, the shared Engram file and an
  optional vision file, and starts the engine with --native, --engram,
  --max-context and, when `--info` says the engine has them, --vision
  and --draft dfly2 (speculative decoding).
- The tokenizer and chat template are read from the build file and
  converted with Strata's own tool on the first load.
- Pictures are files named by image= keys on the GEN line; the helper
  uses Strata's parser for Hy4's tagged reasoning and tool-call tokens.
- The image carries the Hy4 engine packages in engines-hy4/, pinned one
  by one with their own tag, version and SHA-256. The launcher picks them
  when STRATA_ENGINE_FAMILY=hy4. The bump script and the pins test read
  both families.
- Add three gallery entries (SQ-64, SQ-96, SQ-128) pinned to a Hugging
  Face commit, and the docs. The Qwen path is unchanged.

Assisted-by: Claude:claude-sonnet-5-5
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Assisted-by: Claude:claude-sonnet-5-5
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler
mudler marked this pull request as ready for review November 22, 2026 17:36
@mudler
mudler merged commit ad8bb00 into master Nov 22, 2026
236 of 237 checks passed
@mudler
mudler deleted the feat/strata-hy4-flash branch November 22, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants