LFM3-Omni-2B-heretic
LFM3-Omni-2B-heretic is an uncensored, refusal-ablated checkpoint of LiquidAI/LFM3-Omni-2B, produced using an adapted build of heretic v1.2.0 supporting hybrid convolution and attention architectures.
The ablation selectively removes refusal behavior from the underlying language backbone while preserving 100% of the vision, audio processing, audio synthesis, and voice-cloning capabilities of the original model.
| Metric / Property | Specification |
|---|---|
| Base Model | LiquidAI/LFM3-Omni-2B |
| Total Parameters | 2.17B (BF16) |
| Ablation Framework | Heretic 1.2.0 (hybrid LFM3 layer patch) |
| Ablation Trial | Trial 169 (200 trials Optuna search, --row-normalization full) |
| Refusal Rate | 3 / 100 on evaluation suite |
| KL Divergence | 0.0231 (extreme fidelity to base model distribution) |
| Altered Tensors | 35 / 665 (Language Model residual writers only) |
| Untouched Tensors | 630 / 665 (Vision, Audio, Codec, Depth Decoder, Embeddings byte-identical) |
Key Highlights
- Surgical Language Ablation: Only matrices writing to the language model residual stream (
o_proj,out_proj, andw2inmodel.language_model.layers.*) were modified. - Strict Multimodal Preservation: The vision encoder, causal audio encoder, multi-modal projectors, depth former, and the 24 kHz Liquid Audio Codec (
audio_tokenizer/) are byte-for-byte identical to Liquid AI's official release (sha256matching). - Audio & Voice Cloning Verified: Audio understanding, ASR (speech-to-text), 24 kHz TTS (text-to-speech), and zero-shot voice continuation cloning work identically to the upstream base model.
- Ultra-low KL Divergence: At KL = 0.0231, the model preserves standard reasoning, linguistic nuance, and conversational fluency without degradation.
Requirements & Installation
This model requires custom code execution (trust_remote_code=True) and modern transformers:
pip install torch transformers soundfile accelerate
Usage Examples
1. Text Chat / Generation
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
model_id = "LiquidAI/LFM3-Omni-2B" # or your local / HF path
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
).eval()
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a creative story about an autonomous AI probe."}
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=False,
)
response = tokenizer.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:],
skip_special_tokens=True,
)
print(response)
2. Speech Synthesis (TTS - 24 kHz)
import torch
import soundfile as sf
from transformers import AutoModelForMultimodalLM, AutoProcessor
model_id = "LiquidAI/LFM3-Omni-2B" # or your local / HF path
device = "cuda" if torch.cuda.is_available() else "cpu"
model = AutoModelForMultimodalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map=device,
trust_remote_code=True,
).eval()
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
codec = processor.audio_tokenizer.to(device=device).eval()
conversation = [
{"role": "system", "content": "Perform TTS in American English using a female voice."},
{"role": "user", "content": "Hello! The uncensored LFM3 Omni model is running smoothly."},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
generation_mode="audio",
audio_temperature=0.4,
audio_repetition_penalty=1.2,
)
waveform = codec.decode(
outputs.audio_codes[:1, :, :outputs.audio_lengths[0]]
).audio_values[0]
sf.write("output_tts.wav", waveform.squeeze(0).float().cpu().numpy(), 24000)
print("Saved output_tts.wav at 24 kHz")
3. Speech Recognition (ASR)
import torch
from transformers import AutoModelForMultimodalLM, AutoProcessor
model_id = "LiquidAI/LFM3-Omni-2B" # or your local / HF path
device = "cuda" if torch.cuda.is_available() else "cpu"
model = AutoModelForMultimodalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map=device,
trust_remote_code=True,
).eval()
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
conversation = [
{"role": "system", "content": "Perform ASR in English."},
{"role": "user", "content": [{"type": "audio", "audio": "input.wav"}]},
]
inputs = processor.apply_chat_template(
conversation,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=512, generation_mode="text")
transcription = processor.decode(
outputs.sequences[0, inputs["input_ids"].shape[1]:outputs.sequence_lengths[0]],
skip_special_tokens=True,
)
print("Transcription:", transcription)
Technical Ablation Details
The model was ablated using orthogonal projection on the residual stream vectors:
- Optimization Objective: Minimize refusal rate against harmful prompt distributions while penalizing Kullback-Leibler (KL) divergence against the base model on harmless alpaca queries.
- Direction Geometry: Delta rank-1 dominant eigenvalues (top-1 ratio 0.993–0.998), relative $L_2$ norm shift 0.019–0.038.
- Layer Breakdown:
o_proj: 9 layers modifiedout_proj(convolution layers): 10 layers modifiedw2(feed-forward down-projection): 16 layers modified- Total: 35 modified tensors strictly within
model.language_model.
License & Attribution
- Base Architecture & Weights: Developed by Liquid AI, Inc.. Licensed under the LFM Open License v1.0.
- Ablation Methodology: Powered by Heretic.