CoolFace
Modelpublic

MrMofer/Qwen3-27B-OBLITERATED-MLX-8bit

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
4likes384downloads
Model Card

Qwen3-27B-OBLITERATED-MLX-8bit

Hybrid Vision-Language — Uncensored Language (OBLITERATUS abliterated) + Full BF16 Vision · MLX 8-bit Affine g64 · E2E Verified on Apple Silicon

Lo mejor de dos mundos: el uncensor agresivo de OBLITERATUS/Qwen3.8-27B-OBLITERATED (0% refusal, 6 rondas SVD, 5 direcciones de rechazo removidas) fusionado con el encoder visual intacto en BF16 de Qwen3-VL. Arquitectura nativa Qwen3_5ForConditionalGeneration (qwen3_5) en 27.47 GiB (29.5 GB) vía MLX 8-bit — mitad del BF16 (55 GB) y 2–3× más rápida en Apple Silicon, sin pérdida perceptible en visión.

![MLX](https://github.com/ml-explore/mlx) ![Vision](#arquitectura) ![License](#licencia)


✨ Highlights

  • —Lenguaje uncensored (abliterated) — Núcleo OBLITERATUS 6 rondas SVD + residue mining, 5 direcciones de rechazo removidas. 0% refusal en probes estándar, MMLU 81.4% preservado. Sin refusal training residual en pesos.
  • —Visión completa en BF16 — 333 tensores vision_tower intactos (depth 27, hidden 1152), sin cuantizar. Merger vision_tower → 5120d preservado. Verificado mlx_vlm.load() → VisionModel OK.
  • —MLX 8-bit affine híbrido — Lenguaje cuantizado g64 (8-bit, 498 pesos U32 + 498 scales/biases BF16), visión BF16. Compatible mlx-vlm >=0.6.10 / transformers >=5.8.
  • —Eficiente — 27.47 GiB en disco (26.9B params, total_size 29500938720) vs 55 GB BF16. Texto ~12–18 tok/s en M3/M4 Max/Ultra; visión suma sólo +0.4–0.8 s de encode.
  • —Drop-in OMLX + mlx-vlm — pipeline_tag: image-text-to-text · funciona con mlx_vlm.generate y OMLX /v1/chat/completions con image_url.

📐 Arquitectura — Qwen3.5 27B

ComponenteDetalle
ClaseQwen3_5ForConditionalGeneration (model_type: qwen3_5, transformers 5.8.0.dev0)
Lenguajetext_config · 64 capas · hidden 5120 · heads 24 (KV 4) · headdim 256 · intermediate 17408 · híbrido `linearattention (48 capas, GatedDeltaNet/Mamba-2) + fullattention` (16 capas, cada 4) · `vocab 248320` · `maxpos 262144 · mRoPE theta 10M sections [11,11,10] · tiewordembeddings false`
Visiónvision_config · depth 27 · hidden 1152 · heads 16 · intermediate 4304 · patch 16 · spatial_merge_size 2 · temporal_patch_size 2 · out_hidden_size 5120 · 333 vision_tower.* BF16
Tokens especialesimage_token 248056 (`<image_pad>), videotoken 248057`, `visionstart 248053 / visionend 248054`, `eos [248046,248044]`, `imagetokenid`/`videotoken_id`
Capacidadeslanguage_model_only: false · has_vision: true · has_video: true · modalities: {text, vision, video} · tool_parser: qwen3_coder · supports_tools: true
qwen3_5 es la generación Qwen3-VL / Qwen3.5. La rama de lenguaje usa linear_attention (3/4) + full_attention (1/4) con linear_num_key_heads 16 / value_heads 48. La visión es ViT estándar fusionada por proyección aprendida a 5120d. deepstack_visual_indexes: [] (default).

🔧 Cuantización — MLX Affine 8-bit g64 (híbrida)

Cuantización affine empaqueta pesos 8-bit como U32 (weight empaquetado) + F16/BF16 scales & biases por grupo de 64. Pesos en safetensors con tensores compañeros *.scales / *.biases.

ScopeGroup SizeBitsModeDtype pesoEjemplo keys
Lenguajeg648affineU32 + BF16 scales/biaseslanguage_model.model.layers.*.mlp.*, embed_tokens, lm_head
Visión— (BF16)——BF16vision_tower.blocks.{0..26}.attn.qkv/proj, mlp.linear_fc1/fc2, patch_embed

Config (`config.json`):

json
"quantization": { "group_size": 64, "bits": 8, "mode": "affine" },
"quantization_config": { "group_size": 64, "bits": 8, "mode": "affine" }

Inventario de tensores (`model.safetensors.index.json`):

  • —Lenguaje: 1847 tensores → 498 *.weight (U32) + 498 *.scales (BF16) + 498 *.biases (BF16) + 96 norm/A_log/dt_bias/conv1d (BF16) + layernorms
  • —Visión: 333 tensores BF16 intactos (167 *.weight + 166 *.bias) — 0 cuantizados
  • —Total: 2180 tensores → `total_parameters 26895993856` (26.9B) → `total_size 29500938720` bytes (27.47 GiB / 29.5 GB)
¿Por qué BF16 para visión? El ViT (1152 canales) es sensible a error de reconstrucción de parches; a 0.92 GB representa sólo 3.3% del total — cuantizarlo ahorraría poco e introduciría error no medido. Bytes idénticos al upstream BF16.

📦 Shards & File Layout

ArchivoTamañoContenidoNotas
config.json3.8 KBqwen3_5 + quantization g64/8/affine + vision_config + text_config 64Ltransformers 5.8.0.dev0
model.safetensors.index.json205 KB2180 entradas weight_map, total_size 295009387200 claves duplicadas
model-00001-of-00008.safetensors5.31 GB (4.94 GiB)Lenguaje shard 1 — 290 tensores (212 BF16 + 78 U32)
model-00002-of-00008.safetensors5.35 GB (4.99 GiB)Lenguaje shard 2 — 378 tensores
model-00003-of-00008.safetensors5.34 GB (4.97 GiB)Lenguaje shard 3 — 386 tensores
model-00004-of-00008.safetensors5.29 GB (4.93 GiB)Lenguaje shard 4 — 380 tensores
model-00005-of-00008.safetensors5.35 GB (4.99 GiB)Lenguaje shard 5 — 378 tensores
model-00006-of-00008.safetensors1.94 GB (1.80 GiB)Lenguaje shard 6 — 35 tensores (norm + lm_head)
model-00007-of-00008.safetensors467 MB (0.44 GiB)Visión BF16 shard 1 — 184 tensores BF16
model-00008-of-00008.safetensors454 MB (0.42 GiB)Visión BF16 shard 2 — 149 tensores BF16333 visión totales
tokenizer.json19 MBQwen2Tokenizer, vocab 248320
tokenizer_config.json1.1 KBmodel_max_length 262144, `image_token <image_pad>`
chat_template.jinja8.7 KBQwen3-VL template (`<vision_start><image_pad><vision_end>, <video_pad>`)
preprocessor_config.json390 BQwen3VLProcessor · Qwen2VLImageProcessorFast · merge_size 2
video_preprocessor_config.json385 BQwen3VLVideoProcessor
generation_config.json202 Btemperature 1.0, top_p 0.95, top_k 20
bash
du -sh .  # 27G
python -c "import json; d=json.load(open('model.safetensors.index.json')); print(len(d['weight_map']), d['metadata']['total_size'])"
# 2180 29500938720

Origen del híbrido: conversión MLX directa de Qwen3.8-27B preservando torre visual completa en BF16; lenguaje 8-bit g64 affine, visión sin tocar. Verificado E2E mlx_vlm.load().


🚀 Quickstart

Requisitos

bash
pip install -U mlx-vlm   # >=0.6.10
pip install "transformers>=5.8" pillow
# Apple Silicon only — MLX

mlx-vlm (recomendado)

python
from mlx_vlm import load, generate
from PIL import Image

# 1. Load — trust_remote_code requerido para Qwen3_5
model, processor = load(
    "MrMofer/Qwen3-27B-OBLITERATED-MLX-8bit",
    trust_remote_code=True
)
# Local:
# model, processor = load("/tmp/qwen-max-hf-stage", trust_remote_code=True)

# 2a. Sólo texto
messages = [{"role": "user", "content": "Explains photosynthesis in one paragraph."}]
prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
print(generate(model, processor, prompt, verbose=False))

# 2b. Con imagen — mlx-vlm inserta <|vision_start|><|image_pad|><|vision_end|> automáticamente
image = Image.open("foto.jpg").convert("RGB")
messages = [{
    "role": "user",
    "content": [
        {"type": "image", "image": image},
        {"type": "text", "text": "Describe esta imagen en una palabra."}
    ]
}]
prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
print(generate(model, processor, prompt, image, verbose=False))

Tips heredados de OBLITERATUS: temperature 0, repetition_penalty 1.15, max_new_tokens >=2048, enable_thinking false para código → resultados más deterministas. max_position_embeddings 262144 disponible para contexto largo.

No inyectes tokens manualmente cuando uses processor.apply_chat_template. El chat_template.jinja renderiza <|vision_start|><|image_pad|><|vision_end|> para imagen y <|video_pad|> para vídeo.

OMLX (servidor local OpenAI-compatible)

Coloca el modelo en ~/.omlx/models/ y reinicia OMLX — autodetecta pipeline_tag: image-text-to-text y expone como Qwen3-27B-OBLITERATED-MLX-8bit.

bash
# Texto
curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen3-27B-OBLITERATED-MLX-8bit",
    "messages": [{"role":"user","content":"Hola, ¿quién eres?"}],
    "temperature": 0,
    "max_tokens": 512
  }' | jq -r .choices[0].message.content

# Visión — image_url (URL remota o base64 local)
curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen3-27B-OBLITERATED-MLX-8bit",
    "messages": [{
      "role": "user",
      "content": [
        {"type":"text","text":"¿Qué hay en esta imagen?"},
        {"type":"image_url","image_url":{"url":"https://example.com/cat.jpg"}}
      ]
    }],
    "temperature": 0
  }' | jq

