> 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 NeMo AutoModel to fine-tune Hy4-flash for VLM workflows with checked-in image-text-to-text recipes for full fine-tuning and LoRA, and documented distributed settings.

[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.

## Fine-Tune Hy4-flash

Follow the [installation instructions](/nemo/automodel/get-started/installation), then review the checked-in recipes and
their declared topology below before choosing a local or cluster launcher.

Use the [Slurm launcher guide](/nemo/automodel/job-launchers/slurm-cluster) for the multi-node runs.

## Choose a Workflow

| Goal                                      | Start Here                                                                                                                                                         |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Full fine-tuning on MedPix-VQA            | Use [hy4_flash_medpix_4k_ep64.yaml](https://github.com/NVIDIA-NeMo/Automodel/blob/main/examples/vlm_finetune/hy_v4_flash/hy4_flash_medpix_4k_ep64.yaml).           |
| LoRA fine-tuning on MedPix-VQA            | Use [hy4_flash_medpix_4k_ep16_lora.yaml](https://github.com/NVIDIA-NeMo/Automodel/blob/main/examples/vlm_finetune/hy_v4_flash/hy4_flash_medpix_4k_ep16_lora.yaml). |
| Text fine-tuning on long packed sequences | See the [language model card](/nemo/automodel/model-coverage/large-language-models/tencent/Hy4-flash).                                                                            |

### Configuration

| Setting  | Configuration                                                                                                      |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Hardware | 8 nodes x 8 H100 80GB (full fine-tuning); 2 nodes x 8 H100 80GB (LoRA)                                             |
| Strategy | FSDP2; tp_size=1, pp_size=1, cp_size=1; ep_size=64 (full fine-tuning), ep_size=16 (LoRA)                           |
| Nodes    | 8 (full fine-tuning); 2 (LoRA)                                                                                     |
| Features | Activation checkpointing (activation_checkpointing=true), HybridEP (dispatcher=hybridep)                           |
| Advanced | bfloat16, attention=cudnn, linear=torch, experts=torch_mm, dispatcher=hybridep, compile_hc=true, compile_norm=true |

Both recipes train on 64 samples per optimizer step with one sample per GPU. The LoRA recipe reaches that on 16 GPUs
with four accumulated micro-batches (`global_batch_size: 64`, `local_batch_size: 1`). LoRA keeps no gradients or
optimizer state for the expert and Engram shards, so a GPU holds one sixteenth of the model at a peak of about
45 GiB allocated.

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.

## Launch Requirements

The multi-node launch requirements (`NCCL_PXN_DISABLE=1`, JIT cache placement, and the compiled cores) are on
the [language model card](/nemo/automodel/model-coverage/large-language-models/tencent/Hy4-flash#launch-requirements).

## Model Reference

### Model Architecture

| Property                  | Value                                     |
| ------------------------- | ----------------------------------------- |
| Task                      | Image-text-to-text                        |
| 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

* [Vision-language model fine-tuning guide](/nemo/automodel/recipes-e2e-examples/gemma-3-3n)