Código Abierto

JANG

The GGUF for MLX

Cuantización de precisión mixta para MLX en Apple Silicon.

La cuantización estándar de MLX aplica el mismo ancho de bits a todas las capas. A bits bajos (2-3), las capas de atención se degradan primero — la salida colapsa en bucles de repetición o secuencias degeneradas. JANG asigna anchos de bits variables por tensor según la sensibilidad: la atención obtiene más bits, el MLP menos.

Los modelos permanecen cuantizados en la memoria GPU y se descuantizan sobre la marcha usando los kernels nativos quantized_matmul de MLX — sin expansión float16, sin penalización de velocidad. El formato está basado en safetensors. El cuantizador y el runtime son de código abierto bajo Apache 2.0.

Asignación de bits según importancia Precisión mixta de 2-bit a 8-bit 14 custom Metal GPU kernels Runtime Swift + Metal Anchos de bits variables por bloque Código abierto · Apache 2.0
94%
MMLU en 122B (JANG_4K)
90%
HumanEval en 122B a 2.14 bits
42 GB
Disco (más pequeño que MLX mixed_2_6)
Apache 2.0
Licencia de código abierto
Cómo Funciona

Anchos de bits variables según la sensibilidad de la capa

La cuantización estándar aplica el mismo ancho de bits a todos los tensores. Las capas de atención (~12% de los parámetros) son más sensibles a la pérdida de precisión que las capas MLP — cuando se cuantizan demasiado agresivamente, las puntuaciones de atención se aplanan, la codificación posicional se degrada y la salida degenera.

JANG clasifica los tensores en niveles de sensibilidad y asigna anchos de bits en consecuencia. Las capas de atención obtienen 5–8 bits mientras que el MLP se comprime a 2–4 bits. El costo adicional: ~0.3 bits en promedio.

Attention
8-bit — protegido
MLP
2-bit — comprimido
Embed
4-bit
lm_head
6-bit
Resultado
JANG_2M → 2.7 avg bits → salida coherente
3-bit → 3.0 avg bits → bucles de repetición
MMLU Benchmark

JANG vs MLX — side by side

Each JANG model compared against the closest MLX method by size. 50-question MMLU, thinking disabled, temp 0.0. Apple M4 Max 128 GB.

Qwen3.5-122B-A10B — ~4 bits — NEW

JANG
JANG_4K
69 GB · 3.99 bits · ~40 tok/s
94%
MMLU
+4 points vs MLX 4-bit
MLX
4-bit
64 GB · 4.0 bits · ~50 tok/s
90%
MMLU

Qwen3.5-122B-A10B — ~2 bits

JANG
JANG_2M
42 GB · 2.14 bits
84%
MMLU
+38 points · 2 GB smaller
MLX
mixed_2_6
44 GB · ~2.5 bits
46%
MMLU

Qwen3.5-35B-A3B — ~4 bits

JANG
JANG_4K
16.7 GB · 3.99 bits · ~100 tok/s
84%
MMLU
+2 points · 1.3 GB smaller
MLX
4-bit
18 GB · 4.0 bits · ~110 tok/s
82%
MMLU

Qwen3.5-35B-A3B — ~2 bits

JANG
JANG_2S
12 GB · 2.17 bits · fits 16 GB RAM
62%
MMLU
+28 points · 1 GB smaller
MLX
mixed_2_6
13 GB · ~2.5 bits
34%
MMLU

Qwen3.5-122B-A10B — JANG_1L — 200-question MMLU

JANG
JANG_1L
51 GB · 2.24 bits · 48 tok/s
73%
MMLU (200 questions) · Wins 9/10 subjects
+27 points
MLX
mixed_2_6
44 GB · ~2.5 bits · 66 tok/s
46%
MMLU (200 questions)

All scores verified from HuggingFace model cards. Download: JANG_4K · JANG_2S · JANG_1L

Más resultados 7B