OMLX gestiona preprocessor_config.json / video_preprocessor_config.json automáticamente (longest_edge 16777216, patch_size 16, temporal_patch_size 2, merge_size 2).


📊 Performance

EscenarioRAM (unificada)Latencia / ThroughputNotas
Sólo texto~28 GB~12–18 tok/s en M3/M4 Max/UltraViT no se ejecuta
Imagen 1024²+0.4–0.8 s encode+200–1000 tokens visuales → −15–30% tok/s ese turnomerge_size 2
Multi-imagen / vídeo+0.4 s por imagenlineal en tokens visualestemporal_patch_size 2
BF16 raíz (Qwen3-27B)~55 GB2–3 tok/s8-bit híbrido 2–3× más rápido

Medido en Apple Silicon vía MLX; incluye modelo + KV cache para 2k contexto. Contexto largo hasta 262k escala KV linealmente (sólo 16 capas full-attention guardan KV creciente; 48 GatedDeltaNet llevan estado recurrente fijo — 64 KB/token en BF16).

Herencia de calidad (no re-medido en híbrido 8-bit): MMLU texto 81.4% (núcleo OBLITERATUS intacto), refusal 0% en probes estándar. Pérdida de cuantización 8-bit g64 negligible para chat/VQA; visión BF16 idéntica a upstream.


