CoolFace
Modelpublic

lthn/lemrd

sourceHugging Faceeupl-1.2updated 5mo agoView on Hugging Face
0likes144downloads
Model Card

<!-- 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

FileQuantSizeUse Case
lemrd-q4_k_m.ggufQ4KM17 GBRecommended — best size/quality balance
lemrd-q5_k_m.ggufQ5KM20 GBHigher quality, moderate size
lemrd-q6_k.ggufQ6_K23 GBNear-lossless
lemrd-q8_0.ggufQ8_030 GBMaximum quality quantised
lemrd-bf16.ggufBF1657 GBFull precision reference

All variants verified locally on Apple Silicon via Ollama, llama-cpp-python, mlx-lm, and mlx-vlm.

Repo Files

FileFormatPurpose
lemrd-*.ggufGGUFOllama, llama.cpp, GPT4All, LM Studio
model-*-of-00006.safetensorsMLX safetensors (sharded)Native Apple Silicon via mlx-lm and mlx-vlm (Q4 multimodal)
model.safetensors.index.jsonJSONTensor index for the sharded safetensors weights
config.jsonJSONMultimodal model config (architecture, quantisation, vision tower)
tokenizer.jsonJSONTokenizer vocabulary (262K tokens)
tokenizer_config.jsonJSONTokenizer settings and special tokens
chat_template.jinjaJinja2Chat template for transformers, mlx-lm, mlx-vlm
processor_config.jsonJSONImage processor config (mlx-vlm)
generation_config.jsonJSONDefault generation parameters (temperature, topp, topk)
LICENSETextEUPL-1.2 licence text
README.mdMarkdownThis file — model card

Quick Start

Apps & CLI

<details> <summary>Ollama</summary>

bash
ollama run hf.co/lthn/lemrd:Q4_K_M

</details>

<details> <summary>Docker</summary>

bash
docker model run hf.co/lthn/lemrd

Or from Docker Hub:

bash
docker model run lthn/lemrd

</details>

<details> <summary>Unsloth Studio</summary>

bash
# macOS / Linux / WSL
curl -fsSL https://unsloth.ai/install.sh | sh

# Windows
irm https://unsloth.ai/install.ps1 | iex
bash
unsloth studio -H 0.0.0.0 -p 8888
# Open http://localhost:8888 — search for lthn/lemrd

Or 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:

bash
brew install llama.cpp        # macOS/Linux
winget install llama.cpp      # Windows
bash
# 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_M

Or build from source:

bash
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>

bash
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>

bash
uv pip install llama-cpp-python
python
from 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>

bash
uv tool install mlx-vlm
python
from 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.

bash
mlx_vlm.server --model lthn/lemrd
bash
curl -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.
bash
uv pip install vllm
vllm serve "LetheanNetwork/lemrd"

</details>

Model Details

PropertyValue
ArchitectureGemma 4 31B Dense
Total Parameters30.7B
Layers42
Context Length256K tokens
Vocabulary262K tokens
ModalitiesText, Image
Sliding Window1024 tokens
Vision Encoder~550M params
Base ModelLetheanNetwork/lemrd
LicenceEUPL-1.2

The Lemma Family

NameSource (BF16 weights)ParamsContextModalitiesConsumer Repo
LemerLetheanNetwork/lemer2.3B eff128KText, Image, Audiolthn/lemer
LemmaLetheanNetwork/lemma4.5B eff128KText, Image, Audiolthn/lemma
LemmyLetheanNetwork/lemmy3.8B active256KText, Imagelthn/lemmy
LemrdLetheanNetwork/lemrd30.7B256KText, ImageYou are here

Capabilities

  • Configurable thinking mode (<|think|> token in system prompt enables it; off by default in our examples via enable_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.

PhaseStatusWhat it adds
Base fork (LetheanNetwork/lemrd)✅ ReleasedEUPL-1.2 fork of Gemma 4 31B — unmodified Google weights
LEK merged (this repo)✅ ReleasedLethean Ethical Kernel — axiom-based reasoning via LoRA merge
8-PAC eval results🚧 In progressContinuous benchmarking on the homelab, published to lthn/LEM-benchmarks

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:

ParameterValue
temperature1.0
top_p0.95
top_k64
stop`<turn>, <eos>`
Gemma 4 is calibrated for temperature: 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 the params file (Ollama) and generation_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.

Token BudgetUse Case
70Classification, captioning, video frame processing
140General image understanding
280Default — balanced quality and speed
560OCR, document parsing, fine-grained detail
1120Maximum detail (small text, complex documents)

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

ResourceLink
Benchmark resultslthn/LEM-benchmarks
LiveBench resultslthn/livebench
Research noteslthn/LEM-research
Lemma model collectionlthn/lemma

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.