tc043 commited on
Commit
8bc210e
·
1 Parent(s): 7dc4c08

docs: update project documentation to reflect fine-tuned model integration and remove standalone model dependencies

Browse files
Files changed (3) hide show
  1. README.md +28 -30
  2. requirements-models.txt +0 -1
  3. requirements.txt +4 -1
README.md CHANGED
@@ -9,66 +9,64 @@ app_port: 7860
9
 
10
  # Step-Zero
11
 
12
- Step-Zero is a local-first hackathon demo for a "Cognitive Pacemaker": it shows only one next action at a time, lets the user mark it done or too hard, and trips a circuit breaker when friction stays too high.
13
 
14
- ## Quick Start
 
 
 
 
 
 
 
 
 
15
 
16
  ```bash
17
  python3 -m venv .venv
18
  . .venv/bin/activate
19
  python -m pip install -r requirements.txt
20
- python generate_dataset.py
21
  uvicorn app:app --host 0.0.0.0 --port 7860
22
  ```
23
 
24
  Open `http://localhost:7860`.
25
 
26
- The app starts in mock mode so the custom UI and WebSocket loop work before model files are present.
27
  Choose Direct, Calm, or Encouraging before pressing Enter to start a session.
28
 
29
- ## Demo Checklist
30
-
31
- 1. Enter a goal, for example `I need to write my tax report`.
32
- 2. Confirm the app shows one instruction only.
33
- 3. Click `TOO HARD` once to show the smaller prerequisite step.
34
- 4. Click `TOO HARD` again to trigger the circuit breaker.
35
- 5. Use `Export Trace` or open `http://localhost:7860/trace` to capture the agent trace JSON.
36
 
37
- ## Local Model Mode
 
 
38
 
39
- Put quantized GGUF files under `models/`, then run:
40
 
41
  ```bash
42
- python -m pip install -r requirements-models.txt
43
  STEP_ZERO_MOCK=0 \
44
- NEMOTRON_MODEL_PATH=./models/nemotron-mini-4b.gguf \
45
  MINICPM_MODEL_PATH=./models/minicpm-3-4b.gguf \
46
  uvicorn app:app --host 0.0.0.0 --port 7860
47
  ```
48
 
49
- The Gradio compatibility panel is available at `http://localhost:7860/gradio`; the custom Codex-generated Fog of War UI remains the root page.
50
 
51
- ## Modal Fine-Tune
52
-
53
- Generate the dataset first:
54
 
 
55
  ```bash
56
  python generate_dataset.py
57
  ```
58
-
59
- Then install Modal, authenticate, and launch the scaffold:
60
-
61
  ```bash
62
- python -m pip install modal
63
  modal setup
64
  modal run modal_train.py
65
  ```
66
 
67
- `modal_train.py` is currently a scaffold for the hackathon story. The remaining production step is to wire `verbs.jsonl` into Modal storage, uncomment the `SFTTrainer` block, run the LoRA job, and export/publish the GGUF or adapter artifact.
68
-
69
- ## Known Limitations & Model Trade-offs
70
 
71
- During semantic stress testing of the live backend, we discovered the classic "Alignment Tax" associated with small, 4B-parameter local models:
72
- * **The Problem:** Highly instruction-tuned base models (like Nemotron-Mini and MiniCPM) are deeply trained to act like "helpful conversational assistants." When prompted with complex goals like *"write a python script"*, they often break out of the Cognitive Pacemaker persona and output helpful paragraphs instead of strict 8-word physical atomic actions.
73
- * **Current Mitigation:** We employ aggressive few-shot prompting, manual Jinja template overrides, and Python-side text post-processing to brutally truncate their output.
74
- * **The Ultimate Fix (Roadmap):** Instead of changing to a larger, slower 8B+ model, we plan to fully execute the `modal_train.py` Unsloth fine-tuning pipeline. By training a LoRA adapter specifically on `verbs.jsonl`, we will permanently "lobotomize" the chatbot persona, forcing the model to strictly output imperative verbs natively.
 
 
9
 
10
  # Step-Zero
11
 