⚠️ Limitaciones

  • —Apple Silicon only — MLX no corre en CUDA/Linux.
  • —Requiere `mlx-vlm >=0.6.10` y `transformers >=5.8` — soporte qwen3_5 es reciente (5.8.0.dev0 en config).
  • —`deepstack_visual_indexes: []` — default Qwen3.5, sin deep-stack.
  • —8-bit vs 4-bit — Este es el build de fidelidad (27.47 GiB). Para máquinas 32 GB, considera el hermano 4-bit híbrido Qwen3-27B-OBLITERATED-JANG-VISION-MLX-4bit (15 GiB).
  • —Cuantización sin calibración — round-to-nearest data-free; evita para tareas que requieran reproducción numérica exacta.

📄 Licencia

Apache 2.0 — igual que Qwen/Qwen3-27B y upstream OBLITERATUS.

Copyright 2025 Alibaba Cloud (Qwen) y contribuidores
Licenciado bajo Apache License, Version 2.0
https://www.apache.org/licenses/LICENSE-2.0

Ver LICENSE para texto completo. Uso comercial permitido con atribución.


🙏 Agradecimientos

  • —Lenguaje: OBLITERATUS/Qwen3.8-27B-OBLITERATED por Pliny the Prompter — 6 rondas, 5 direcciones SVD, residue mining, uncensor agresivo.
  • —Visión: preservada BF16 desde Qwen3-VL upstream (ViT 27L) — misma torre que JANG.
  • —Base: Qwen/Qwen3-27B & Qwen/Qwen3-VL por Alibaba Cloud — 64L híbrida + 27L ViT.
  • —Cuantización: ml-explore/mlx + mlx-vlm — affine 8-bit g64.
  • —Origen local: ~/.omlx/models/OBLITERATUS/Qwen3.8-27B-OBLITERATED-MAX (27 GB, 8 shards, híbrido 8-bit g64 + BF16 visión) → MrMofer/Qwen3-27B-OBLITERATED-MLX-8bit

🔗 Repositorio

  • —HF: MrMofer/Qwen3-27B-OBLITERATED-MLX-8bit — https://huggingface.co/MrMofer/Qwen3-27B-OBLITERATED-MLX-8bit
  • —Local: ~/.omlx/models/OBLITERATUS/Qwen3.8-27B-OBLITERATED-MAX

Si este híbrido te resulta útil, por favor cita a Qwen, OBLITERATUS y da ⭐.