Spaces:
Sleeping
Sleeping
Commit History
-
feat: wire trained GGUF model (customer-support-grpo-v5) into inferenceβ
- serve_inference.py: rewrite to use llama-cpp-python + GGUF Q4_K_M Downloads lebiraja/customer-support-grpo-v5-gguf/model-q4_k_m.gguf at startup - requirements.txt: add llama-cpp-python>=0.3.0 - Dockerfile: add build-essential/cmake for llama-cpp compilation; set LOCAL_INFERENCE_URL + AGENT_MODEL_URL + GGUF_REPO/FILE env vars - start.sh: launch serve_inference.py on :8001 alongside FastAPI/Next.js - server/app.py: default AGENT_MODEL_URL to localhost:8001 - blog.md: real training story β 150 steps, L40S, 5 curriculum stages, best score 0.9528, model links, reward curve narrative - README.md: add trained model section, update results table, add HF links Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>601a10d
-
feat: HF Jobs training pipeline + revert AUTO_TRAIN from Spaceβ
- submit_training_job.py: submits GRPO training as HF Job on a100-large clones Space repo, runs start_training.sh, pushes merged model to Hub supports --logs <job_id> to stream live output - server/app.py: remove AUTO_TRAIN β Space now only serves env + frontend training is handled cleanly by the Job Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>aa33bb5 -
fix: stream training logs to stdout for HF Spaces Logs tab visibilityβ
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>500ffec -
fix: use /tmp for logs and checkpoints β /app is read-only on HF Spacesβ
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>461b3cc -
feat: AUTO_TRAIN=1 launches training pipeline on Space startupβ
When AUTO_TRAIN=1 env var is set, start_training.sh runs automatically in the background the moment the uvicorn server starts. Output streams to logs/main.log (visible in HF Spaces Logs β Container tab). Uses start_new_session=True so training survives uvicorn restarts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>7258772 -
feat: one-shot training script + frontend on HF Spaces port 7860β
- start_training.sh: full pipeline (judge β SFT β GRPO β merge β push) Builds frontend first, waits for each step, logs to logs/*.log Resume-safe: skips SFT if checkpoint exists, SKIP_SFT/SKIP_GRPO flags - server/app.py: serves Next.js static export at "/" if frontend/out/ exists Falls back to JSON API description when not built - frontend/next.config.ts: NEXT_STATIC_EXPORT=true switches output to static export mode (out/) for serving through FastAPI on port 7860 Usage on HF Spaces terminal: HF_TOKEN=hf_xxx HF_REPO=lebiraja/customer-support-grpo bash start_training.sh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>e640b5b -
fix: rate limit bypass for admin key + JSON 429 + LLM judge killswitchβ
Rate limiting (critical β caused JSONDecodeError in training pipelines): - Replace _rate_limit_exceeded_handler with _json_rate_limit_handler: all 429 responses are now proper JSON {detail, retry_after} instead of HTML text, so training scripts that expect JSON never hit JSONDecodeError - Add _rate_limit_key(): returns None for valid X-API-Key requests; slowapi skips the limit when key_func returns a falsy value (if all(args) guard in __evaluate_limits). RL training loops and test scripts with the API key are now fully exempt from the 30/min reset and 200/min step limits. Public/unauthenticated access is still throttled per-IP. LLM judge latency (minor β bottlenecks training throughput): - Add USE_LLM_JUDGE env var (default: true). Set USE_LLM_JUDGE=false during heavy training to skip NIM API round-trips on every step() call. Removes the ~300ms per-step latency hit; rule-based fallback scores (0.5) are used in place of empathy/policy/resolution judge evals. All four β¦9912fe1
-
feat(round2): DB-grounded multi_domain task with 30-ticket curriculum stageβ
Adds a full DB-backed grounded response system as the final curriculum stage, preventing model memorisation and teaching the agent to query real data before responding rather than hallucinating facts. Environment: - env/user_db.py: in-memory DB with 23 users and 40+ orders across food_delivery, e_commerce, and ticket_booking domains - env/models.py: new query_user_profile and query_order_details action types, retrieved_data field on Observation, customer_email/related_order_ids on Ticket - env/environment.py: DB query routing, _handle_query_action(), multi_domain task config, fixed hierarchical routing via TASK_CONFIG lookup - env/reward_engine.py: compute_db_signals() with hallucination_penalty, grounded_response_bonus, query_match_bonus, wasted_query_penalty, not_found_handling_bonus; integrated into both reward functions - env/ticket_store.py: 30 multi_domain tickets (MDTKT-001 to MDTKT-030) covering food delivery, e-commerce, ticket booking, NOT_FOUND edge cases, suspeβ¦33c927a -
fix(security): close all 7 audit findings from V2/V3 security auditβ
- Add auth to /benchmark POST endpoint (was open without key) - Block L2/L3 action types on non-hierarchy tasks (role bypass fix) - Remove human_customer_message from /step endpoint (injection vector) - Deduplicate leaderboard submissions by session_id (double-submit fix) - Store session_id internally in leaderboard, strip from public GET response - Warn at startup when default ADMIN_API_KEY is in use Score: 52 β 64 β 78/100 across three audit rounds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>8732800
-
feat: hackathon improvements β benchmark dashboard, GRPO training pipeline, grader fixesβ
- Frontend: Next.js demo UI with Auto-Play / Chat-as-Customer / Manual Agent modes - Frontend: /dashboard/benchmark page β before/after comparison (bar chart, radar, table) - Backend: GET /benchmark/baseline endpoint returning per-task baseline metrics (8 tasks, 7 signals) - GRPO training pipeline: train/ (11 files) β config, env_client, prompt_builder, action_parser, model_utils, reward_aggregator, rollout_collector, grpo_trainer, curriculum, evaluate, run_train - SFT warm-start: train/sft_warmstart.py β collects gold episodes, runs TRL SFTTrainer before GRPO - LoRA merge: train/merge_lora.py β correct Unsloth merge path (avoids 4-bit upcast degradation) - Grader fix: task_hard.py β add hostile-tone penalty (Γ0.4); task_curriculum_basic.py same - README: updated reward function table (7 signals + anti-gaming guards), before/after results table, training quick-start, fixed model name (nemotron β meta/llama-3.3-70b-instruct) - docker-compose.yml: forward NVIDIA_API_KEY/MODEL env varβ¦b4289f9 -
feat: Progressive 4-stage curriculum (v2.1.0)β
Added curriculum_basic β curriculum_supervisor β curriculum_full_hierarchy β curriculum_nightmare with systematically increasing complexity: Stage 1 (basic): L1-only, no drift, no Hinglish, dense rewards for bootstrapping Stage 2 (supervisor): L1+L2, feedback loops, 20% drift, impatient customers Stage 3 (full_hierarchy): All 3 levels, 80% drift, SLA-critical Indian enterprise Stage 4 (nightmare): Multi-drift, Hinglish, 0.7 initial frustration, 18 max steps - TASK_CONFIG now has per-task params: active_levels, drift_probability, initial_frustration, hinglish_enabled, multi_drift, ticket_pool - PolicyEngine supports multi_drift (up to 3 events per episode) - HierarchicalCustomerSupportEnv skips L2 when only L1 active - Supervisor escalation auto-resolves when L3 not in active_levels - 4 new graders with stage-appropriate scoring - 11 graders registered, 61/61 tests passing - openenv.yaml v2.1.0 with curriculum section and difficulty labels1491607 -
feat: Round 2 β Hierarchical multi-agent environment (v2.0)β
3-level agent hierarchy: Support Agent β Supervisor β Manager - HierarchicalCustomerSupportEnv with phase-based step machine - Role-specific actions (supervisor_approve/reject/feedback/escalate, manager_override/resolve/send_back) - LLM-as-Judge hybrid reward engine with anti-gaming penalties - LLM-driven customer simulator with Hinglish degradation - Dynamic policy/schema drift mid-episode - 6 Indian enterprise tickets (UPI, Big Billion Days, KYC, SLA) - 3 hierarchy graders (easy/medium/hard) - Role-specific inference prompts - Server auto-detects hierarchy tasks - 50/50 tests passing, full backward compat with Round 16721f69
-
chore: remove global auth for testing
3472345 -
fix: Phase 17 final production lock (auth, PII redact, structlog)
dd8440a -
feat: complete hackathon hardening and nightmare mode integrationβ
- Add OOM memory limits to HF Spaces session storage - Optimize Docker container sizes significantly (CPU-only PyTorch) - Enhance reward grading logic based on semantic tracking - Add .venv, .git, and __pycache__ to .dockerignorea30699a
-
fix: resolve all openenv validate failures for Phase 1 submissionβ
Four issues flagged by hackathon validator: 1. Missing uv.lock β Run 'uv lock', generated 516KB lockfile resolving 125 packages 2. Missing [project.scripts] server entry point β Added 'serve = "server.app:main"' to pyproject.toml 3. Missing required dependency openenv-core>=0.2.0 β Added to both requirements.txt and pyproject.toml dependencies 4. server/app.py missing main() + if __name__ == '__main__' β Added main() calling uvicorn.run() on 0.0.0.0:7860 β Added if __name__ == '__main__': guard All 46 tests still passing. Co-authored-by: JEFFERSON-007 <mariyalpackiajothi@gmail.com> Co-authored-by: 17lohith <lohithkrm6@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>0b8c1e8 -
fix: production hardening β rate limiting, session cap, body limit, logging, deep copy, e2e testsβ
Fixes from adversarial audit (test_usage_report_2.md): server/app.py: - Rate limiting: 30 /reset calls/min per IP via slowapi (stops session flood attack) - Session cap: 500 concurrent sessions hard limit β 503 when exceeded - Body size limit: 64KB enforced at middleware level β 413 - Structured JSON logging: every request logged with method/path/status/duration/ip - Session sweep logging: logs count of expired sessions on each sweep env/ticket_store.py: - Shallow copy β deep copy in get_random_by_task() β prevents list mutation bleed across sessions env/environment.py: - Moved re + _INFO_PATTERNS imports to top-level (was re-imported on every call) env/reward_engine.py: - Module-level TF-IDF singleton β reused across all calls instead of allocating new instance per step tests/test_env.py: - Added random.seed(42) for deterministic ticket selection in tests - Added 16 new e2e integration tests covering full HTTP stack: root, health, reset, invalid task, fullβ¦ec80031 -
fix: address 6 audit report issues β input validation, CORS, session TTL, health check, log safety, history truncationβ
- Fix 1 (env/models.py): Add max_length=2000/500 to Action.message/reason β rejects oversized payloads with HTTP 422 - Fix 2 (inference.py): Sanitize [STEP] log output via _safe_action_log() β strips newlines, truncates to 120 chars, prevents log injection - Fix 3 (server/app.py): Session TTL sweep β abandoned sessions auto-expire after 30 minutes via time.monotonic() check - Fix 4 (server/app.py): CORS middleware added β allow_origins=["*"] for browser and HF Spaces compatibility - Fix 5 (env/environment.py): Observation history truncated to last 20 messages β full history kept internally for grading - Fix 6 (server/app.py): Health endpoint now calls ticket_store.get_random_by_task() β returns 503 if env is broken All 30 tests still passing. Co-authored-by: JEFFERSON-007 <mariyalpackiajothi@gmail.com> Co-authored-by: 17lohith <lohithkrm6@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>f97065c -
feat: complete CustomerSupportEnv RL environment for OpenEnv hackathonβ
- OpenEnv-compliant env with reset/step/state API (Pydantic models) - 30 realistic tickets across 3 difficulty levels (easy/medium/hard) - Shaped reward function: VADER tone + cosine loop detection + resolution/efficiency/accuracy signals - FastAPI server with per-session isolation (no global mutable state) - Task graders: billing FAQ, complaint handling, SLA escalation triage - inference.py: NVIDIA NIM streaming client with 3-key failover load balancing - Docker + docker-compose setup, openenv.yaml metadata, full README - 30/30 tests passing Co-authored-by: JEFFERSON-007 <mariyalpackiajothi@gmail.com> Co-authored-by: 17lohith <lohithkrm6@gmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>b722ec2