Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 5 min read Announcement mediumAdept

SegMoE: Segmind Mixture of Diffusion Experts

SegMoE is a framework for building Mixture-of-Experts diffusion models by merging pretrained Stable Diffusion or SDXL checkpoints. Selected feed-forward and/or attention layers are replaced with sparse MoE layers whose router gate weights are computed from per-expert positive and negative prompts. Three merges are released (SegMoE-2x1, 4x2 and SD 4x2), and a YAML config plus CLI or Python API builds custom merges from Hugging Face or CivitAI models. Qualitative comparisons suggest better prompt understanding than the RealVisXL base, at the cost of slower inference when more than one expert is active per token and high VRAM use: 24GB in half precision for SegMoE-4x2.

Assumes: Stable Diffusion basicsMixture of Experts conceptPython

Related posts

  • Mixture of Experts (MoEs) in Transformers

    Hugging Face hardMaster

    Hugging Face transformers v5 reworks its internals to treat Mixture of Experts models as first-class: a WeightConverter pipeline packs per-expert checkpoint tensors into contiguous runtime tensors with async, lazy materialization, cutting Qwen1.5-110B load time from ~66s to ~21s (10s with tensor parallelism) on an A100. A pluggable Experts Backend dispatches tokens via eager, batched_mm (torch.bmm) or grouped_mm (torch._grouped_mm) strategies, suited respectively to debugging, small-batch and large-batch/memory-constrained workloads. Expert parallelism shards experts across GPUs with a single config flag, and a collaboration with Unsloth using Triton grouped-GEMM + LoRA kernels yields ~12× faster MoE training with >35% less VRAM.

  • Mixture of Experts Explained

    Hugging Face hardMaster

    Mixture of Experts (MoE) transformers replace dense feed-forward layers with sparse expert layers and a learned router that sends each token to only a few experts. Pretraining is much faster than for dense models, and inference is faster than a dense model with the same parameter count, but all experts must sit in memory: Mixtral 8x7B needs VRAM for about 47B parameters while computing like a 12B model. The history runs from the 1991 origins through Shazeer's noisy top-k gating, GShard's expert capacity and random routing, and Switch Transformers' single-expert routing and selective bfloat16 precision. It also covers load-balancing auxiliary losses, router z-loss, fine-tuning difficulties, expert parallelism and serving tradeoffs.

  • Welcome FLUX.3 Image Klein in Diffusers

    Hugging Face mediumAdept

    FLUX.3 Image Klein from Black Forest Labs is supported in Diffusers from launch. It is a single model for text-to-image, multi-reference image-to-image, and bounding-box layout control, where regions are written as JSON with normalized 0–1000 boxes to place new content or move content from a reference image. The distilled checkpoint renders 1024×1024 in about 1.9 s on an H100 in 16 steps without CFG. Reference images roughly double the time because each adds 4,096 tokens to the transformer sequence. The post also covers FP8 and NVFP4 single-file variants that cut peak memory to about 15–16 GiB, DreamBooth LoRA training scripts, the VAE tokenization (one token per 16×16 patch), and Modular Diffusers pipeline usage.

  • Open Preference Dataset for Text-to-Image Generation by the 🤗 Community

    Hugging Face easyNovice

    Data is Better Together released an Apache 2.0 text-to-image preference dataset of 10K pairs, with over 30K annotations from more than 250 community members collected in under two weeks. Imgsys prompts were deduplicated, filtered for NSFW content with text and image classifiers plus manual review, and rewritten with distilabel across style categories and simple versus complex variants. Images came from FLUX.1-dev and Stable Diffusion 3.5 Large. Annotators found FLUX better for anime, manga and 3D, and SD3.5 better for cinematic and art styles. A LoRA fine-tune of FLUX-dev on the chosen samples improved its weaker art and cinematic outputs.

  • Welcome Mixtral - a SOTA Mixture of Experts on Hugging Face

    Hugging Face mediumAdept

    Mixtral 8x7B is Mistral's sparse Mixture-of-Experts LLM. It replaces feed-forward layers with MoE layers that route each token to 2 of 8 experts, so it has about 45B total parameters but decodes at roughly the speed of a 12B dense model. On release it beat Llama 2 70B on the Open LLM Leaderboard and matched GPT-3.5 on MT-Bench (8.30), under an Apache 2.0 license. Hugging Face shipped integrations for running it with Transformers and Text Generation Inference, plus QLoRA fine-tuning with TRL on one A100 (attention projections only, since sparse MLP layers interact poorly with PEFT). For quantization, VRAM needs are about 90 GB in fp16 and about 23 GB in 4-bit, and GPTQ performs better when the expert gating layers are left unquantized (perplexity 4.40 vs 4.25 in fp16).

The quest for software engineering knowledge.

Look:
Layout: