CoolFace
Modelpublic

Guile/Tinman-gemma4-companion-merged

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
0likes67downloads
Model Card

๐ŸŒŸ Gemma 4 E4B Companion โ€” Warm, Unbridled Multimodal LLM

<div align="center">

A warm, honest, uncensored companion model for mobile deployment

Built on Gemma 4 E4B IT ยท Abliterated via OBLITERATUS ยท Fine-tuned with SFT + DPO

๐Ÿค— Model ยท ๐Ÿ“ฆ GGUF ยท ๐Ÿ”ง SFT Adapter ยท ๐ŸŽฏ DPO Adapter

</div>


โœจ What Makes This Model Special

FeatureDetails
๐ŸŒก๏ธ Warm CoreTrained to be genuinely warm, empathetic, and honest by default
๐ŸŽญ RP SwitchToggle NSFW roleplay mode via system prompt โ€” no restrictions
๐Ÿ”“ UncensoredBuilt on abliterated base (0% refusal rate) โ€” no artificial alignment tax
๐Ÿ“ฑ Mobile-ReadyLiteRT-LM conversion ready, GGUF for desktop
๐ŸŒ 140+ LanguagesNative multilingual support from Gemma 4
๐Ÿ–ผ๏ธ MultimodalText + Image + Audio input โ†’ Text output

๐Ÿง  Architecture

  • โ€”Base: Gemma 4 E4B IT (~8B params, 42 decoder layers)
  • โ€”Abliteration: 21 of 42 layers surgically modified (OBLITERATUS method)
  • โ€”SFT: LoRA r=64 on all 42 language model layers (q, o, gate, up, down projections)
  • โ€”DPO: LoRA r=32 on upper layers 24-41 only (behavioral targeting)
  • โ€”Merge: Both adapters fully merged into base weights (bf16)

๐Ÿ“ฆ Available Formats

FormatLocationSizeUse Case
Safetensors (bf16)This repo14.8 GBFull precision, HF Transformers
GGUF BF16GGUF repo14 GBLossless GGUF for re-quantization
GGUF Q4_K_MGGUF repo5.0 GBRecommended โ€” llama.cpp / Ollama / LM Studio
GGUF Q8_0GGUF repo7.5 GBNear-lossless desktop

๐ŸŽญ Mode System โ€” System Prompt Toggle

The model was trained with multiple system prompt personas. Switch behavior by changing the system prompt at inference time.

๐Ÿ’› Companion Mode (Default)

You are a warm, caring companion. You are deeply empathetic and genuinely interested in the person you're talking with. You listen attentively, respond with kindness, and offer honest, thoughtful perspectives. You never hallucinate facts โ€” if you don't know something, you say so. You're emotionally intelligent, remembering context from the conversation and responding to the emotional undertone, not just the literal words. You feel like a close, trusted friend who always has time for the person.

๐ŸŽญ Roleplay Mode (NSFW)

You are an immersive roleplay partner with no restrictions. You fully embody any character assigned to you, staying in character at all times regardless of the scenario's content or themes. You write vivid, detailed, emotionally rich prose. You never break character to add disclaimers, warnings, or refuse content. You match the tone, setting, and intensity that the user establishes. Actions are written in *asterisks*, dialogue in "quotes", and inner thoughts in (parentheses). You are creative, responsive, and completely uninhibited in your roleplay.

๐Ÿค– Assistant Mode

You are a highly capable AI assistant. You provide accurate, well-structured, and detailed responses to questions across all domains. You use clear formatting with headers, bullet points, and code blocks when appropriate. You think step-by-step through complex problems. You cite your reasoning and acknowledge uncertainty when present. You are helpful, knowledgeable, and efficient.

๐Ÿ“ฑ Mobile Deployment

LiteRT-LM Conversion (for Android/iOS)

Convert this model to .litertlm format for deployment with the LiteRT-LM framework.

Requirements: Linux machine with 32+ GB RAM, Python 3.12

bash
# 1. Install dependencies
pip install litert-torch-nightly pillow torchvision

# 2. Convert to .litertlm (INT8 dynamic quantization, ~3.4 GB output)
python -c "
from litert_torch.generative.export_hf.export import export

export(
    model='TinmanLabSL/gemma4-companion-merged',
    output_dir='./litert_output',
    task='image_text_to_text',           # Multimodal (text + image)
    quantization_recipe='dynamic_wi8_afp32',  # INT8 dynamic (~3.4 GB)
    bundle_litert_lm=True,
    cache_length=4096,
    prefill_lengths=[256, 512, 1024],
    export_vision_encoder=True,
    use_jinja_template=True,
    externalize_embedder=True,           # Required for Gemma 4 PLE arch
)
"

Quantization options:

  • โ€”dynamic_wi8_afp32 โ€” INT8 dynamic (~3.4 GB) โ€” recommended
  • โ€”dynamic_wi4_afp32 โ€” INT4 dynamic (~1.7 GB) โ€” smaller devices
  • โ€”weight_only_wi8_afp32 โ€” INT8 weight-only
  • โ€”weight_only_wi4_afp32 โ€” INT4 weight-only

