Instructions to use GreenPT/shorthand-worker-v4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use GreenPT/shorthand-worker-v4 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "GreenPT/shorthand-worker-v4") - Transformers
How to use GreenPT/shorthand-worker-v4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GreenPT/shorthand-worker-v4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("GreenPT/shorthand-worker-v4", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GreenPT/shorthand-worker-v4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GreenPT/shorthand-worker-v4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GreenPT/shorthand-worker-v4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GreenPT/shorthand-worker-v4
- SGLang
How to use GreenPT/shorthand-worker-v4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "GreenPT/shorthand-worker-v4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GreenPT/shorthand-worker-v4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "GreenPT/shorthand-worker-v4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GreenPT/shorthand-worker-v4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use GreenPT/shorthand-worker-v4 with Docker Model Runner:
docker model run hf.co/GreenPT/shorthand-worker-v4
shorthand-worker-v4
LoRA adapter (r=64, 3 epochs, bf16) on Qwen3.5-9B. The worker half of the
v4 translator–worker system: a shorthand-native coding agent. It reads a
slot-marker task spec (produced by
GreenPT/shorthand-translator-v4)
and works entirely in shorthand — it never sees the English task.
Each turn it emits exactly ONE shorthand step:
| Slot | Meaning |
|---|---|
<act>read <file> |
view the sandbox file |
<act>edit <file> L<n> <fix>… |
describe the fix (code synthesized env-side) |
<test>pytest … |
run the test suite |
<done>… <test>n/n pass |
final shorthand report |
<need>… |
question back to the translator |
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE = "Qwen/Qwen3.5-9B"
tok = AutoTokenizer.from_pretrained(BASE)
base = AutoModelForCausalLM.from_pretrained(
BASE, dtype=torch.bfloat16, device_map="cuda")
model = PeftModel.from_pretrained(base, "GreenPT/shorthand-worker-v4")
model.eval()
WORKER_SYSTEM = (
"You are a coding agent that works entirely in terse shorthand. Read the "
"task and history, then emit exactly ONE next step as slot-marker "
"shorthand (<act> <fix> <test> <done> or <need> question). Keep numbers, "
"paths, identifiers verbatim. No English sentences."
)
def next_step(spec, history, max_new=192):
parts = [f"task: {spec}"]
if history:
parts.append("history:")
parts.extend(history)
parts.append("next step:")
msgs = [{"role": "system", "content": WORKER_SYSTEM},
{"role": "user", "content": "\n".join(parts)}]
ids = tok.apply_chat_template(
msgs, add_generation_prompt=True, return_tensors="pt",
return_dict=False, enable_thinking=False).to(model.device)
out = model.generate(ids, max_new_tokens=max_new, do_sample=False)
return tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True).strip()
spec = ("<goal>fix clamp in mod.py <bug>only applies lower bound, ignores "
"upper <fix>wrap w/ min() enforce hi <test>pytest test_mod.py")
print(next_step(spec, []))
# -> <act>read mod.py <fact>locate clamp
The full agentic loop (observation feeding, edit application, pytest runs,
token accounting) is implemented as run_shorthand in eval/loop_bench.py
and wrapped by the Gradio demo (demo/app.py) in the code repo.
Execution semantics (how the sandbox runs a step)
- The sandbox parses the first slot marker of the worker's turn.
<act>read/<test>map directly to file view /pytest.<act>edit … <fix>…: the<fix>line is turned into real code by a code-synthesis call to the worker model itself, and the result is patched into the sandbox. Code is payload and passes verbatim (v1 lesson: data-dominant payloads must not go through lossy compression).<done>ends the loop; the shorthand report goes to the translator for the SH→EN expansion.
Required settings
enable_thinking=False, greedy decoding (do_sample=False).- Truncate runaway generations at
\n(system|user|assistant)\n. - One base + both adapters: load this as
adapter_name="worker"next to the translator and switch withmodel.set_adapter(...)(seeGUIDE.md).
Training data
v4_worker_train.jsonl (11,532 rows) in
GreenPT/shorthand-agent-comm.
Each row: user = shorthand spec + shorthand history + sandbox observation,
assistant = next shorthand step. Scripted ground-truth trajectories
(read→edit→test→done); teacher Qwen/Qwen3.5-397B-A17B:deepinfra only
compressed the narrations.
Validation (measured)
Full 195-task held-out bench with the translator adapter (pytest-verified,
token-accounted): 60.0% task success (117/195; 54.9% on the 173 tasks
whose tests catch the bug), median 1,436 total tokens/task. Baselines on
the same tasks: vanilla 9B with a worked-example prompt reaches 79.5% at
median 293 tokens/task — the shorthand loop is ~5.3x more expensive and
19.5pp less successful than a functional English loop on this benchmark.
Per-snippet breakdown and raw records (v4_bench_heldout.jsonl,
v4_bench_heldout_a2.jsonl): see the dataset and report repos.
(Supersedes an earlier 20-task smoke claim of 100%.)
Related artifacts
| Artifact | Repo |
|---|---|
| Translator LoRA (v4) | GreenPT/shorthand-translator-v4 |
| Dataset + scripts | GreenPT/shorthand-agent-comm |
| Report + guide | GreenPT/trained-shorthand-report |
- Downloads last month
- 14