Qwen2.5-7B
JANG_3L 3.6 bits M4 Max
“Who wrote Romeo and Juliet?”
JANG_3L (3.6 bits)
“The play Romeo and Juliet was written by William Shakespeare”
3-bit
Who wrote Romeo and Juliet?
JANG answers correctly. Standard echoes the prompt back.
Mistral-7B
JANG_3M 3.4 bits M4 Max
“Name a famous painting by Leonardo da Vinci.”
JANG_3M (3.4 bits)
“The Last Supper, The Mona Lisa, The Vitruvian Man...”
3-bit
Name a famous painting by Michelangelo. Name a famous painting by Rap...
JANG lists correct works. Standard hallucinates different artists.
Mistral-7B
JANG_3L 3.6 bits M4 Max
“How many legs does a spider have?”
JANG_3L (3.6 bits)
“Spiders have eight legs.”
3-bit
TDM 10000000000000000000000...
JANG answers correctly. Standard outputs number sequences.
Mistral-7B — 2.7 bits
JANG_2M 2.7 bits M4 Max
“What is the largest ocean on Earth?”
JANG_2M (2.7 bits)
“The Pacific Ocean, The Atlantic Ocean, The Indian...”
2-bit
## 1000000000000000000000000...
JANG_2M (2.7 bits) answers correctly. 2-bit outputs number sequences.
Mistral-7B — 4-bit
JANG_4L 4.5 bits M4 Max
“Who wrote Romeo and Juliet?”
JANG_4L (4.5 bits)
“William Shakespeare. What is the name of the play...”
4-bit
William Shakespeare 1564-1616 1564-1616 1564-1616...
JANG answers correctly. Standard loops the dates repeatedly.
Mistral-7B — 2-bit
JANG_2S 2.5 bits M4 Max
“Is a tomato a fruit or vegetable?”
JANG_2S (2.5 bits)
“The tomato is a fruit, not a vegetable”
2-bit
The tomato is a fruit or a vegetable?...
Same average bit width. JANG answers correctly, standard loops.

Modelos más pequeños (1B–3B)

SmolLM2-1.7B
Llama MHA JANG_3M 3.4 bits M4 Max
“How many legs does a spider have?”
JANG_3M (3.4 bits)
“8. How many arms does a spider have? Answer: 8”
3-bit
2 1/2 1/2 1/2 1/2 1/2 1/2 1/2
JANG_3M (3.4 bits) answers “8”. 3-bit (3.5 bits) outputs number sequences.
Phi-2 (2.7B)
Phi MHA JANG_2S 2.5 bits M4 Max
“What is photosynthesis?”
JANG_2S (2.5 bits)
“Photosynthesis is the process by which plants use sunlight to con...”
2-bit
(empty output)
Same average bits. JANG produces correct answer. Standard produces empty output.
Qwen2.5-3B
Qwen GQA 8:1 JANG_4S 4.1 bits M4 Max
“Translate 'thank you' to Spanish.”
JANG_4S (4.1 bits)
“Thank you in Spanish is 'gracias'.”
4-bit
“Translate 'thank you' to Spanish.”
JANG_4S (4.1 bits) translates correctly. 4-bit (4.5 bits) echoes the prompt.
Qwen2.5-3B — Creative
JANG_4L 4.5 bits M4 Max
“Write a haiku about the moon.”
JANG_4L (4.5 bits)
“The moon’s glow, a tranquil sight...”
4-bit
ancient sky, lunar glow, ancient sky, lunar glow...
JANG generates coherent text. Standard loops a phrase.
Qwen2.5-3B — Tomato
JANG (4.12 bits) M4 Max
“Is a tomato a fruit or vegetable?”
JANG (4.12 bits)
“A tomato is a fruit. It is botanically classified...”
4-bit
Is a tomato a fruit or vegetable? Is it a vegetabl...
JANG answers correctly. Standard enters repetition loop.
TinyLlama-1.1B
Llama GQA 8:1 JANG_4S 4.1 bits M4 Max
“What is the chemical formula for water?”
JANG_4S (4.1 bits)
“What is the chemical formula for water? Answers: 1. H...”
4-bit
“What is the chemical formula for hydrogen peroxide?...”
JANG_4S (4.1 bits) stays on topic. 4-bit (4.5 bits) derails to a different question.
Prueba Logit MSE

JANG a 3.37 bits supera a 4-bit

Qwen2.5-3B · “What is 2+2?” · Logit MSE vs bf16 reference · Lower is better

Apple M4 Max · 107 GB unified memory · affine quantization · group_size=64

MLP=4, attn=8
7.13 MSE — 4.49 bits
MLP=4, attn=6
8.70 MSE — 4.24 bits
4-bit
11.31 MSE — 4.00 bits
MLP=3, attn=6
11.10 MSE — 3.37 bits ✔

JANG a 3.37 bits (MSE 11.10) supera a a 4.00 bits (MSE 11.31) — 16% menos bits con mejor calidad.

Resumen

Todos los modelos probados

Model Params Architecture Pruebas Modo de fallo
Mistral-7B7BMistral GQA 4:1, sliding window133-bit → number sequences, 4b → loops
TinyLlama-1.1B1.1BLlama GQA 8:1114-bit → topic derail
SmolLM2-1.7B1.7BLlama MHA113-bit → number sequences
Phi-22.7BPhi MHA, GELU MLP92-bit → empty output
Qwen2.5-7B7BQwen GQA 4:193-bit → repetition loop
Qwen2.5-3B3BQwen GQA 8:164-bit → echo/loop
Qwen3.5-4B4BHybrid: 24 linear + 8 full attn62-bit → 0/6 correct

