tunedailabs/myguardian-guidance
0
Stratum Backend
FastAPI server for the Stratum demo. Loads Qwen 2.5-3B-Instruct + a private LoRA adapter (tunedai/stratum-v1) trained on 4,999 Observation / Intervention / Counterfactual (Pearl's Ladder of Causation) examples. Serves an OpenAI-compatible /v1/chat/completions endpoint.
Endpoints
GET /— service infoGET /health— health checkGET /v1/models— list models (stratum,base)POST /v1/chat/completions— chat completion (see request shape)
Request
{
"model": "stratum",
"messages": [
{"role": "user", "content": "Did our trading desk's risk exposure exceed the Basel III threshold last quarter?"}
],
"max_tokens": 600,
"temperature": 0.3
}Set model: "base" to get the un-fine-tuned base model (useful for side-by-side comparisons).
Required Space secrets
HF_TOKEN— must have read access to thetunedai/stratum-v1private repo. The backend will pull the adapter from there on first request.
Local development
# After you've trained the adapter and have ./stratum-lora on disk:
STRATUM_LOCAL_ADAPTER=./stratum-lora python stratum_backend.pySource
- Training notebook:
stratum_finetune_v1.ipynbin the myguardian-guidance repo - Training data:
rungs_cladder_train.jsonl(4,999 O/I/C examples, ChatML format) - Base: Qwen 2.5-3B-Instruct
- LoRA: r=16, alpha=32, target q/k/v/o + gate/up/down
