Text Generation
Transformers
Safetensors
glm4_moe
legal
contract-review
document-analysis
lora
glm
conversational
Instructions to use polygramme/PolyClerk-12B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use polygramme/PolyClerk-12B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="polygramme/PolyClerk-12B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("polygramme/PolyClerk-12B") model = AutoModelForCausalLM.from_pretrained("polygramme/PolyClerk-12B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use polygramme/PolyClerk-12B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "polygramme/PolyClerk-12B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "polygramme/PolyClerk-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/polygramme/PolyClerk-12B
- SGLang
How to use polygramme/PolyClerk-12B 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 "polygramme/PolyClerk-12B" \ --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": "polygramme/PolyClerk-12B", "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 "polygramme/PolyClerk-12B" \ --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": "polygramme/PolyClerk-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use polygramme/PolyClerk-12B with Docker Model Runner:
docker model run hf.co/polygramme/PolyClerk-12B
File size: 3,098 Bytes
5ec459b 5b62943 5ec459b 5b62943 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | ---
license: mit
base_model: zai-org/GLM-4.5-Air
tags:
- legal
- contract-review
- document-analysis
- lora
- glm
library_name: transformers
pipeline_tag: text-generation
---
# PolyClerk-12B
PolyClerk-12B (12B active / 106B total MoE parameters, GLM-4.5-Air derivative) is fine-tuned for legal work product: counterparty markup
analysis, redlining, contract drafting, and clause-level document review over
very long contexts (up to 128k tokens).
## Lineage
1. **Base**: [zai-org/GLM-4.5-Air](https://huggingface.co/zai-org/GLM-4.5-Air) (MIT)
2. **Stage 1 (iter-2b)**: OAPL training on agentic tool-use trajectories
3. **Stage 2 (this model)**: LoRA fine-tune (r=32, α=64) on legal-bench work-product
tasks, merged into the stage-1 weights. This repo contains the fully merged
weights — no adapter loading required.
## Training
| | |
|---|---|
| Method | OAPL, LoRA r=32 / α=64 (merged) |
| Framework | ms-swift (Megatron backend), TP4 × CP2 |
| Hardware | 8× H200 |
| Sequence length | 131,072 |
| Epochs | 1 |
## Evaluation
On a held-out legal work-product benchmark (whole-document mode, long-context
markup/review tasks), this model scores comparably to frontier closed models on
the small evaluated task set. Numbers are from a limited sample (N=3 task
families) — treat as indicative, not definitive.
⚠️ **Contamination note**: this model was trained on tasks drawn from the LAB
legal benchmark family. Do not use LAB (or derivative benchmarks) to evaluate
this model.
## Usage
Requires ~200GB of weights (bf16). Serve with vLLM:
```bash
vllm serve polygramme/PolyClerk-12B --tensor-parallel-size 4 --max-model-len 131072
```
Or load with transformers (multi-GPU required):
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("polygramme/PolyClerk-12B")
model = AutoModelForCausalLM.from_pretrained("polygramme/PolyClerk-12B", device_map="auto", torch_dtype="bfloat16")
```
The chat template is included (`chat_template.jinja`).
## Intended use & limitations
Intended for legal document analysis workflows (markup review, redline
drafting, provision-level analysis). Outputs are not legal advice; a qualified
lawyer must review all work product. The model may hallucinate section
references or values on documents unlike its training distribution — verify
against source documents.
## Training data attribution
Fine-tuned on tasks from [harvey-labs](https://github.com/harveyai/harvey-labs)
(MIT License, © 2026 Harvey AI). The MIT permission notice is reproduced here in
accordance with the license:
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction [...] subject to inclusion of the above
> copyright notice and this permission notice in all copies or substantial
> portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
> OF ANY KIND.
## License
MIT, following the GLM-4.5-Air base license. © the model authors.
|