Instructions to use namquangstudy/aaie-gft-rca-sft-8k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use namquangstudy/aaie-gft-rca-sft-8k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="namquangstudy/aaie-gft-rca-sft-8k") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("namquangstudy/aaie-gft-rca-sft-8k") model = AutoModelForCausalLM.from_pretrained("namquangstudy/aaie-gft-rca-sft-8k", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use namquangstudy/aaie-gft-rca-sft-8k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "namquangstudy/aaie-gft-rca-sft-8k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "namquangstudy/aaie-gft-rca-sft-8k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/namquangstudy/aaie-gft-rca-sft-8k
- SGLang
How to use namquangstudy/aaie-gft-rca-sft-8k 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 "namquangstudy/aaie-gft-rca-sft-8k" \ --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": "namquangstudy/aaie-gft-rca-sft-8k", "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 "namquangstudy/aaie-gft-rca-sft-8k" \ --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": "namquangstudy/aaie-gft-rca-sft-8k", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use namquangstudy/aaie-gft-rca-sft-8k with Docker Model Runner:
docker model run hf.co/namquangstudy/aaie-gft-rca-sft-8k
aaie-gft-rca-sft-8k
Full-parameter SFT of AAIE_DDense_GFT_Llama
(the GFT model β distilled base + general instruction-tuning on SmolTalk) on a root-cause-analysis
(RCA) task: given a rubric, a student submission, and that submission's assessment results, produce
a structured JSON explanation of why the student scored the way they did per criterion. Trained
with YaRN 8x context scaling baked in (8,192-token context) since RCA examples run up to ~2.1K
tokens β past the base model's native 1,024-token training length.
Training code: sft_rca/ in the
source repo (train_sft.py + data/rca_dataset.py + configs/rca_sft_llama.yaml).
Request/response contract
Two-turn chat: a system message framing the task, then a user message with the rubric, the student's full submission, and that submission's per-criterion assessment results (score + excellent/good/average/etc. rating), asking for a JSON root-cause explanation:
system: You are an educational root cause analyst. Given a rubric, a student submission, and
the assessment results, identify the root causes of the student's performance as a JSON object.
user: Domain: ...
Essay Prompt: ...
Rubric Criteria:
[C1] ... (weight NN%): ...
...
Student Submission:
...
Assessment Results (overall: NN/100, <quality>):
[C1] ...: NN/NN (<rating>)
...
Quick start
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_ID = "namquangstudy/aaie-gft-rca-sft-8k"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(MODEL_ID)
messages = [
{"role": "system", "content": "You are an educational root cause analyst. Given a rubric, "
"a student submission, and the assessment results, identify "
"the root causes of the student's performance as a JSON object."},
{"role": "user", "content": "Domain: ...\n\n...\n\nAssessment Results (overall: 78/100, Good):\n ..."},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt")
im_end_id = tokenizer.convert_tokens_to_ids("<|im_end|>")
out = model.generate(
**inputs, max_new_tokens=400, do_sample=False,
eos_token_id=[im_end_id, tokenizer.eos_token_id], pad_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Explicitly passing eos_token_id=[im_end_id, tokenizer.eos_token_id] matters β this model's
chat template ends each turn with <|im_end|>, which some tooling's default eos_token_id
doesn't include, leading to ungoverned generation past the intended stop point.
Training procedure
transformers.Trainer, full-parameter finetune (every weight, no LoRA/adapters). Prompt tokens
masked out of the loss (-100), so only the target JSON contributes. 504 RCA-task examples (454
train / 50 held-out val), learning rate 1e-5 (kept small β full-parameter update starting from an
already instruction-tuned checkpoint, on a relatively small dataset, to avoid catastrophic
forgetting), 3 epochs, cosine schedule.
Result: train loss 2.98 β 0.076, eval loss β 0.086.
Validated separately by direct generation on 20 held-out examples (not the training loss
alone): 20/20 produced valid JSON and stopped cleanly at <|im_end|> with no repetition, once
eos_token_id is passed explicitly as shown above (the upstream base model's own
generation_config.json ships a stale eos_token_id left over from a generic Llama default β
already corrected in this checkpoint's generation_config.json, but worth knowing if you ever
diff it against the base model's).
Framework versions
- Transformers: 4.57.1
- Pytorch: 2.7.1+cu118
- Tokenizers: 0.22.1
- Downloads last month
- 9
Model tree for namquangstudy/aaie-gft-rca-sft-8k
Base model
namquangstudy/aaie-ddense-gft-llama