Nyx Image Official Icon

Nyx Image (NyxImage26M)

Sub-40M (26.34M) Discrete Masked Diffusion Transformer for Edge Pixel Art

Built by Sednium Technologies β€’ Licensed under Apache-2.0

Official Model Repo Live WebGPU Space Downloads

Nyx Image 26M Validation Showcase Figure 1: Grid of 128 validation prompts generated by Nyx Image 26M at Step 82,342 (Epoch 30.0) with EMA weights. Features hard pixel boundaries, zero anti-aliasing blur, and authentic retro pixel shading.


Nyx Image (NyxImage26M) is a compact 26.34 Million parameter discrete masked diffusion transformer engineered to synthesize authentic 16Γ—16 retro game sprites directly from text prompts. By completely bypassing continuous VAE autoencoders, Nyx Image predicts discrete palette tokens directly with built-in alpha transparency borders and fine-grained pixel shading in 16 to 24 parallel steps.

Building upon its predecessor (NyxImage23M), version 26M introduces an expanded 2+8+2 patch-merged hourglass architecture, a hybrid Muon + AdamW optimization regime with Warmup-Stable-Decay (WSD) scheduling, and continuous OKLab perceptual color grounding.


Technical Comparison: Nyx Image 23M vs. Nyx Image 26M

Specification Nyx Image 23M (Legacy) Nyx Image 26M (Current) Delta & Impact
Model Architecture 2+6+2 Hourglass (10 blocks) 2+8+2 Hourglass (12 blocks) +33% Bottleneck Depth for deeper feature extraction
Trainable Parameters 23,191,824 26,335,232 +3.14M (+13.6%) capacity within strict sub-40M edge budget
Bottleneck Feedforward Standard Conv-SwiGLU Enhanced Conv-SwiGLU ($d=384$, ratio $3.0$) Increased non-linear expressive power
Training Steps & Epochs 25,000 steps (~4.5 epochs) 82,342 steps (30.0 Full Epochs) 3.3Γ— more compute; full dataset saturation
Training Hardware Kaggle Dual Tesla T4 AWS EC2 Spot (g6.2xlarge, NVIDIA L4 24GB) Modern Ada Lovelace tensor architecture
Optimizer Regime Fused AdamW ($\beta_1=0.9, \beta_2=0.95$) Hybrid Muon (2D weights) + AdamW (vectors/biases) Higher spectral conditioning & orthogonal weight updates
Learning Rate Schedule Linear Warmup + Cosine Decay WSD (80% Stable Peak + 20% Cosine Annealing) Deep exploration followed by sharp feature convergence
Validation Loss / NLL 1.5569 loss / 0.9107 NLL 0.87445 nats -0.036 NLL reduction (lower entropy, sharper borders)
Masked Token Accuracy 73.6% 77.86% +4.26% absolute gain in discrete token prediction
CLIP Alignment Score ~0.245 0.2611 Stronger prompt adherence and semantic fidelity
Color Space Grounding 513-palette RGB 512-token OKLab Perceptual Fourier Grounding Perceptually uniform color transitions & shading
Text Conditioning Sequence + Pooled Projection Joint Multimodal Prefix Registers (4 tokens) + 24 CLIP tokens Unified self-attention with learned memory registers
Inference Formats Safetensors, ONNX, PyTorch Safetensors, ONNX (Opset 17), PyTorch FP16 Sub-millisecond CPU/edge execution

Architectural Deep-Dive: Why 26M Outperforms 23M

1. 2+8+2 Patch-Merged Hourglass with Conv-SwiGLU

Nyx Image 26M structures transformer depth into an asymmetric hourglass:

  • Encoder (High-Res): 2 Transformer blocks operating at $16 \times 16$ resolution (256 spatial tokens).
  • Patch Merge: 2Γ—2 spatial downsampling via pixel unshuffle ($16 \times 16 \to 8 \times 8$).
  • Core Bottleneck: 8 Transformer blocks (expanded from 6 in 23M) with Depthwise Conv-SwiGLU feedforward layers, allowing tokens to aggregate cross-pixel context across an $8 \times 8$ grid.
  • Patch Unmerge: 2Γ—2 spatial upsampling via pixel shuffle ($8 \times 8 \to 16 \times 16$) with residual skip connection.
  • Decoder (High-Res): 2 Transformer blocks refining fine pixel outlines and alpha borders.

