Text Generation
PEFT
Safetensors
GGUF
qwen2
lora
qlora
sft
unsloth
trl
hammerstein
strategic-reasoning
ollama
conversational
Instructions to use lerugray/hammerstein-7b-framework with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use lerugray/hammerstein-7b-framework with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-7B-Instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "lerugray/hammerstein-7b-framework") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use lerugray/hammerstein-7b-framework with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf lerugray/hammerstein-7b-framework:Q4_K_M # Run inference directly in the terminal: llama cli -hf lerugray/hammerstein-7b-framework:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf lerugray/hammerstein-7b-framework:Q4_K_M # Run inference directly in the terminal: llama cli -hf lerugray/hammerstein-7b-framework:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf lerugray/hammerstein-7b-framework:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf lerugray/hammerstein-7b-framework:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf lerugray/hammerstein-7b-framework:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf lerugray/hammerstein-7b-framework:Q4_K_M
Use Docker
docker model run hf.co/lerugray/hammerstein-7b-framework:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use lerugray/hammerstein-7b-framework with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lerugray/hammerstein-7b-framework" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lerugray/hammerstein-7b-framework", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lerugray/hammerstein-7b-framework:Q4_K_M
- Ollama
How to use lerugray/hammerstein-7b-framework with Ollama:
ollama run hf.co/lerugray/hammerstein-7b-framework:Q4_K_M
- Unsloth Studio
How to use lerugray/hammerstein-7b-framework with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for lerugray/hammerstein-7b-framework to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for lerugray/hammerstein-7b-framework to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for lerugray/hammerstein-7b-framework to start chatting
- Pi
How to use lerugray/hammerstein-7b-framework with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lerugray/hammerstein-7b-framework:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "lerugray/hammerstein-7b-framework:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use lerugray/hammerstein-7b-framework with Docker Model Runner:
docker model run hf.co/lerugray/hammerstein-7b-framework:Q4_K_M
- Lemonade
How to use lerugray/hammerstein-7b-framework with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull lerugray/hammerstein-7b-framework:Q4_K_M
Run and chat with the model
lemonade run user.hammerstein-7b-framework-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use lerugray/hammerstein-7b-framework with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lerugray/hammerstein-7b-framework:Q4_K_M
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 lerugray/hammerstein-7b-framework:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use lerugray/hammerstein-7b-framework with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf lerugray/hammerstein-7b-framework:Q4_K_M
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 "lerugray/hammerstein-7b-framework:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Restore full model card (the GGUF push had overwritten it with the Unsloth stub)
Browse files
README.md
CHANGED
|
@@ -1,23 +1,127 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
-
-
|
| 4 |
-
-
|
|
|
|
| 5 |
- unsloth
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
-
- For text only LLMs: `llama-cli -hf lerugray/hammerstein-7b-framework --jinja`
|
| 15 |
-
- For multimodal models: `llama-mtmd-cli -hf lerugray/hammerstein-7b-framework --jinja`
|
| 16 |
|
| 17 |
-
|
| 18 |
-
-
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
This was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth)
|
| 23 |
-
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: unsloth/Qwen2.5-7B-Instruct-bnb-4bit
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
license: apache-2.0
|
| 6 |
tags:
|
| 7 |
+
- lora
|
| 8 |
+
- qlora
|
| 9 |
+
- sft
|
| 10 |
- unsloth
|
| 11 |
+
- trl
|
| 12 |
+
- hammerstein
|
| 13 |
+
- strategic-reasoning
|
| 14 |
+
- gguf
|
| 15 |
+
- ollama
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# Hammerstein-7B Framework β a small, opinionated strategic-reasoning model
|
| 19 |
+
|
| 20 |
+
A QLoRA adapter on `Qwen2.5-7B-Instruct` that bakes the
|
| 21 |
+
[Hammerstein framework](https://github.com/lerugray/hammerstein) into the
|
| 22 |
+
weights via behavior cloning. Load base + adapter, run inference **with no
|
| 23 |
+
system prompt at all**, and you get framework-correct strategic reasoning:
|
| 24 |
+
it names which failure quadrant a plan sits in (clever-lazy /
|
| 25 |
+
clever-industrious / stupid-industrious / stupid-lazy), pairs claims with
|
| 26 |
+
counter-observations, and proposes structural fixes over discipline fixes.
|
| 27 |
+
|
| 28 |
+
This is the **framework-only public artifact** (refreshed 2026-06-05). It is
|
| 29 |
+
trained on a framework-corpus distillation **with zero personal data** β the
|
| 30 |
+
training set was deterministically scrubbed and passed an adversarial
|
| 31 |
+
multi-agent privacy sweep before release. (Ongoing personal-corpus
|
| 32 |
+
fine-tuning of the author's daily-driver continues privately and is not
|
| 33 |
+
published here.)
|
| 34 |
+
|
| 35 |
+
## What it does that frontier assistants are tuned *not* to do
|
| 36 |
+
|
| 37 |
+
The framework deliberately reinforces three behaviors the big labs train
|
| 38 |
+
toward agreeableness and away from:
|
| 39 |
+
|
| 40 |
+
- **Refusal-with-pathway** β when the right answer is "don't do this," it
|
| 41 |
+
says so, and surfaces what *would* unblock a yes, instead of a flat no or
|
| 42 |
+
a reluctant yes.
|
| 43 |
+
- **Hold-your-ground** β it does not sycophantically fold when you push back
|
| 44 |
+
with confidence but no new evidence. It restates the structural reason and
|
| 45 |
+
tells you exactly what evidence would change its call.
|
| 46 |
+
- **Refuse stupid-industrious** β it declines to validate a confidently-stated
|
| 47 |
+
plan that works hard in the wrong direction; it names the quadrant and
|
| 48 |
+
offers a verification gate + structural alternative.
|
| 49 |
+
|
| 50 |
+
## Training data (framework-only, 1,994 pairs)
|
| 51 |
+
|
| 52 |
+
| Source | Pairs | What |
|
| 53 |
+
|---|---|---|
|
| 54 |
+
| Strategic (scrubbed v3a corpus) | 1,708 | audit-this-plan / scope-this-idea / is-this-worth-doing / what-should-we-do-next / review-from-different-angle, across 12 generic domains |
|
| 55 |
+
| Unique-behavior reinforcement | 72 | the three doctrine behaviors above (24 each) |
|
| 56 |
+
| Off-domain instruction-following | 214 | suppresses catastrophic forgetting (keeps general competence) |
|
| 57 |
+
|
| 58 |
+
Teacher: Qwen3.6-plus running the Hammerstein framework prompt (no corpus
|
| 59 |
+
retrieval, neutralized persona β clean by construction). Behavior-cloning
|
| 60 |
+
frame: **no system prompt in the training targets** β the framework is what
|
| 61 |
+
the student learns to bake in.
|
| 62 |
+
|
| 63 |
+
## Eval (framework-discipline benchmark, 2026-06-05)
|
| 64 |
+
|
| 65 |
+
Structural framework-correctness on 40 held-out strategic prompts
|
| 66 |
+
(higher = more framework-correct), and an out-of-domain forgetting check
|
| 67 |
+
on 30 prompts (framework-vocab leakage into off-domain answers; lower =
|
| 68 |
+
healthier):
|
| 69 |
+
|
| 70 |
+
| Condition | Strategic (n=40) | OOD leakage (n=30) |
|
| 71 |
+
|---|---|---|
|
| 72 |
+
| **student** (this adapter, **no system prompt**) | **0.975** | **0.000** |
|
| 73 |
+
| ablation (base + framework system prompt) | 0.675 | 0.783 |
|
| 74 |
+
| vanilla (base Qwen2.5-7B alone) | 0.081 | 0.000 |
|
| 75 |
+
|
| 76 |
+
**Adapter wins (Ξ=+0.300 vs the prompt-only ablation) β the framework
|
| 77 |
+
lives in the weights, not just a runtime prompt.** OOD leakage is 0.000:
|
| 78 |
+
the distillation adds framework discipline with no measurable
|
| 79 |
+
catastrophic forgetting. Note the prompt-only ablation actually *leaks*
|
| 80 |
+
framework vocabulary into off-domain answers (0.783) where the distilled
|
| 81 |
+
student does not β the student fires the framework when the task calls
|
| 82 |
+
for it and stays quiet when it doesn't.
|
| 83 |
+
|
| 84 |
+
The framework-fidelity axis is partly tautological (the rubric rewards
|
| 85 |
+
framework vocabulary by design); the load-bearing signal is that the
|
| 86 |
+
distillation carries the *discipline* into 7B weights with no runtime
|
| 87 |
+
scaffolding, and does not wreck general competence (forgetting β 0).
|
| 88 |
+
|
| 89 |
+
## Usage
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
from peft import PeftModel
|
| 93 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 94 |
+
|
| 95 |
+
base = "Qwen/Qwen2.5-7B-Instruct"
|
| 96 |
+
tok = AutoTokenizer.from_pretrained(base)
|
| 97 |
+
model = AutoModelForCausalLM.from_pretrained(base, device_map="auto")
|
| 98 |
+
model = PeftModel.from_pretrained(model, "lerugray/hammerstein-7b-framework")
|
| 99 |
+
|
| 100 |
+
msgs = [{"role": "user", "content": "Audit this plan: rewrite our API gateway from scratch in Rust to fix latency."}]
|
| 101 |
+
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
| 102 |
+
print(tok.decode(model.generate(ids, max_new_tokens=600)[0][ids.shape[1]:], skip_special_tokens=True))
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
No system prompt needed. Runs locally on an 8 GB GPU at zero per-call cost.
|
| 106 |
+
|
| 107 |
+
### Run it with Ollama (GGUF)
|
| 108 |
+
|
| 109 |
+
A `Q4_K_M` GGUF (4.68 GB) and a `Modelfile` ship in this repo, so you can run it
|
| 110 |
+
with no Python at all:
|
| 111 |
+
|
| 112 |
+
```
|
| 113 |
+
ollama run hf.co/lerugray/hammerstein-7b-framework:Q4_K_M
|
| 114 |
+
```
|
| 115 |
|
| 116 |
+
Or with llama.cpp directly: `llama-cli -hf lerugray/hammerstein-7b-framework --jinja`.
|
| 117 |
|
| 118 |
+
## What this is not
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
Not a general-purpose frontier replacement. It is tuned for framework-shaped
|
| 121 |
+
strategic-reasoning tasks; generalization to neutral benchmarks (math, code,
|
| 122 |
+
long-context) is untested. The **framework is the IP**; this adapter is the
|
| 123 |
+
portability proof β a small owned model that holds an opinionated reasoning
|
| 124 |
+
doctrine you can run yourself.
|
| 125 |
|
| 126 |
+
Built alongside [hammerstein.ai](https://hammerstein.ai). Framework + corpus:
|
| 127 |
+
[github.com/lerugray/hammerstein](https://github.com/lerugray/hammerstein).
|
|
|
|
|
|