12
+ Step-Zero is a local-first hackathon demo for a "Cognitive Pacemaker": it shows only one next action at a time, lets the user mark it done or too hard, and trips a circuit breaker when friction stays too high.
13
 
14
+ It leverages a custom dual-model architecture:
15
+ 1. **Nemotron-Mini-4B-Instruct (Fine-Tuned)**: SFT fine-tuned specifically on daily goal breakdown datasets to produce extremely strict 8-word physical atomic actions without "assistant" conversational filler.
16
+ 2. **MiniCPM-3-4B**: Acts as a robust fallback and history-aware router for rejected step breakdown and stylistic rewriting (Encouraging vs Calm tones).
17
+
18
+ ## Hugging Face Assets
19
+ The resulting fine-tuned model and synthetic dataset from this project have been published to Hugging Face:
20
+ - **Model:** [tc043/step-zero-nemotron](https://huggingface.co/tc043/step-zero-nemotron)
21
+ - **Dataset:** [tc043/step-zero-dataset](https://huggingface.co/datasets/tc043/step-zero-dataset)
22
+
23
+ ## Quick Start (Mock Mode)
24
 
25
  ```bash
26
  python3 -m venv .venv
27
  . .venv/bin/activate
28
  python -m pip install -r requirements.txt
 
29
  uvicorn app:app --host 0.0.0.0 --port 7860
30
  ```
31
 
32
  Open `http://localhost:7860`.
33
 
34
+ The app starts in mock mode by default if the GGUF models are not found, so the custom UI and WebSocket loops work out-of-the-box.
35
  Choose Direct, Calm, or Encouraging before pressing Enter to start a session.
36
 
37
+ ## Full Local Model Mode (Production)
 
 
 
 
 
 
38
 
39
+ To run the full LLM backend, place the required quantized GGUF files under `models/`:
40
+ * `step-zero-nemotron-finetuned.gguf`
41
+ * `minicpm-3-4b.gguf`
42
 
43
+ Then run:
44
 
45
  ```bash
 
46
  STEP_ZERO_MOCK=0 \
47
+ NEMOTRON_MODEL_PATH=./models/step-zero-nemotron-finetuned.gguf \
48
  MINICPM_MODEL_PATH=./models/minicpm-3-4b.gguf \
49
  uvicorn app:app --host 0.0.0.0 --port 7860
50
  ```
51
 
52
+ ## Modal Fine-Tuning Pipeline
53
 
54
+ If you want to reproduce the Nemotron fine-tuning run:
 
 
55
 
56
+ 1. Generate the synthetic dataset:
57
  ```bash
58
  python generate_dataset.py
59
  ```
60
+ 2. Authenticate and launch the Modal training job:
 
 
61
  ```bash
 
62
  modal setup
63
  modal run modal_train.py
64
  ```
65
 
66
+ `modal_train.py` handles the Unsloth LoRA SFT training on `verbs.jsonl` and merges the weights into a single GGUF artifact on Modal volumes.
 
 
67
 
68
+ ## System Architecture Fixes
69
+ During development, we successfully mitigated several core "Small LLM Alignment Taxes":
70
+ * **The "Paragraph" Tax:** MiniCPM stylistic rewrites are strictly constrained to exactly one sentence under 12 words via robust system prompting.
71
+ * **The "Cognitive Planning" Bug:** Fallback breakdowns explicitly ban cognitive verbs (think, plan, remember) to force strictly physical next steps.
72
+ * **The Syntactic Rut & Repetition Loops:** Implemented a short-memory sliding window (`history[-3:]`) and an explicit string-matching repetition guard that bounces identical consecutive outputs to the history-aware fallback router.
requirements-models.txt DELETED
@@ -1 +0,0 @@
1
- llama-cpp-python==0.3.5
 
 
requirements.txt CHANGED
@@ -2,4 +2,7 @@ fastapi==0.115.6
2
  gradio==5.9.1
3
  uvicorn[standard]==0.32.1
4
  websockets==14.1
5
- requests
 
 
 
 
2
  gradio==5.9.1
3
  uvicorn[standard]==0.32.1
4
  websockets==14.1
5
+ requests
6
+ python-dotenv
7
+ llama-cpp-python
8
+ modal