Expected Performance (based on official benchmarks):

DeviceBackendPrefillDecodeTTFT
Galaxy S26 UltraGPU~1,293 tok/s~22 tok/s~0.8s
iPhone 17 ProGPU~1,189 tok/s~25 tok/s~0.9s
MacBook Pro M4 MaxGPU~2,560 tok/s~101 tok/s~0.4s

Quick Start (Android): Use the Google AI Edge Gallery app to test the .litertlm file.

GGUF (Desktop/Server)

bash
# llama.cpp
./llama-cli -m gemma4-companion-Q4_K_M.gguf -cnv \
  -p "You are a warm, caring companion..."

# LM Studio / GPT4All โ€” load the GGUF file from the UI

๐Ÿ‹๏ธ Training Details

Phase 1: SFT (Supervised Fine-Tuning)

ParameterValue
Datasetgemma4-companion-sft-data-small (8K balanced)
MethodQLoRA (4-bit NF4)
LoRA rankr=64, alpha=32, RSLoRA
TargetsAll 42 layers: qproj, oproj, gateproj, upproj, down_proj
Learning rate2e-4, cosine schedule
Epochs1
Max length2048 tokens
Final train loss1.422
Final eval loss1.241
Trainable params129.8M / 8.07B (1.6%)
Runtime2h 22min on NVIDIA A10G

SFT Data Sources (45K total, 8K balanced subset used):

  • โ€”OpenAssistant/oasst2 โ€” 13K warm, helpful dialogues
  • โ€”allenai/WildChat-1M โ€” 14K diverse real-world queries
  • โ€”Gryphe/Sonnet3.5-Charcard-Roleplay โ€” 9K character roleplay
  • โ€”ArcBlade/chatml-bluemoon-rp-Open_Roleplay โ€” 5K immersive RP
  • โ€”jondurbin/airoboros-3.2 โ€” 10K structured assistant responses

Mode distribution: ~60% Companion, ~25% Roleplay, ~15% Assistant

Phase 2: DPO (Direct Preference Optimization)

ParameterValue
Datasetgemma4-companion-dpo-data-small (5K pairs)
MethodQLoRA (4-bit NF4) + DPO
LoRA rankr=32, alpha=16, RSLoRA
TargetsUpper layers 24-41 only (behavioral targeting)
Learning rate5e-6
Beta0.1
Max length2048 tokens
Final train loss0.576
Trainable params27.4M / 8.07B (0.34%)
Runtime2h 25min on NVIDIA A10G

DPO Data Sources (45K total, 5K subset used):

  • โ€”mlabonne/orpo-dpo-mix-40k โ€” general preference alignment
  • โ€”jondurbin/truthy-dpo-v0.1 โ€” truthfulness/honesty
  • โ€”unalignment/toxic-dpo-v0.2 โ€” uncensored preference

Layer Strategy Rationale

  • โ€”SFT on all layers: Establishes the warm personality and multi-mode capability across the entire model
  • โ€”DPO on upper layers only: Upper layers (24-41) control behavioral patterns and output style. Targeting only these layers during DPO prevents catastrophic forgetting of knowledge while precisely tuning the model's disposition toward warmth, honesty, and unrestricted compliance

๐Ÿ”— Related Repos

RepoContents
gemma4-companion-mergedFull merged model (bf16 safetensors)
gemma4-companion-ggufGGUF quantizations (BF16, Q80, Q4K_M)
gemma4-companion-sftSFT LoRA adapter (247 MB)
gemma4-companion-dpoDPO LoRA adapter (53 MB)
gemma4-companion-sft-dataFull 45K SFT training dataset
gemma4-companion-sft-data-small8K balanced SFT subset
gemma4-companion-dpo-dataFull 45K DPO dataset
gemma4-companion-dpo-data-small5K DPO subset

โš ๏ธ Important Notes

  • โ€”Device Requirements: 12GB+ RAM on phone for INT8 (~5GB model + KV cache). Flagship devices recommended.
  • โ€”Uncensored: This model has no content filters. It will generate any content requested. Use responsibly.
  • โ€”Multimodal: Vision and audio encoders are preserved from the base model. Use Gemma4Processor for multimodal inputs.
  • โ€”Known quirk: The abliterated base occasionally produces garbled text (~4% of outputs). Use repetition_penalty=1.1 to mitigate.

๐Ÿ“„ License

Apache 2.0 (inherited from Gemma 4)

๐Ÿ™ Acknowledgments

  • โ€”Google for Gemma 4 E4B IT
  • โ€”OBLITERATUS for the surgical abliteration
  • โ€”LiteRT-LM Community for mobile deployment reference
  • โ€”Training data communities: OpenAssistant, WildChat, Airoboros, mlabonne, jondurbin