2. Warmup-Stable-Decay (WSD) Annealing Dynamics

Unlike standard cosine decay that anneals learning rates prematurely, Nyx Image 26M was trained using Warmup-Stable-Decay (WSD):

  • Warmup (Steps 0–2,000): Linear ramp to peak $\eta_{\text{muon}} = 0.015, \eta_{\text{adamw}} = 3.0 \times 10^{-4}$.
  • Stable Peak (Steps 2,000–65,870): Maintained at maximum learning rate for 80% of training, maximizing exploratory entropy.
  • Cosine Cooldown (Steps 65,870–82,342): Annealed down to $1.0 \times 10^{-5}$. During this cooldown phase, validation NLL plummeted from 0.9111 to 0.87445, locking in bilateral facial symmetry and crisp edges.

Nyx Image 26M Milestone Progression Figure 2: Side-by-side progression across 16 training checkpoints (5k to 80k) with prompt "laughing yellow smiley face icon with rosy cheeks". Notice how broad entropy exploration during the stable peak (5k–60k) resolves into crisp facial symmetry and clean outlines during the cosine cooldown (65k–80k).

3. Continuous OKLab Perceptual Embedding

Rather than treating palette IDs as independent categorical entities, Nyx Image 26M projects discrete tokens into continuous OKLab space infused with 6-frequency Fourier positional features. The model computes loss against a precomputed perceptual distance matrix (oklab_distance.npy), penalizing visually discordant errors much more heavily than adjacent shading shifts.


Model Weights & Formats

The model weights are provided in three standardized formats for edge and cloud runtimes:

File Name Format Size Target Environment
nyx-image-26m.safetensors Safetensors 100.5 MB PyTorch, Hugging Face safetensors, Python pipelines
nyx-image-26m.onnx ONNX (Opset 17) 102.5 MB ONNX Runtime, Rust (ort/tract), C/C++, WebAssembly, Mobile
nyx-image-26m-fp16.pt PyTorch Checkpoint 50.3 MB Training resumption, PyTorch evaluation, EMA weights
palette.npy NumPy Array 1.7 KB 512-entry OKLab color lookup table for pixel rendering
oklab_distance.npy NumPy Array 1.0 MB Precomputed pairwise perceptual distance matrix

Quickstart & Inference Guide

1. Installation

pip install torch torchvision transformers pillow numpy safetensors onnxruntime

2. Python Inference (PyTorch & NyxPipeline)

import torch
from nyx_image_v2.sampler import NyxPipeline

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# Load pipeline directly from pretrained weights and palette
pipeline = NyxPipeline.from_pretrained(
    checkpoint="nyx-image-26m-fp16.pt",  # or "nyx-image-26m.safetensors"
    palette="palette.npy",
    device=device,
    bf16=torch.cuda.is_available(),
)

# Generate a 16x16 pixel sprite (24 sampling steps)
image = pipeline.generate(
    prompt="flaming demonic sword with glowing crimson runes",
    steps=24,
    cfg=3.0,
    seed=42,
    upscale=8,  # Upscales to 128x128 for clear viewing
)
image.save("flaming_sword.png")
print("Sprite generated successfully!")

3. Zero-PyTorch Edge Inference with ONNX Runtime

import onnxruntime as ort
import numpy as np
from PIL import Image

# Initialize ONNX Runtime engine (CPU or DirectML/CUDA)
session = ort.InferenceSession("nyx-image-26m.onnx", providers=["CPUExecutionProvider"])
palette = np.load("palette.npy")

# Inputs expected by ONNX graph:
# - tokens: (B, 256) int64
# - timesteps: (B,) float32
# - text_tokens: (B, 24, 512) float32
# - self_cond_probs: (B, 256, 512) float32
# - drop_text_mask: (B,) bool

