# Handicate (self-refinement trainer) A **self-improving training framework** for a text/code LLM: a policy model that gets better over rounds via **reinforcement learning (GRPO)** with an AI **judge** as the reward, a **data curator** that pulls web data and keeps only what the judge rates highly (compressed into compact pairs, raw discarded), a **critique→revise** loop so it learns from criticism, and **distill-into-weights + discard-raw** so knowledge lives in parameters instead of a growing corpus on disk. This is the realistic, buildable core of the "Handicate" vision. It synthesizes ideas from [[refora]] (expert iteration + critic + streaming data), [[sofara]] (rating-gated polish, differential weight purification, AutoLabeler), and [[intelejack]] (LLM-orchestrated training). ## What it is NOT (honest scope) - **Not** JARVIS, **not** AGI, **not** "beats Fable 5." A solo training run cannot reach frontier multimodal capability -- that's hundreds of millions of dollars and huge teams. - It does **not** improve "exponentially." Self-training has hard diminishing returns and a real failure mode -- **model collapse** -- when a model trains on AI-rated/AI-generated data in a loop. This framework's whole point is to *manage* that, not pretend it away. ## How collapse is prevented (the load-bearing part) Every round is kept ONLY if it does not regress on a **frozen, human-grounded eval set** (`data/eval_heldout.jsonl`) that the AI never generates or rates. Regressions are reverted. A small **replay buffer** of real high-quality pairs fights forgetting. Without these, the loop spirals down; with them, only changes that help on real tasks survive. ## The loop (loop.py) ``` curate web -> judge rates+compresses (raw discarded) critique -> revise (learn from criticism) GRPO RL with judge reward (constant improvement) distill curated+revised into weights -> discard raw eval gate: keep round iff no regression on frozen held-out tasks ``` ## Files | File | Role | |------|------| | `config.py` | base model (Qwen2.5-3B-Instruct), judge, budgets, knobs | | `rubric.md` | the judge's requirements + examples (+ your criticisms get appended) | | `core/judge.py` | rater/critic: score 0..1 + written criticism; GRPO reward func | | `core/curator.py` | web pull -> judge-filter -> compress to pairs -> discard raw | | `core/critique_revise.py` | answer -> criticism -> revise -> keep better | | `core/refine_rl.py` | GRPO (TRL) with the judge as reward | | `core/distill.py` | fold accepted pairs into weights (LoRA), discard raw, replay | | `core/evalgate.py` | frozen held-out eval; collapse guard | | `loop.py` | orchestrates a round and repeats | | `jobs/run_handicate.py` | HF Jobs runner | | `test_run.py` | free local checks | | `feedback/criticisms.jsonl` | your criticisms about responses -> raise the bar | ## You must provide (small, real, human-grounded) - `data/seed_prompts.jsonl` — `{"prompt": "..."}` tasks to train on. - `data/eval_heldout.jsonl` — `{"instruction": "...", "ideal?": "..."}` frozen eval (the collapse guard). Keep this real and never let the loop touch it. - Wire `core/curator.web_pull()` to a real search+fetch (or a streamed HF dataset). ## Run ``` python test_run.py # free local checks hf upload AmongTheCouch23/handicate-code . . --repo-type dataset hf jobs uv run -d --flavor a100-large --timeout 12h --python 3.11 -s HF_TOKEN ./jobs/run_handicate.py ``` ## Extending toward the bigger vision Text/code core first. Each modality (3D, image, video, audio) plugs in as another **generator + judge** pair behind the same loop -- e.g. ImageForge as generator + a vision judge, Sculptron for 3D, Michiro for music. Handicate becomes the orchestrator (the "manage scripts and systems" brain); [[handicate_sni_project]] could serve as its reasoning core. Build and validate one modality at a time -- the loop is the same.