Spaces:
Runtime error
Runtime error
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- README.md +28 -30
- requirements-models.txt +0 -1
- 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 27 |
Choose Direct, Calm, or Encouraging before pressing Enter to start a session.
|
| 28 |
|
| 29 |
-
##
|
| 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 |
-
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
| 40 |
|
| 41 |
```bash
|
| 42 |
-
python -m pip install -r requirements-models.txt
|
| 43 |
STEP_ZERO_MOCK=0 \
|
| 44 |
-
NEMOTRON_MODEL_PATH=./models/
|
| 45 |
MINICPM_MODEL_PATH=./models/minicpm-3-4b.gguf \
|
| 46 |
uvicorn app:app --host 0.0.0.0 --port 7860
|
| 47 |
```
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
-
|
| 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`
|
| 68 |
-
|
| 69 |
-
## Known Limitations & Model Trade-offs
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
* **
|
| 74 |
-
* **The
|
|
|
|
|
|
| 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
|