Nyx Image 36M (Nyx-2)
Continuous Rectified Flow Transformer for Native 32Γ32 RGBA Pixel Art
Built by Bhoid & Sednium Technologies β’ Licensed under Apache-2.0
Figure 1: Widescreen showcase of 36 distinct 32Γ32 pixel art sprites synthesized exclusively by our frontier checkpoint (Step 90,000 / Final EMA) using second-order Heun ODE integration (30 steps, CFG scale 4.0). Rendered at 4Γ nearest-neighbor integer scaling with strict binary alpha transparency.
Figure 2: Training convergence across milestone checkpoints (Epoch 25, 50, 75, 100, 133, and final EMA) for prompt "a christmas tree" (seed 42, 30 Heun steps, CFG 4.0). Initial color massing at Epoch 25 resolves into defined foliage tiers at Epoch 50, distinct ornaments at Epoch 100, and balanced pixel shading at Epoch 133.
Overview
Nyx Image 36M (NyxRGBAHourglassDiT) is an open-weights continuous Rectified Flow transformer engineered to synthesize native 32Γ32 RGBA game sprites directly from text prompts.
By bypassing continuous latent autoencoders (VAEs) and discrete palette lookup tables, Nyx-2 models four continuous channels ($R, G, B, A \in [-1.0, 1.0]$) directly in pixel space. This design preserves sharp pixel boundaries, eliminates palette quantization banding, and guarantees clean binary transparency masks.
Technical Specifications
| Specification | Value | Notes |
|---|---|---|
| Architecture | NyxRGBAHourglassDiT |
2+8+2 U-ViT with pixel stem & multi-scale skip fusions |
| Trainable Parameters | 35,989,840 (35.99M) | Exact parameter count verified via state dictionary |
| Native Canvas Resolution | 32Γ32 pixels (1,024 pixels) | 4 channels: Red, Green, Blue, Alpha |
| Color Domain | Continuous 4-Channel RGBA | Float values in $[-1.0, 1.0]$ mapped to $[0, 255]$ uint8 |
| Diffusion Formulation | Continuous Rectified Flow (RF) | Velocity vector field regression $v = \epsilon - x_0$ |
| Sampling Algorithm | Second-Order Heun ODE Solver | 30 steps with Euler endpoint at $t = 0.0$ |
| Guidance Dynamics | Classifier-Free Guidance (CFG) | Scale 4.0 applied on $t \in [0.0, 0.75]$, disabled near $t = 0.0$ |
| Text Conditioning | SigLIP Base Patch16-224 | 768-dim pooled sentence vector + 32-token sequence |
| Prompt Template | "pixel art icon of a <prompt>" |
Prepended to match training caption distribution |
| Transparency Contract | Binary Alpha Boundary | $A = +1.0$ opaque; $A = -1.0$ transparent ($RGB = 0.0$) |
| Training Dataset | azyg0s/pixelart-172k |
172,000 curated 32Γ32 RGBA pixel art icons |
| Training Steps | 90,000 steps (~133.7 epochs) | Warmup-Stable-Decay (WSD) schedule with 15% cooldown |
| Validation Loss | 0.08327 MSE | Unseen subject test split: 0.10225 MSE |
| Safetensors Size | 137.3 MB | Single-file weight distribution |
| ONNX Graph Size | 140.1 MB | Standalone graph (opset 18) for WebGPU and edge runtimes |
| FP16 Weights | 68.7 MB | Half-precision PyTorch weights |
Architectural Deep Dive
Hourglass U-ViT Backbone
Nyx-2 uses an asymmetrical multi-scale U-ViT architecture designed for dense $32 \times 32$ spatial layout:
Input [B, 4, 32, 32]
β
βββ> Pixel Stem (32Γ32, 64 channels, 2 residual blocks) ββ> Skip 32Γ32
β β
β βββ> Stride-2 Conv (16Γ16, 256 channels)
β β
β βββ> Outer Encoder (16Γ16, 2 blocks, SwiGLU, 2D-RoPE) ββ> Skip 16Γ16
β β β
β β βββ> Stride-2 Conv (8Γ8, 384 channels)
β β β
β β βββ> Bottleneck (8Γ8, 8 blocks, SwiGLU, cross-attention)
β β β
β β ββββββββ
β β βΌ
β βββ> Upsample + Outer Decoder (16Γ16, 2 blocks) <ββ Skip 16Γ16
β β
β βββββββββββββββ
β βΌ
βββ> Upsample + Output Head (32Γ32, 64 channels) <ββ Skip 32Γ32
β
βββ> 3Γ3 Conv Velocity Head ββ> Output v_pred [B, 4, 32, 32]
- Pixel-Exact Stem: Two convolutional residual blocks operating at native 32Γ32 resolution project raw RGBA inputs into 64 feature channels.
- 2D Rotary Position Embeddings (2D-RoPE): Both outer encoder/decoder stages ($16 \times 16$) and bottleneck stages ($8 \times 8$) use 2D spatial rotary embeddings. Head dimensions are split between vertical and horizontal spatial frequencies, preserving pixel grid coordinates without absolute position degradation.
- Multi-Scale Skip Connections: Feature maps from the pixel stem ($32 \times 32$) and outer encoder ($16 \times 16$) are concatenated and fused via $1 \times 1$ convolutions into the decoder, anchoring high-frequency outline detail.
- Conv-SwiGLU Bottleneck: Eight transformer blocks at the $8 \times 8$ latent grid combine cross-attention over frozen SigLIP text tokens with depthwise convolutional SwiGLU feed-forward networks.
Transparency Contract
Sprites follow a binary transparency protocol:
- Transparent Background: $A = -1.0$ and $RGB = (0.0, 0.0, 0.0)$.
- Opaque Foreground: $A = +1.0$ and $RGB \in [-1.0, 1.0]$.
- Inference Threshold: During sampling, pixels with $A < 0.0$ are clamped to zero alpha and zero RGB:
This eliminates color fringing, halos, and semi-transparent blur around sprite contours.
Second-Order Heun ODE Sampler
Sampling integrates the continuous velocity trajectory from standard Gaussian noise ($t = 1.0$) to clean image ($t = 0.0$) using 30 integration steps:
- Predictor Step: $$x_{\text{pred}} = x_t + \Delta t \cdot v(x_t, t)$$
- Corrector Step: $$x_{t + \Delta t} = x_t + \frac{\Delta t}{2} \cdot \left[ v(x_t, t) + v(x_{\text{pred}}, t + \Delta t) \right]$$
- Euler Endpoint: The final step to $t = 0.0$ uses a direct Euler update to prevent evaluation at the singular boundary.
- CFG Schedule: Classifier-Free Guidance (scale 4.0) is active for $t \in [0.0, 0.75]$ and disabled near $t = 0.0$, preventing over-saturation and preserving subtle color gradations.
Checkpoints and Model Files
All model weights are verified, self-contained, and released under Apache-2.0:
| File Name | Format | Size | Description |
|---|---|---|---|
nyx-image-36m.safetensors |
Safetensors | 137.3 MB | Native 32Γ32 RGBA weights for PyTorch and web runtimes |
nyx-image-36m.onnx |
ONNX (Opset 18) | 140.1 MB | Standalone graph, tested in ONNX Runtime & WebGPU |
nyx-image-36m-fp16.pt |
PyTorch Checkpoint | 68.7 MB | Half-precision EMA weights for inference |
config.json |
JSON | 972 B | Model hyperparameters, training config, and benchmarks |
metrics_90000.json |
JSON | 213 B | Final evaluation metrics across test splits |
icon.png |
PNG | 2.4 KB | Official 256Γ256 Christmas tree sprite icon |
showcase_36m.png |
PNG | 41.3 KB | 36-sprite widescreen showcase banner |
progression_christmas_tree.png |
PNG | 19.8 KB | 5-way checkpoint training progression |
Quickstart
Installation
pip install torch torchvision transformers pillow numpy safetensors onnxruntime sentencepiece
Python Inference (PyTorch & Safetensors)
import torch
from PIL import Image
from safetensors.torch import load_file
from nyx_v2.model import NyxRGBAHourglassDiT
from nyx_v2.sampler import sample_sprites, to_rgba_u8
from nyx_v2.text import SiglipTextEncoder, encode_empty_prompt, wrap_prompt
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# 1. Load model weights
model = NyxRGBAHourglassDiT().to(device)
state = load_file("nyx-image-36m.safetensors")
model.load_state_dict(state)
model.eval()
# 2. Encode text conditioning
encoder = SiglipTextEncoder(device=str(device))
prompt = "a christmas tree"
features = encoder.encode([wrap_prompt(prompt)])
uncond = encode_empty_prompt(encoder)
# 3. Sample 32x32 RGBA sprite (30 Heun ODE steps, CFG 4.0)
with torch.no_grad():
samples = sample_sprites(
model,
features.pool.to(device),
features.tokens.to(device),
features.mask.to(device),
uncond_pool=uncond.pool.to(device),
uncond_tokens=uncond.tokens.to(device),
uncond_mask=uncond.mask.to(device),
steps=30,
cfg=4.0,
generator=torch.Generator(device=device).manual_seed(42),
)
# 4. Save PNG with nearest-neighbor integer scaling
rgba_u8 = to_rgba_u8(samples.float())[0]
image = Image.fromarray(rgba_u8, mode="RGBA")
image.resize((256, 256), Image.Resampling.NEAREST).save("christmas_tree.png")
print("Saved christmas_tree.png (32x32 native, upscaled 8x)")
ONNX Runtime Inference
import numpy as np
import onnxruntime as ort
session = ort.InferenceSession("nyx-image-36m.onnx", providers=["CPUExecutionProvider"])
# Expected ONNX inputs:
# - x: [B, 4, 32, 32] float32
# - t: [B] float32
# - text_pool: [B, 768] float32
# - text_tokens: [B, 32, 768] float32
# - text_mask: [B, 32] bool
batch_size = 1
feeds = {
"x": np.random.randn(batch_size, 4, 32, 32).astype(np.float32),
"t": np.array([0.5], dtype=np.float32),
"text_pool": np.zeros((batch_size, 768), dtype=np.float32),
"text_tokens": np.zeros((batch_size, 32, 768), dtype=np.float32),
"text_mask": np.ones((batch_size, 32), dtype=bool),
}
outputs = session.run(["v_pred"], feeds)
v_pred = outputs[0] # Shape: (1, 4, 32, 32)
print("ONNX forward pass successful. Output shape:", v_pred.shape)
Validation Metrics (Step 90,000 / Epoch 133.7)
Evaluated on fixed validation splits from azyg0s/pixelart-172k:
- Overall Flow Validation Loss:
0.08327MSE - Patterns Split:
0.09378MSE - R6 Split:
0.10055MSE - Color Binding Split:
0.08060MSE - Unseen Subject Split:
0.10225MSE
Training Hardware
Trained on a single-GPU AWS EC2 Spot instance (g6.2xlarge, NVIDIA L4 24GB GPU, Ada Lovelace architecture) running PyTorch 2.5 with bfloat16 mixed precision and FlashAttention-2. Persistent Amazon EBS volumes were attached for dataset cache, checkpoints, and validation artifacts to preserve state across spot interruptions.
License
Nyx Image 36M 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.
Built by Bhoid at Sednium Technologies.
- Downloads last month
- 47
Dataset used to train Bhoidy/nyx-image-36m
Space using Bhoidy/nyx-image-36m 1
Evaluation results
- Validation Flow Loss on azyg0s/pixelart-172kself-reported0.08327 MSE
- Unseen Split Loss on azyg0s/pixelart-172kself-reported0.10225 MSE
- Parameters on azyg0s/pixelart-172kself-reported35989840.000