> This page is for version Nightly (default).
> For other versions, use one of these documentation indexes:
> - Nightly (default): https://docs.nvidia.com/nemo/automodel/nightly/llms.txt
> - Latest: https://docs.nvidia.com/nemo/automodel/latest/llms.txt
> - 0.7.0 · 26.10: https://docs.nvidia.com/nemo/automodel/v0.7/llms.txt
> - 0.5.0 · 26.06: https://docs.nvidia.com/nemo/automodel/v0.5/llms.txt
> - 0.4.0 · 26.04: https://docs.nvidia.com/nemo/automodel/v0.4/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.

# Hy4-flash

> Use Hy4-flash with NeMo AutoModel for language model fine-tuning on long packed sequences, with a context-parallel recipe and launch requirements.

[Hy4-flash](https://huggingface.co/tencent/Hy4-flash) is a vision-language Mixture-of-Experts model from Tencent. Its 42-layer decoder carries four hyper-connection streams, multi-head latent attention that alternates between sparse layers (a compressed indexer keeps 2,048 keys per query) and sliding-window layers (512 tokens), a latent MoE with 512 routed experts (16 active) plus one shared expert on layers 1-41, and Engram n-gram memory on four layers. The Hugging Face configuration declares the `HYV4FlashForConditionalGeneration` architecture.

Set up NeMo AutoModel with the [latest container](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/nemo-automodel) or follow the [installation instructions](/nemo/automodel/nightly/get-started/installation).

## Fine-Tune Hy4-flash

The text recipe trains on Tulu-3 packed into 131,072-token sequences with context parallelism (CP16) and expert
parallelism (EP64) on 8 nodes of 8 H100 GPUs. Conversations are shuffled with a fixed seed before packing, and packed
documents never attend to each other. Use the [Slurm launcher guide](/nemo/automodel/nightly/job-launchers/slurm-cluster) for the multi-node run.

Samples are rendered in the model's fast-thinking mode (`reasoning_effort=no_think`), as the official fine-tuning
code does for answer-only data. A sample whose assistant turn carries reasoning (`reasoning_content` or `reasoning`)
is rejected with an error: training on reasoning traces is not supported.

## Choose a Workflow

| Goal                                                                       | Start Here                                                                                                                                                                             |
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Supervised fine-tuning (SFT) on packed 128K sequences, CP16 x EP64         | Use [hy4_flash_tulu3_128k_cp16_ep64_100steps.yaml](https://github.com/NVIDIA-NeMo/Automodel/blob/main/examples/llm_finetune/hy_v4_flash/hy4_flash_tulu3_128k_cp16_ep64_100steps.yaml). |
| Synthetic throughput workload (`--benchmark`), 4K sequences, EP64          | Use [hy4_flash_4k_ep64_h100.yaml](https://github.com/NVIDIA-NeMo/Automodel/blob/main/examples/llm_pretrain/hy_v4_flash/hy4_flash_4k_ep64_h100.yaml).                                   |
| Synthetic throughput workload (`--benchmark`), 128K sequences, CP16 x EP64 | Use [hy4_flash_128k_cp16_ep64_h100.yaml](https://github.com/NVIDIA-NeMo/Automodel/blob/main/examples/llm_pretrain/hy_v4_flash/hy4_flash_128k_cp16_ep64_h100.yaml).                     |
| Image-text fine-tuning                                                     | See the [vision-language model card](/nemo/automodel/nightly/model-coverage/vision-language-models/tencent/Hy4-flash).                                                                                        |

## Launch Requirements

* **Set `NCCL_PXN_DISABLE=1`** (or `NCCL_NET_PLUGIN=none NCCL_NET=IB`) on multi-node InfiniBand H100 systems. With the
  container's default NCCL network plugin and PXN both active, the Engram row-owner all-to-all receives corrupted IDs
  from ranks on another node and the recipe stops in the table's received-ID check, as for DeepSeek-V4.1-Flash. See
  [issue #3959](https://github.com/NVIDIA-NeMo/Automodel/issues/3959). The recipes set it in `ci.env_vars`.
* **Point the JIT caches at node-local storage** (`HYBRID_EP_CACHE_DIR`, `TRITON_CACHE_DIR`).
* The recipes compile the hyper-connection and norm cores (`compile_hc`, `compile_norm`), so the first step takes
  several minutes longer than the following ones. The cores are compiled with options that keep the eager BF16
  rounding points, so the compiled norm agrees with the eager one on all but a few elements in a million; LoRA and
  full fine-tuning start within 1.4e-3 of each other in loss. `compile_norm: false` gives the eager norm in a process
  where no model has enabled the compiled core: the core is shared by every Hy4-flash model of a process, so once
  one model enables it, existing and later instances use it too.

## Model Reference

### Model Architecture

| Property                  | Value                                     |
| ------------------------- | ----------------------------------------- |
| Task                      | Text Generation (MoE)                     |
| Architecture              | `HYV4FlashForConditionalGeneration`       |
| Parameters                | 219B total / 11B activated                |
| Hugging Face Organization | [tencent](https://huggingface.co/tencent) |

### Available Models

| Model     | HF ID                                                           |
| --------- | --------------------------------------------------------------- |
| Hy4-flash | [`tencent/Hy4-flash`](https://huggingface.co/tencent/Hy4-flash) |

## Related Resources

* [LLM Fine-Tuning Guide](/nemo/automodel/nightly/recipes-e2e-examples/sft-peft)
* [Large MoE Fine-Tuning Guide](/nemo/automodel/nightly/recipes-e2e-examples/large-moe-fine-tuning)