CoolFace
Apppublic

tunedailabs/myguardian-guidance

sourceHugging Faceotherupdated 3mo agoView on Hugging Face
0likes
App README

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 info
  • —GET /health — health check
  • —GET /v1/models — list models (stratum, base)
  • —POST /v1/chat/completions — chat completion (see request shape)

Request

json
{
  "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 the tunedai/stratum-v1 private repo. The backend will pull the adapter from there on first request.

Local development

bash
# After you've trained the adapter and have ./stratum-lora on disk:
STRATUM_LOCAL_ADAPTER=./stratum-lora python stratum_backend.py

Source

  • —Training notebook: stratum_finetune_v1.ipynb in 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