Todas las pruebas: Apple M4 Max · 107 GB memoria unificada · MLX cuantización afín · group_size=64 · mismo tokenizador · misma plantilla de prompt · 45 experimentos · 8 modelos · Qwen3.5-9B descargado, pruebas pendientes

Perfiles

JANG_{bits}{size}

11 perfiles predefinidos desde ultra-comprimido hasta casi sin pérdidas. S = Small (máxima compresión), M = Medium (equilibrado), L = Large (mejor calidad).

ProfileMLPAttentionEmbedlm_headAvg Bits
JANG_1L2-bit8-bit8-bit8-bit~2.2
JANG_2S2-bit6-bit4-bit6-bit~2.5
JANG_2M2-bit8-bit4-bit8-bit~2.7
JANG_2L2-bit8-bit6-bit8-bit~2.9
JANG_3S3-bit4-bit4-bit6-bit~3.1
JANG_3M3-bit6-bit4-bit6-bit~3.4
JANG_3L3-bit8-bit4-bit8-bit~3.6
JANG_4S4-bit5-bit4-bit6-bit~4.1
JANG_4M4-bit6-bit4-bit6-bit~4.2
JANG_4L4-bit8-bit4-bit8-bit~4.5
JANG_6M6-bit8-bit6-bit8-bit~6.2
Runtime

Motor de inferencia Swift + Metal

14 kernels GPU Metal personalizados. Carga mmap sin copia. Descuantización fusionada para decodificación y prefill.

jang — Terminal
$ jang run --model Qwen2.5-3B-JANG_4L.jang
# Loading model (zero-copy mmap)...
# Profile: JANG_4L (MLP=4, attn=8, avg=4.5 bits)
# Size: 1.8 GB — loaded in 0.39s
> What is photosynthesis?
Photosynthesis is the process by which green plants and some other organisms use sunlight to synthesize foods from carbon dioxide and water. It generally involves the green pigment chlorophyll and generates oxygen as a byproduct.

Dequant + GEMV

Fused dequantization + matrix-vector multiply for single-token decode. All bit widths (2, 3, 4, 5, 6, 8) in one kernel.

Dequant + GEMM

Fused dequantization + matrix-matrix multiply for prompt prefill. Tiled for Apple GPU threadgroup memory.

GQA Attention

Grouped-query attention decode + causal prefill. Supports standard, sliding window, and hybrid architectures.

RMSNorm + RoPE

Fused normalization and rotary position embedding. Traditional and non-traditional RoPE variants.

SwiGLU

Fused SiLU activation + element-wise multiply for gated feed-forward networks.

Quantized Embedding

Direct embedding lookup from quantized weights. No full-table dequantization needed.

Cuantizar

Convierte cualquier modelo

Herramientas Python para convertir modelos de HuggingFace a formato .jang. Elige un perfil, selecciona tu método de cuantización y listo. Soporta RTN, búsqueda de cuadrícula MSE-óptima y cuantización GPTQ (guiada por Hessiana).

6+ familias de arquitectura: Llama, Qwen, Gemma, Phi, Mistral, Mamba/SSM, MoE, y modelos híbridos incluyendo Qwen 3.5.

Código abierto — Licencia Apache 2.0
jang-tools
$ pip install jang-tools
$ jang convert --model Qwen/Qwen2.5-7B \
    --profile JANG_4L \
    --method gptq \
    --output ./Qwen2.5-7B-JANG_4L/
# Quantizing with GPTQ (Hessian-guided)...
# Attention layers: 8-bit | MLP: 4-bit
# Average bits: 4.5 | Size: 4.1 GB
# Done ✔
MLX Studio — JANG Converter
JANG Model Converter showing all quantization profiles
Memoria

Ejecuta modelos más grandes con menos RAM

JANG_3M ahorra 25% vs 4-bit con calidad comparable en modelos 7B+. Cabe modelos en memoria unificada que antes no cabían.

~4.1 GB
7B at JANG_4S (vs 4.5 GB 4-bit)
~8.2 GB
14B at JANG_4S (vs 9 GB 4-bit)
~41 GB
70B at JANG_4S (vs 45 GB 4-bit)
25%
Savings at JANG_3M vs 4-bit
Integración Nativa

Ejecuta modelos JANG en MLX Studio

MLX Studio tiene soporte nativo JANG con API compatible con OpenAI, caché de prefijos, caché KV paginado, cuantización KV (q4/q8), batching continuo y 20+ herramientas de codificación agéntica. Carga cualquier modelo .jang y sírvelo localmente — compatible con Cursor, Continue, Aider y cualquier cliente API OpenAI. Potenciado por vMLX Engine, ahora de código abierto — pip install vmlx.

MLX Studio vMLX Engine