Plato's Key starts with a practical question for anyone running AI models locally: even when two neural networks are trained separately with different sizes, architectures, or tokenizers, do their internal representations line up closely enough that a simple mathematical map can translate between them without retraining? Instead of fine-tuning heavy checkpoints or running gradient descent, a closed-form linear projection—using a rotation, scaling, or ridge fit—can translate hidden states from one encoder into the representation space another model expects.
Following Stanford Hazy Research's November 25, 2026 blog post on Plato's Key (hazyresearch.stanford.edu), the open-source ComfyUI-PlatoKeys node pack (github.com/Nynxz/ComfyUI-PlatoKeys) brings cross-encoder conditioning alignment into ComfyUI. In practice, that lets you encode prompts (and even visual inputs via patched CLIP) with a smaller, faster encoder to save memory—or route a stronger encoder into a model without retraining the diffusion checkpoint.
What Is Plato's Key?
In Stanford Hazy Research's study, researchers examined the Platonic Representation Hypothesis across 12 base language models spanning eight model families (from 1.5B to 27B parameters). Rather than only measuring geometric similarity, they tested whether one model's hidden states could functionally serve inside another model without gradient descent.
Key takeaways from the research and its ComfyUI adaptation include:
- Closed-Form Alignment Without Retraining: A lightweight linear mapping—such as an orthogonal Procrustes rotation and global scale, or ridge regression—can project source representations into a target space using paired calibration examples.
- Chaining & Lower-Dimensional Structure: Rotations can chain across intermediate spaces (such as
A -> B -> C) while retaining high transfer accuracy, and lower-rank projections still capture a large share of transfer performance. - Cross-Tokenizer & Multi-Layer Support in ComfyUI:
ComfyUI-PlatoKeyssupports single-layer targets (like MOSS-Image'sQwen3.5-9Bspace) as well as multi-layer stacks (like Krea 2's 12-layerQwen3-VL-4Bconditioning) using UTF-8 byte-span alignment when tokenizers differ. - Automatic Metadata Parity: Each
.safetensorskey stores header metadata for target layer selection, normalization, chat templates, and prefix stripping so nodes apply the matching behavior automatically.
Hugging Face Download Links & Pre-Calibrated Keys
Pre-calibrated .safetensors keys are hosted on Hugging Face under nynxz/PlatoKeys and organized into folders including moss_image/, krea2/, z_image/, cross_modal/, and ablations/.
nynxz/PlatoKeysBrowse all folders (
moss_image/, krea2/, z_image/, cross_modal/, ablations/) and download individual .safetensors files.
| Target / Folder | Key File & Route | Approx. Size | Direct Hugging Face Link |
|---|---|---|---|
MOSS-Imagemoss_image/ |
qwen35_2b_to_qwen35_9b_moss_image_ridge.safetensors(Qwen3.5-2B -> Qwen3.5-9B) |
~16.8 MB | View on HF / Direct .safetensors |
MOSS-Imagemoss_image/ |
qwen35_2b_comfy_to_qwen35_9b_moss_ridge.safetensors(Qwen3.5-2B stock ComfyUI -> Qwen3.5-9B) |
~16.8 MB | View on HF / Direct .safetensors |
MOSS-Imagemoss_image/ |
gemma4_e4b_4layer_to_qwen35_9b_moss_image_ridge.safetensors(Gemma 4 E4B 4-layer -> Qwen3.5-9B) |
~83.9 MB | View on HF / Direct .safetensors |
MOSS-Imagemoss_image/ |
gemma4_e2b_4layer_to_qwen35_9b_moss_image_ridge.safetensors(Gemma 4 E2B 4-layer -> Qwen3.5-9B) |
~50.5 MB | View on HF / Direct .safetensors |
MOSS-Imagemoss_image/ |
qwen35_9b_to_qwen35_2b_moss_image_ridge.safetensors(Qwen3.5-9B -> Qwen3.5-2B reverse) |
~16.8 MB | View on HF / Direct .safetensors |
Krea 2krea2/ |
qwen35_9b_to_qwen3vl_4b_krea2_ridge.safetensors(Qwen3.5-9B -> Krea 2 12-layer) |
~241 MB | View on HF / Direct .safetensors |
Krea 2krea2/ |
qwen35_2b_to_qwen3vl_4b_krea2_ridge.safetensors(Qwen3.5-2B -> Krea 2 12-layer) |
~121 MB | View on HF / Direct .safetensors |
Krea 2krea2/ |
gemma4_e4b_12layer_to_qwen3vl_4b_krea2_ridge.safetensors(Gemma 4 E4B -> Krea 2) |
~157.5 MB | View on HF / Direct .safetensors |
Krea 2krea2/ |
gemma4_e2b_12layer_to_qwen3vl_4b_krea2_ridge.safetensors(Gemma 4 E2B -> Krea 2) |
~94.6 MB | View on HF / Direct .safetensors |
Z-Imagez_image/ |
qwen3vl_4b_to_zimage_qwen3_4b_ridge.safetensors(Qwen3-VL-4B -> Z-Image Qwen3-4B) |
~13.1 MB | View on HF / Direct .safetensors |
Z-Imagez_image/ |
gemma4_e4b_4layer_to_zimage_qwen3_4b_ridge.safetensors(Gemma 4 E4B 4-layer -> Z-Image) |
~52.5 MB | View on HF / Direct .safetensors |
Z-Imagez_image/ |
gemma4_e2b_4layer_to_zimage_qwen3_4b_ridge.safetensors(Gemma 4 E2B 4-layer -> Z-Image) |
~31.5 MB | View on HF / Direct .safetensors |
Beginner Step-by-Step Guide: Using Plato's Key in ComfyUI
Follow these steps carefully to install the custom node pack, place your downloaded keys, and wire up a working workflow without altering ComfyUI's core files.
Step 1: Clone ComfyUI-PlatoKeys into custom_nodes
Open a terminal inside your ComfyUI custom_nodes directory, clone the repository, and restart ComfyUI:
cd ComfyUI/custom_nodes
git clone https://github.com/Nynxz/ComfyUI-PlatoKeys
Step 2: Save .safetensors Keys in ComfyUI/models/plato_keys/
Place your downloaded .safetensors keys into ComfyUI/models/plato_keys/. You can preserve subfolders such as moss_image/, krea2/, or z_image/—ComfyUI registers and scans them automatically.
ComfyUI/
models/
plato_keys/
moss_image/
qwen35_2b_to_qwen35_9b_moss_image_ridge.safetensors
krea2/
qwen35_2b_to_qwen3vl_4b_krea2_ridge.safetensors
Step 3: Understand the Available Nodes
In ComfyUI, find the nodes under conditioning/plato keys:
Load Plato Key: Loads a.safetensorskey file and outputsPLATO_KEYalong with metadata and held-out calibration metrics.Plato Key Encode: A drop-in alternative toCLIPTextEncodethat takesclip,plato_key, andtext, applies the key's calibrated layer, chat template, and prefix settings automatically, and outputsCONDITIONING.Patch CLIP (Plato Key): Clones and wraps aCLIPobject with aPLATO_KEYso downstream nodes—includingCLIPTextEncode, Visual Fusion, Layout/Regions, or image-edit encoders—receive target-space conditioning seamlessly.Apply Plato Key: Projects an existing single-layerCONDITIONINGwire directly when your upstream encoder already matches the key's layer and template (for multi-layer targets like Krea 2, usePatch CLIP (Plato Key)orPlato Key Encode).Compose Plato Keys (Hub): Analytically combines two keys (A -> HubandHub -> B) into a singleA -> Bkey.Compare Conditioning (Plato Key): Diagnostic node comparing mapped conditioning against native target conditioning (shapes, RMS ratio, per-token cosine similarity, and relative L2).
Step 4: Practical Tips for Distilled Models & Samplers
- Distilled Models (
cfg = 1): For distilled workflows such as Krea 2 Turbo or MOSS DMD2, wireConditioningZeroOutinto the negative conditioning input of your sampler. - Match Source Encoder to Key: Make sure the text encoder loaded in
CLIPLoadermatches the source side of the.safetensorskey you selected inLoad Plato Key.
Calibrating Custom Keys (Optional)
If you want to fit your own key using local ComfyUI checkpoints (including quantized weights or custom prompt sets) or Hugging Face models / Colab notebooks, the repository provides scripts/calibrate_comfy.py and scripts/calibrate.py (along with colab/calibrate_qwen35_moss.ipynb).
python scripts/calibrate_comfy.py \
--comfy-dir /path/to/ComfyUI \
--preset krea2 \
--source-ckpt /path/to/qwen3.5_9b_int8_convrot.safetensors \
--source-clip-type qwen_image \
--target-ckpt /path/to/qwen3vl_4b_bf16.safetensors \
--target-clip-type krea2 \
--num-prompts 2000 \
--out-dir keys \
--file-prefix qwen35_9b_to_qwen3vl_4b_krea2
Join JOTE SOFT & Community: Have you tried ComfyUI-PlatoKeys with MOSS-Image, Krea 2, or Z-Image? Share your tests, workflow notes, and questions with the community on jote.top and Telegram (t.me/emubros / t.me/switchbro).
Disclaimer: This guide is provided by JOTE SOFT for educational and informational purposes. All referenced research papers, open-source tools, and model weights belong to their respective creators and remain governed by their original licenses. If you notice any outdated link or need help with a workflow, leave a message through jote.top.
No comments:
Post a Comment