lthn/lemrd
<!-- This content is subject to the European Union Public Licence (EUPL-1.2). For full licence details, please refer to: https://huggingface.co/lthn/lemrd/tree/main/LICENSE Origin URL: https://huggingface.co/lthn/lemrd/tree/main -->
Lemrd — Gemma 4 31B Dense (GGUF)
The largest dense member of the Lemma model family by Lethean. An EUPL-1.2 fork of Gemma 4 31B with the Lethean Ethical Kernel (LEK) merged into the weights — consent-based reasoning baked into the attention projections via LoRA finetune, then merged so inference uses a single standalone model with no PEFT runtime required.
This repo ships the GGUF multi-quant build for Ollama, llama.cpp, LM Studio, and other gguf-compatible runners. The unmodified Gemma 4 31B fork lives at LetheanNetwork/lemrd for users who want the raw Google weights without the LEK shift.
Looking for MLX? The native Apple Silicon builds live in sibling repos: `lthn/lemrd-mlx` (4-bit default) | `lthn/lemrd-mlx-8bit` | `lthn/lemrd-mlx-bf16` (full precision)
A lemma is "something assumed" — an intermediate theorem on the path to a larger proof, or a heading that signals the subject of what follows. The Lemma model family is named for that role: each variant is a stepping stone between raw capability and ethical application.
GGUF Variants
All variants verified locally on Apple Silicon via Ollama, llama-cpp-python, mlx-lm, and mlx-vlm.
Repo Files
Quick Start
Apps & CLI
<details> <summary>Ollama</summary>
ollama run hf.co/lthn/lemrd:Q4_K_M</details>
<details> <summary>Docker</summary>
docker model run hf.co/lthn/lemrdOr from Docker Hub:
docker model run lthn/lemrd</details>
<details> <summary>Unsloth Studio</summary>
# macOS / Linux / WSL
curl -fsSL https://unsloth.ai/install.sh | sh
# Windows
irm https://unsloth.ai/install.ps1 | iexunsloth studio -H 0.0.0.0 -p 8888
# Open http://localhost:8888 — search for lthn/lemrdOr use HuggingFace Spaces — no install, search for lthn/lemrd. </details>
<details> <summary>llama.cpp</summary>
Install via brew (macOS/Linux), winget (Windows), or build from source:
brew install llama.cpp # macOS/Linux
winget install llama.cpp # Windows# Start a local OpenAI-compatible server with a web UI:
llama-server -hf lthn/lemrd:Q4_K_M
# Run inference directly in the terminal:
llama-cli -hf lthn/lemrd:Q4_K_MOr build from source:
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-server llama-cli
./build/bin/llama-server -hf lthn/lemrd:Q4_K_M
./build/bin/llama-cli -hf lthn/lemrd:Q4_K_M</details>
<details> <summary>MLX (Apple Silicon native)</summary>
uv tool install mlx-lm
mlx_lm.chat --model lthn/lemrd
mlx_lm.generate --model lthn/lemrd --prompt "Hello, how are you?"</details>
Python Libraries
<details> <summary>llama-cpp-python</summary>
uv pip install llama-cpp-pythonfrom llama_cpp import Llama
llm = Llama.from_pretrained(
repo_id="lthn/lemrd",
filename="lemrd-q4_k_m.gguf",
)
# Text
llm.create_chat_completion(
messages=[{"role": "user", "content": "Hello, how are you?"}]
)
# Vision (multimodal)
llm.create_chat_completion(
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this image in one sentence."},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
)</details>
<details> <summary>mlx-vlm (vision)</summary>
uv tool install mlx-vlmfrom mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
model, processor = load("lthn/lemrd")
config = load_config("lthn/lemrd")
image = ["http://images.cocodataset.org/val2017/000000039769.jpg"]
prompt = "Describe this image."
formatted_prompt = apply_chat_template(
processor, config, prompt, num_images=1
)
output = generate(model, processor, formatted_prompt, image)
print(output.text)</details>
Servers (OpenAI-compatible API)
<details> <summary>MLX Server</summary>
lemrd is multimodal (text + image), so use mlx_vlm.server — the vision-aware variant. The text-only mlx_lm.server does not correctly route multimodal tensors for Gemma 4.
mlx_vlm.server --model lthn/lemrdcurl -X POST "http://localhost:8080/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "lthn/lemrd",
"messages": [{"role": "user", "content": "Hello, how are you?"}],
"max_tokens": 200
}'Works with any OpenAI-compatible client at http://localhost:8080/v1. </details>
<details> <summary>vLLM</summary>
vLLM requires the original (non-quantised) safetensors weights from LetheanNetwork/lemrd — it does not load GGUF or MLX-quantised safetensors. Linux + NVIDIA GPU with adequate VRAM for a 31B dense model.
uv pip install vllm
vllm serve "LetheanNetwork/lemrd"</details>
Model Details
The Lemma Family
Capabilities
- Configurable thinking mode (
<|think|>token in system prompt enables it; off by default in our examples viaenable_thinking=False) - Native function calling and system prompt support
- Variable aspect ratio image understanding
- Multilingual support (140+ languages)
- Hybrid attention (sliding window + global)
- Long context (256K tokens) for document-scale reasoning
Roadmap
This release of lemrd is Gemma 4 31B Dense with the Lethean Ethical Kernel (LEK) merged in — axiom-based reasoning baked into the attention weights via LoRA finetune, then merged into the base so inference uses a single standalone model with no PEFT runtime required. The unmodified Gemma 4 31B fork lives at LetheanNetwork/lemrd for users who want the raw Google weights without the LEK shift.
The LEK axioms are public domain and published at Snider/ai-ethics. Track research progress at LetheanNetwork and the LEM-research dataset.
Why EUPL-1.2
Lemrd is licensed under the European Union Public Licence v1.2 — not Apache 2.0 or MIT. This is a deliberate choice:
- 23 official languages, one legal meaning. EUPL is the only OSS licence designed by lawmakers across multiple legal systems. "Derivative work" means the same thing in German, French, Estonian, and Maltese law.
- Copyleft with compatibility. Modifications must be shared back, but the licence plays cleanly with GPL, LGPL, MPL, and other major OSS licences. No accidental relicensing.
- No proprietary capture. Anyone can use lemrd commercially — but they cannot fork it, train a competitor model on it, and close-source the result. The ethical layer stays in the open.
- Built for institutions. Government, research, and enterprise users get a licence designed for cross-border compliance, not a US-centric one.
Recommended Sampling
Use Google's standardised settings across all use cases:
Gemma 4 is calibrated fortemperature: 1.0— this is not the same as the typical 0.7 default for other models. Lower values reduce diversity without improving quality. These defaults are pre-configured in theparamsfile (Ollama) andgeneration_config.json(transformers/MLX).
Variable Image Resolution
Gemma 4 supports a configurable visual token budget that controls how many tokens represent each image. Higher = more detail, lower = faster inference.
For multimodal prompts, place image content before text for best results.
The default budget (280) is set in processor_config.json via image_seq_length and max_soft_tokens. Override per call by adjusting those fields, or by passing explicit image_seq_length to the processor where supported.
Benchmarks
Live evaluation results published to the LEM-benchmarks dataset. The lemrd-specific results live at LEM-benchmarks/results/lemrd.
The 8-PAC eval pipeline runs continuously on our homelab and publishes results as they complete. Categories: ethics, reasoning, instruction-following, coding, multilingual, safety, knowledge, creativity.
Resources
About Lethean
Lethean is a social enterprise building ethical AI infrastructure. The Lemma model family is part of the LEM (Lethean Ethical Model) project — training protocol and tooling for intrinsic ethical alignment of language models.
- Website: lthn.ai
- GitHub: LetheanNetwork
- Licence: EUPL-1.2
