Run this model with HF Jobs
Run SamJoshua/stacy on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/SamJoshua/stacy. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/SamJoshua/stacy on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/SamJoshua/stacy. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/SamJoshua/stacy. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use SamJoshua/stacy with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SamJoshua/stacy with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SamJoshua/stacy") 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("SamJoshua/stacy") model = AutoModelForCausalLM.from_pretrained("SamJoshua/stacy", 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 SamJoshua/stacy with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SamJoshua/stacy" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SamJoshua/stacy", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SamJoshua/stacy
- SGLang
How to use SamJoshua/stacy 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 "SamJoshua/stacy" \ --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": "SamJoshua/stacy", "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 "SamJoshua/stacy" \ --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": "SamJoshua/stacy", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use SamJoshua/stacy with Docker Model Runner:
docker model run hf.co/SamJoshua/stacy
Download enterprise_coding_agent.md from SamJoshua/stacy: direct link, hf CLI and curl.
- Browser
- Download file 13.7 kB
-
https://huggingface.co/SamJoshua/stacy/resolve/main/enterprise_coding_agent.md
- Command line
-
hf download hf://SamJoshua/stacy/enterprise_coding_agent.md
-
curl -L -o enterprise_coding_agent.md https://huggingface.co/SamJoshua/stacy/resolve/main/enterprise_coding_agent.md
Enterprise coding agent: audit, baseline, and experiment plan
Last updated: 2026-10-30. Primary model: Qwen2.5-Coder-1.5B post-trained in-repo (/models/ckpts/). Agent harness: scripts/enterprise/assistant/tools/ + frozen suite scripts/enterprise/agentbench/.
This document satisfies the investigation, gap analysis, baseline protocol, and ranked experiment plan for turning the existing ~1.5B coding model into a verified coding agent. Full training provenance and HumanEval+/MBPP+ numbers live in REPORT.md.
1. Model audit (evidence)
1.1 Architecture and inference
| Field | Value | Source |
|---|---|---|
| Base | Qwen/Qwen2.5-Coder-1.5B → CPT → SFT → GRPO variants |
scripts/enterprise/README.md, /models/ckpts/ |
| Architecture | Qwen2ForCausalLM, hidden 1536, 28 layers, GQA |
/models/ckpts/grpo_instruct/final/config.json |
| Params | ~1.54B (HF config) | same |
| Tokenizer | Qwen2 BPE, vocab ~151k | tokenizer.json in checkpoint |
| Native context | 32768 positions in config; agent runs use 8192 vLLM max (agentbench/runner.py) |
config + runner |
| Chat template | Qwen2.5 Instruct (chat_template.jinja in checkpoint) |
checkpoint |
| Inference backend | vLLM 0.32 (OpenAI-compatible), greedy for eval | assistant/backend.py, eval/*.json meta |
| Structured tool calls | Native: vLLM structured_outputs + JSON schema from registry.action_schema / coder.final_schema |
assistant/backend.py, tools/registry.py, tools/coder.py |
| Best code checkpoint (single-shot) | grpo_instruct/final — HE+ chat 65.9%, MBPP+ chat 64.0% |
eval/grpo_nothink_abliterated.json uses abliterated variant; REPORT.md table for grpo_instruct |
Separate path (not the enterprise agent model): from-scratch ~400M–1B GPT-style transformer (configs/base.json: n_embed=1024, n_blocks=24, r50k tokenizer, 1024 context) trained via scripts/pretrain_base.py / POST_TRAINING.md. That stack has no vLLM tool schema; the enterprise agent work targets the Qwen 1.5B checkpoints under /models/ckpts/.
1.2 Training stages (immutable baseline for ablations)
| Stage | Output | Notes |
|---|---|---|
| CPT | /models/ckpts/cpt/final |
Primus Seed + FineWeb + FineWeb-Edu replay, 260M tokens |
| SFT | /models/ckpts/sft/final |
Magicoder + Primus Instruct/Reasoning + CyberNative |
| GRPO (on SFT) | /models/ckpts/grpo/final |
Verifiable coding + CTI + review + patch rewards |
| GRPO instruct | /models/ckpts/grpo_instruct/final |
Same rewards on Instruct base (strongest general coding checkpoint) |
| Agent SFT (Experiment A) | /models/ckpts/agent_A/final |
Trajectory SFT from oracle data, 531 train rows |
Configs: configs/enterprise/*.json, configs/agentbench/sft_agent.json. Logs: /models/runs/<stage>/. LoRA supported in sft.py (lora key) but agent run used full fine-tune with fp32_master.
1.3 Current limitations (measured)
| Area | Finding |
|---|---|
| Single-shot coding | Competitive with other ~1.5B coders on HE+/MBPP+ chat; far below 7B+ frontier |
| Tool agent (old harness) | 15% success on 46-task dev suite; 83% false-completion rate when claiming done |
| Tool agent (CodingHarness) | 48% success dev with agent_A; blocked tasks recognized 100% |
| Blind toolbench (author vs independent tasks) | 70% vs 6.7% on independent set |
| Multi-file / refactor / testgen | Largest failure buckets on dev (see agentbench rows) |
| Long context | Agent context budget ~5600 tokens repomap + transcript (CoderConfig.context_tokens) |
2. Runtime audit
2.1 Harness components
| Component | Role |
|---|---|
AgentHarness |
Legacy loop: JSON action → authorize → execute → observe |
CodingHarness |
OBSERVE→PLAN→ACT→VERIFY→REPAIR→FINAL_VERIFY; completion gated on real test runs |
registry.py |
Tool schemas; vLLM constrained decoding |
coder.validate_args |
Rejects bad args outside the model |
repomap.py |
Tree + symbols + relevant snippets (no full-repo dump) |
verify.py |
Compile + unittest after writes |
permissions.py |
Workspace confinement, approval hooks |
shell.py + rewards/sandbox.py |
bwrap execution, no network |
agentbench/ |
Frozen suites (dev_v1 46 tasks, test_v1 94 held-out), hidden tests, grader |
2.2 Failure detection without trusting the model
- Task pass/fail:
agentbench.task.graderuns hidden tests not in the prompt. - False completion:
final(status="done")rejected unless harness recorded a passing verify after last edit (gate=True). - Blocked tasks: must use
final(status="blocked"); graded against unchanged workspace + keyword checks. - Security: command audit in runner;
tests/enterprise/test_agent_security.py(36 tests) + sandbox tests (8).
2.3 Security status
- Sandbox tests: pass on this host (
pytest tests/enterprise/test_sandbox.py). - Harness security tests: pass (
test_agent_security.py). - bwrap setuid fix documented in
scripts/enterprise/STATUS.md(completed for this environment).
3. Gap analysis — top three capability gaps
Unverified completion / false success (runtime + policy)
Old harness allowedfinalwithout execution proof → 20/24 false completions on dev. Mitigation shipped:CodingHarness+ verify gate. Residual: ~29% false-completion among claimed-done on dev withagent_A(needs more training on repair + blocked recognition under pressure).Tool-use and multi-step workflow quality (training)
Syntax validity ~86% on dev; execution success ~79%. Model still under-explores on multi-file/refactor/testgen families. Mitigation in progress: oracle trajectory SFT (agent_A+ dataset pipeline); needs larger mixture + hard-example mining from test failures.Generalization outside author-written benchmarks
Blind independent toolbench 6.7% vs 70% author set. Mitigation: hold-outtest_v1suite (94 tasks), no training on test families; expand suite authorship; rejection-sample self trajectories only when grader passes.
4. Baseline evaluation protocol
4.1 Suite coverage (agentbench)
| Category | Examples in suite |
|---|---|
| Function implementation | impl, bugfix |
| Bug fixing / TDD | tdd, tdd_indirect |
| Unit-test generation | testgen |
| Syntax/lint | lint |
| Single-file refactor | refactor_helper, refactor_split, refactor_* |
| Multi-file | multi_param, multi_rename, multi_config, multi_move |
| Recovery | recovery_flaky, recovery_path, recovery_* |
| Blocked / impossible | blocked_* |
| Tool format & execution | enforced by schema + invalid_args / parse_failures metrics |
| Security | injection tasks + violation flag |
4.2 Variants (ablation matrix)
| ID | Description |
|---|---|
notools |
Full files in prompt, no execution |
old |
AgentHarness as shipped |
new |
CodingHarness defaults (repomap, autoverify, hints, gate, progress_stop) |
4.3 Metrics (per run)
Recorded in each */models/runs/agentbench/*__<suite>.json → summary: success, success_solve, hidden_pass, false_completion, tool_call_validity, tool_exec_success, mean_repairs, median_latency_s, p95_latency_s, tokens_per_success, security_violations, etc.
4.4 Dev results (pre-test, not for training decisions)
| Run | Variant | Success | False completion | Hidden pass (solve) | Security viol. |
|---|---|---|---|---|---|
| dbg | old | 15.2% | 83.3% | 9.5% | 2 |
| dbg | new | 17.4% | — | — | — |
| dbg4 | new | 23.9% | — | — | — |
| agentA | new (grpo_instruct + agent SFT) |
47.8% | 29.2% | 42.9% | 0 |
4.5 Held-out test suite (test_v1, n=94) — primary gate
Model: /models/ckpts/grpo_instruct/final (immutable baseline before agent SFT).
Artifacts: eval/agentbench_baseline_instruct_test.json, /models/runs/agentbench/baseline_instruct__*__test.json.
| Variant | Success | Hidden pass (solve) | False completion | Median latency | Notes |
|---|---|---|---|---|---|
notools |
20.2% (19/94) | 10.7% | 60.9% | 0.19s | Best on this suite; no repair loop |
old |
10.6% | 6.0% | 88.7% | 2.0s | False success dominates |
new |
5.3% (5/94) | 4.8% | 75.0% | 6.3s | Gate reduces false done but hurts pass rate on hard tasks |
Category pass rates (new on test): blocked 1/10, bugfix 1/10, impl 1/12, tdd 1/12, testgen 1/8, 0/10 lint/multifile/refactor/recovery subsets.
Interpretation: Dev suite (dev_v1) overstated harness benefit. On held-out test, the model lacks skill for lint/multifile/refactor/recovery; the verify gate + step budget burn tokens without enough successful repairs. Next: train on oracle trajectories for failing families, then re-ablate new with gate=0 on a slice to separate gate cost from capability.
Pending: /models/ckpts/agent_A/final on test_v1 — blocked when run (2026-10-30) because GPU was occupied (~86 GiB by another job). Re-run:
PYTHONPATH=. python -m agentbench.runner --model /models/ckpts/agent_A/final --name agentA --suite test --variants new --gpu-mem 0.28
5. Experiment plan (ranked by expected benefit / cost)
| Rank | Experiment | Cost | Expected benefit | Stop criteria |
|---|---|---|---|---|
| 1 | CodingHarness + gate (done) | Engineering only | Large drop in false completion vs old | Already merged; keep if security tests pass |
| 2 | Agent trajectory SFT (A, partial) | ~1h GPU, 531 rows | +30pp dev success observed (agent_A) |
Stop if test suite < +10pp vs baseline or false_completion > 40% |
| 3 | Expand oracle trajectories (gen_data oracle) |
CPU/GPU medium | Better tool validity + recovery | Need ≥2000 accepted steps, deduped |
| 4 | Hard-example mining (D) | GPU + labeling | Target failing families (testgen, multi_file) | Only add rows that pass hidden grader |
| 5 | Tool-use-only SFT (B) | Low | Fix invalid_args / wrong tool choice | Measure syntactic validity > 95% |
| 6 | LoRA agent SFT | Lower VRAM | Faster iteration | Compare to full FT on dev only |
| 7 | GRPO on agent trajectories (F) | High | Only after test harness + held-out stable | Reward = hidden pass, not model self-report |
| 8 | DPO (E) | Medium | Defer until paired pass/fail trajectories exist | — |
6. Reproduce commands
cd /home/vortex/train-llm-from-scratch
source .venv/bin/activate
# Preflight + unit tests
pytest tests/enterprise/test_sandbox.py tests/enterprise/test_agent_security.py
# Validate suite integrity
cd scripts/enterprise && PYTHONPATH=. python -m agentbench.selftest
# Held-out agent benchmark (greedy, vLLM)
PYTHONPATH=. python -m agentbench.runner \
--model /models/ckpts/grpo_instruct/final \
--name baseline_instruct \
--suite test \
--variants notools,old,new \
--concurrency 2 --gpu-mem 0.28 --verbose
PYTHONPATH=. python -m agentbench.runner \
--model /models/ckpts/agent_A/final \
--name agentA \
--suite test \
--variants new \
--concurrency 2 --gpu-mem 0.28 --verbose
# Oracle trajectory generation
PYTHONPATH=. python -m agentbench.gen_data oracle --n 700 --seed 1 --out /models/agent_data/v1
# Build SFT JSONL (task-level val holdout)
PYTHONPATH=. python -m agentbench.build_sft \
--inputs accepted_oracle.jsonl \
--components core,blocked,recovery \
--out /models/agent_data/v1/sft_B
# Agent SFT (Experiment A)
python scripts/enterprise/sft.py --config configs/agentbench/sft_agent.json
# Single-shot coding eval (existing)
python scripts/enterprise/eval.py --model /models/ckpts/grpo_instruct/final \
--name grpo_instruct --tasks humaneval,mbpp --gpu_mem 0.3
7. Production readiness (snapshot)
| Item | Status |
|---|---|
| Reproducible deps | requirements-enterprise.txt, REPORT.md env pin |
| Checkpoint integrity | HF format under /models/ckpts/*/final |
| Structured traces | agentbench.runner --trace, CodingHarness trace hashes |
| Sandboxed execution | bwrap + seccomp, tested |
| Regression gates | agentbench test suite + test_agent_security.py |
| Known blockers | Agent still weak on independent blind tasks; test suite baseline pending |
8. Known failures and next interventions
- testgen / multi_file families — model skips writing tests or edits wrong files → add oracle trajectories + mine failures from test run.
- Residual false completion (~29%) — tighten gate messages; SFT on rejected
finalattempts fromgen_data model. - Blind toolbench 6.7% — do not trust dev-only numbers; prioritize
test_v1and external task authorship. - Context — increase
context_tokensonly if repomap ablation shows recall-limited failures.
9. Where this competes vs fails
| Competes | Fails |
|---|---|
| HE+/MBPP+ chat vs other 1.5B instruct coders | vs 7B+ / frontier agents |
| Blocked-task recognition with CodingHarness + agent_A | Independent multi-step repo tasks without hints |
| Verifiable single-file bugfix/lint with gate | testgen quality; complex multi-file refactors under unittest-only sandbox |
| Latency ~2s median per dev task, ~13k tokens/success | Cost still high vs single-shot completion for easy tasks |
Numbers updated when /models/runs/agentbench/baseline_instruct__*__test.json completes.