Instructions to use beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32
Run Hermes
hermes
- Atomic Chat
beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32
This model beezu/G4-MeroMero-v2-31B-mlx-5bit-gs32 was converted to MLX format from zerofata/G4-MeroMero-v2-31B using mlx-lm version 0.31.3.
About this quant
Uses group size of 32.
Original Model Card
Mero Mero v2
Gemma4 31BA finetune of Gemma 4 31B designed for creative tasks, particularly narrative RP. Intended to be a more creative version of G4-MeroMero-31B.
This model is the result of a lot of experimentation and learning. Trying to make Gemma 4 more creative without destroying the intelligence is... difficult. To put it mildly.
Heavily inspired by a few research papers, StoryScope: Investigating idiosyncrasies in AI fiction and particularly Elias in the Lighthouse, Again?. Measuring these narrative tics and attractors against simple prompts seems to be a good way to target the model's slop and kick start giving Gemma 4 some diversity: anything that repeatedly occurs across generations of such a generic prompt is something the model is overusing.
Compared to the original, swipes are notably more diverse and feel less like Gemma. RP slop is measurably lower (at least for the type of slop I measure). IFEval / GSM8K / MMLU-Pro are the same as stock with no obvious degradation. The only intelligence drop I've really noticed so far is when you get a swipe that goes a bit hot.
Supports both thinking and non thinking. Reasoning averages longer than stock Gemma 4, but shorter than MeroMero v1.
| Mero Mero v2 | Mero Mero v1 | Stock Gemma 4 | |
|---|---|---|---|
| Swipe diversity — given an RP conversation, generate 8 swipes and evaluate how varied the beats in those swipes are, GLM-judged with a rubric. | |||
| Thinking off | 0.72 | 0.57 | 0.43 |
| Thinking on | 0.62 | 0.49 | 0.32 |
| Slop & attractors — lower is better | |||
| Slop per 1k words, RP replies | 15.5 | 18.0 | 18.5 |
| Slop per 1k words, stories | 7.4 | 8.3 | 8.8 |
| Bare-prompt stories hitting an attractor | 66% | 98% | 99% |
| Top attractor markers — each model's six most frequent, stories containing each of 144 | |||
| #1 | Tuesday · 28 | Elias · 96 | Elias · 102 |
| #2 | Arthur · 20 | Tuesday · 81 | Tuesday · 90 |
| #3 | Elias · 19 | Clara · 57 | Clara · 80 |
| #4 | Leo · 16 | Oakhaven · 46 | Oakhaven · 60 |
| #5 | Elara · 14 | Arthur · 21 | Thorne · 23 |
| #6 | Clara · 14 | Leo · 20 | Arthur · 16 |
| Thinking length — words per think block, RP replies; shorter is better | |||
| Mean / median | 341 / 305 | 382 / 342 | 263 / 253 |
| General benchmarks — thinking off; IFEval & GSM8K full, MMLU-Pro 40q per category | |||
| IFEval | 90.2 | 89.8 | 89.8 |
| GSM8K | 97.0 | 96.1 | 96.7 |
| MMLU-Pro | 85.5 | 85.4 | 84.6 |
Creation Process: SFT > Merge > GRPO > GRPO > on-policy SFT
Stage 1 — Diversity SFT. Stock Gemma 4 collapses hard on underspecified creative prompts ("Write a story." basically always gives clockmaker or memory related stories in a shop with Elias). Trained on ~4,000 short stories curated against the storyscope narrative prompts and found attractors. The dataset is a mix of human stories and synthetic stories from a set of frontier models, with diverse generation prompts swapped out for generic ones and filtered for quality. I also included some of the usual creative instruct and roleplay data. The model came out alright. Creative, but notably worse at instruction following with degraded intelligence. SLERP-merged back into the original instruct at t=0.5, which basically reverted it to stock Gemma 4 with slightly improved prose and creativity (similar to MeroMero).
Stage 2 — Creative GRPO (with think disabled). TRL GRPO (via Axolotl), 8 rollouts per prompt on the same bare prompts. Reward stack: LLM-judge diversity and coherence rewards, an attractor-marker penalty seeded from stock and then updated with whatever started appearing as new attractors during training, narrative-rate penalties and deterministic degeneracy guards (checking for non-Latin characters, joined words etc). 300 steps.
Stage 3 — RP logic GRPO (with think enabled). 100 further steps on multi-turn roleplay contexts: a thinking check to ensure it always parsed correctly, a logic-defect judge (DeepSeek-V4 Flash with a rubric), per-context attractor lists mined from k=8 baselines of the stage 2 model, and the same degeneracy checks as stage 2.
Stage 4 — On-policy multi-outcome RP SFT. ~3,300 samples the model wrote itself on roleplay contexts, filtered to keep only varied continuations. The model wasn't able to produce diverse results purely on-policy, so a natural response was generated first, then each sample went through a GLM-5.2 critique pipeline: error detection, plus steering ideas injected as OOC commands for re-generation (DeepSeek-V4-Pro / GLM-5.2 alternating). Everything was then filtered for errors, slop and any degeneracy as usual. Roughly 60% of samples include thinking. Last turn only.
Trained using Axolotl.
Stage 1 — Diversity SFT Config (Axolotl)
base_model: google/gemma-4-31B-it
plugins:
- axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin
- axolotl.integrations.liger.LigerPlugin
liger_layer_norm: true
liger_rope: true
liger_rms_norm: true
liger_glu_activation: true
liger_rms_norm_gated: true
strict: false
cut_cross_entropy: true
datasets:
- path: ./data/diversity_sft_masked.jsonl
val_set_size: 0
output_dir: ./G4-31B-SFT-v10-2
sequence_len: 8192
pad_to_sequence_len: true
sample_packing: true
adapter: lora
lora_r: 64
lora_alpha: 64
peft_use_rslora: true
lora_dropout: 0.0
freeze_mm_modules: true
lora_target_modules: 'model.language_model.layers.[\d]+.(_checkpoint_wrapped_module.)?(mlp|self_attn).(up|down|gate|q|k|v|o)_proj'
gradient_accumulation_steps: 1
micro_batch_size: 4
num_epochs: 2
optimizer: adamw_torch_fused
lr_scheduler: cosine
learning_rate: 1e-5
max_grad_norm: 1.0
warmup_ratio: 0.1
weight_decay: 0.05
saves_per_epoch: 2
bf16: auto
tf32: true
# FA2 not supported
sdp_attention: true
flash_attention: false
fsdp_config:
fsdp_version: 2
offload_params: false
cpu_ram_efficient_loading: false
auto_wrap_policy: TRANSFORMER_BASED_WRAP
transformer_layer_cls_to_wrap: Gemma4TextDecoderLayer
state_dict_type: FULL_STATE_DICT
sharding_strategy: FULL_SHARD
reshard_after_forward: true
activation_checkpointing: true
Stage 1 — Mergekit Config
merge_method: slerp
base_model: google/gemma-4-31B-it
models:
- model: google/gemma-4-31B-it
- model: ApocalypseParty/G4-31B-SFT-v10-2
parameters:
t: 0.5
dtype: bfloat16
Stage 2 — Creative GRPO Config (Axolotl)
base_model: /workspace/models/configCA # stage 1 output
rl: grpo
trl:
reward_funcs:
- rewards_g4.reward_judge_diversity
- rewards_g4.reward_judge_coherence
- rewards_g4.reward_attractor
- rewards_g4.reward_narrative
- rewards_g4.reward_sane
reward_weights: [3.0, 3.0, 0.75, 1.0, 1.0]
beta: 0.02
num_generations: 8
max_completion_length: 1600
temperature: 1.0
use_vllm: true
scale_rewards: true
loss_type: grpo
epsilon: 0.2
generation_kwargs:
stop_token_ids: [1, 106, 50]
top_k: 64
top_p: 0.95
datasets:
- path: /workspace/data/sft_train_final.jsonl
type: ebft_chat.transform
sequence_len: 2048
micro_batch_size: 2
gradient_accumulation_steps: 4
max_steps: 200
learning_rate: 4.0e-6
optimizer: adamw_torch_fused
lr_scheduler: cosine
warmup_steps: 10
weight_decay: 0.01
adapter: lora
lora_r: 64
lora_alpha: 64
peft_use_rslora: true
lora_dropout: 0.0
freeze_mm_modules: true
lora_target_modules: 'model.language_model.layers.[\d]+.(_checkpoint_wrapped_module.)?(mlp|self_attn).(up|down|gate|q|k|v|o)_proj'
max_grad_norm: 1.0
bf16: auto
tf32: true
sdp_attention: true
flash_attention: false
gradient_checkpointing: true
# shipped weights use checkpoint-100 of this run
Stage 3 — RP Logic GRPO Config (Axolotl)
base_model: /workspace/models/r4b100 # stage 2 output
rl: grpo
trl:
reward_funcs:
- rewards_rp.reward_thinking # format gate on the think block
- rewards_rp.reward_logic # constraint-grounded defect judge
- rewards_rp.reward_attractor # frozen per-context lists from stock k=8
- rewards_rp.reward_sane # deterministic glitch guards
reward_weights: [2.0, 3.0, 1.0, 1.0]
beta: 0.02
num_generations: 8
max_completion_length: 2560
temperature: 1.0
use_vllm: true
scale_rewards: true
loss_type: grpo
epsilon: 0.2
generation_kwargs:
stop_token_ids: [1, 106, 50]
top_k: 64
top_p: 0.95
datasets:
- path: /workspace/rp/rp3_train.jsonl
type: ebft_chat.transform
sequence_len: 8192
micro_batch_size: 1
gradient_accumulation_steps: 8
max_steps: 100
learning_rate: 3.0e-6
optimizer: adamw_torch_fused
lr_scheduler: cosine
warmup_steps: 10
weight_decay: 0.01
adapter: lora
lora_r: 64
lora_alpha: 64
peft_use_rslora: true
lora_dropout: 0.0
freeze_mm_modules: true
lora_target_modules: 'model.language_model.layers.[\d]+.(_checkpoint_wrapped_module.)?(mlp|self_attn).(up|down|gate|q|k|v|o)_proj'
max_grad_norm: 1.0
bf16: auto
tf32: true
sdp_attention: true
flash_attention: false
gradient_checkpointing: true
Stage 4 — On-Policy Multi-Outcome SFT Config (Axolotl)
base_model: ApocalypseParty/G4-31B-r4b100-GRPO-rp100 # stage 3 output
plugins:
- axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin
- axolotl.integrations.liger.LigerPlugin
liger_layer_norm: true
liger_rope: true
liger_rms_norm: true
liger_glu_activation: true
liger_rms_norm_gated: true
strict: false
cut_cross_entropy: true
datasets:
- path: ./data/g4_onpolicy_rp_masked.jsonl
val_set_size: 0
output_dir: ./G4-31B-r4b100-GRPO-rp100-sft
sequence_len: 8192
pad_to_sequence_len: true
sample_packing: true
adapter: lora
lora_r: 64
lora_alpha: 64
peft_use_rslora: false
lora_dropout: 0.0
freeze_mm_modules: true
lora_target_modules: 'model.language_model.layers.[\d]+.(_checkpoint_wrapped_module.)?(mlp|self_attn).(up|down|gate|q|k|v|o)_proj'
gradient_accumulation_steps: 2
micro_batch_size: 1
num_epochs: 1
optimizer: adamw_torch_fused
lr_scheduler: cosine
learning_rate: 4e-5
max_grad_norm: 1.0
warmup_ratio: 0.1
weight_decay: 0.05
saves_per_epoch: 2
bf16: auto
tf32: true
# FA2 not supported
sdp_attention: true
flash_attention: false
fsdp_config:
fsdp_version: 2
offload_params: false
cpu_ram_efficient_loading: false
auto_wrap_policy: TRANSFORMER_BASED_WRAP
transformer_layer_cls_to_wrap: Gemma4TextDecoderLayer
state_dict_type: FULL_STATE_DICT
sharding_strategy: FULL_SHARD
reshard_after_forward: true
activation_checkpointing: true
- Downloads last month
- 170
5-bit