def run_onnx_step(tokens, t, text_tokens, sc_probs, drop_mask):
    ort_inputs = {
        "tokens": tokens.astype(np.int64),
        "timesteps": np.array([t], dtype=np.float32),
        "text_tokens": text_tokens.astype(np.float32),
        "self_cond_probs": sc_probs.astype(np.float32),
        "drop_text_mask": np.array([drop_mask], dtype=bool),
    }
    logits = session.run(["logits"], ort_inputs)[0]
    return logits

print("Nyx Image 26M ONNX Runtime engine initialized.")

4. Running in Native Rust Game Engines

Embed nyx-image-26m.onnx directly into Bevy, Macroquad, or Fyrox game engines using ort:

// Cargo.toml: ort = "2.0"
use ort::session::Session;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let session = Session::builder()?
        .commit_from_file("nyx-image-26m.onnx")?;
    println!("Nyx Image 26M ONNX model loaded successfully in native Rust runtime!");
    Ok(())
}

Technical Specifications

Parameter Specification Technical Rationale
Model Architecture NyxImage26M 2+8+2 Patch-Merged Discrete Masked Diffusion Transformer (MDLM)
Total Trainable Parameters 26,335,232 Optimized for dense edge game asset generation
Canvas Resolution $16 \times 16$ (256 tokens) Standard retro game sprite dimensions
Vocabulary Size 512 Tokens Index 0 = Transparent, 1–511 = OKLab Palette, 512 = [MASK]
Hidden Dimension ($d_{\text{model}}$) 384 High capacity with sub-millisecond execution
Attention Heads 8 heads ($d_{\text{head}} = 48$) QK-RMSNorm stabilized multi-head attention
Bottleneck Structure $8 \times 8$ Grid (Patch Merge/Unmerge) Captures macro structural composition before detail decoding
Position Encoding Axial 2D RoPE (spatial) + 1D RoPE (text) Strict Cartesian coordinate adherence
Text Conditioning Frozen CLIP ViT-B/32 24-token sequence + 4 learned multimodal prefix registers
Color Embedding Fourier OKLab (6 bands) Continuous perceptual color geometry per token
Inference Budget 16–24 Steps Fast parallel unmasking with Spatial NMS

Training Details

  • Dataset: Angais/pixel-art-atlas-1.4m (1,405,308 curated $16 \times 16$ pixel art sprites).
  • Samples Processed: 42,159,104 sprite instances (30.0 Full Epochs).
  • Hardware: AWS EC2 Spot g6.2xlarge (NVIDIA L4 24GB Tensor Core GPU, bfloat16).
  • Throughput: 108,130 tokens/second (1.21s per 512-batch step).
  • Optimization: Hybrid Muon ($\eta=0.015$, momentum 0.95, Nesterov) on 2D weights + AdamW ($\eta=3.0 \times 10^{-4}, \beta_1=0.9, \beta_2=0.95$) on vectors/biases.
  • Loss Function: Discrete cross-entropy with OKLab perceptual soft smoothing.
  • Final Convergence: 0.87445 nats Validation NLL (77.86% Masked Token Accuracy, 0.2611 CLIP alignment).

License

Nyx Image 26M is licensed under the Apache-2.0 License.

Copyright 2026 Sednium Technologies

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

❀️ Made with Love by Bhoid

"Thank you to everyone in the open-source community for the incredible support! You inspire me to keep building, experimenting, and open-sourcing edge AI models like Nyx. Keep creating amazing games! βœ¨πŸš€"

Sednium Technologies

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train Bhoidy/nyx-image-26m

Space using Bhoidy/nyx-image-26m 1

Evaluation results

  • Validation NLL on Angais/pixel-art-atlas-1.4m
    self-reported
    0.87445 nats
  • Masked Token Accuracy on Angais/pixel-art-atlas-1.4m
    self-reported
    77.86%
  • CLIP Alignment Score on Angais/pixel-art-atlas-1.4m
    self-reported
    0.261
  • Parameters on Angais/pixel-art-atlas-1.4m
    self-reported
    26335232.000