Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -13,9 +13,9 @@ base_model: Reizxn/makeitwork1
|
|
| 13 |
pipeline_tag: text-generation
|
| 14 |
---
|
| 15 |
|
| 16 |
-
# makeitwork-1
|
| 17 |
|
| 18 |
-
A 500M parameter decoder-only transformer (LLaMA-style architecture) fine-tuned for **codebase information retrieval** and **tool-calling**.
|
| 19 |
|
| 20 |
## Model Details
|
| 21 |
|
|
@@ -29,15 +29,19 @@ A 500M parameter decoder-only transformer (LLaMA-style architecture) fine-tuned
|
|
| 29 |
- **Normalization:** RMSNorm
|
| 30 |
- **Tied embeddings:** Yes
|
| 31 |
- **Vocab size:** 32,009 (with special tokens)
|
|
|
|
| 32 |
|
| 33 |
## Capabilities
|
| 34 |
|
| 35 |
-
The model acts as
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
## Special Tokens
|
| 43 |
|
|
@@ -53,22 +57,110 @@ The model acts as a code search agent. Given a natural language query about a co
|
|
| 53 |
| `<|finish|>` | 32007 | End of response |
|
| 54 |
| `<|end|>` | 32008 | Turn separator |
|
| 55 |
|
| 56 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
| Metric | Score |
|
| 59 |
|--------|-------|
|
| 60 |
-
| Search accuracy |
|
| 61 |
-
| Evidence rate |
|
| 62 |
-
| Finish rate | 100.0% |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
|
| 66 |
## Training
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
-
|
| 71 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
## Usage
|
| 74 |
|
|
@@ -105,6 +197,22 @@ model.eval()
|
|
| 105 |
tokenizer = Tokenizer.from_file("tokenizer_agent.json")
|
| 106 |
```
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
## License
|
| 109 |
|
| 110 |
MIT
|
|
|
|
| 13 |
pipeline_tag: text-generation
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# makeitwork-1 (v13)
|
| 17 |
|
| 18 |
+
A 500M parameter decoder-only transformer (LLaMA-style architecture) fine-tuned for **codebase information retrieval** with **multi-hop search reasoning** and **tool-calling**.
|
| 19 |
|
| 20 |
## Model Details
|
| 21 |
|
|
|
|
| 29 |
- **Normalization:** RMSNorm
|
| 30 |
- **Tied embeddings:** Yes
|
| 31 |
- **Vocab size:** 32,009 (with special tokens)
|
| 32 |
+
- **Checkpoint:** sft_v13 (step 1000, EMA loss 0.1500)
|
| 33 |
|
| 34 |
## Capabilities
|
| 35 |
|
| 36 |
+
The model acts as an autonomous code search agent. Given a natural language query about a codebase, it:
|
| 37 |
+
|
| 38 |
+
1. **Reasons** about the query using `<|reasoning|>` to decompose it into subqueries
|
| 39 |
+
2. **Searches** the codebase using `<|search|>` tokens β can perform **multi-hop** search (search β inspect results β refine search)
|
| 40 |
+
3. **Analyzes** `<|result|>` blocks returned by the retrieval system
|
| 41 |
+
4. **Returns** curated `<|evidence|>` with the relevant code snippet, file path, and symbol name
|
| 42 |
+
5. **Terminates** cleanly with `<|finish|>`
|
| 43 |
+
|
| 44 |
+
The multi-hop capability allows the model to handle **vague queries** (e.g. "find a function that does something"), **indirect queries** (e.g. "function that calls X", "function involving testing"), and **stemmed queries** (e.g. "function involving parsing" β searches "parse") by first searching a broad keyword, extracting the specific symbol name from the results, and then searching for that exact name.
|
| 45 |
|
| 46 |
## Special Tokens
|
| 47 |
|
|
|
|
| 57 |
| `<|finish|>` | 32007 | End of response |
|
| 58 |
| `<|end|>` | 32008 | Turn separator |
|
| 59 |
|
| 60 |
+
## Benchmark: Code Search Eval v5
|
| 61 |
+
|
| 62 |
+
### Overview
|
| 63 |
+
|
| 64 |
+
The model is evaluated on a **held-out test set of 50 code search queries** spanning multiple programming languages and query types. The eval set was constructed from 20 open-source repositories covering Python, Rust, Go, C, TypeScript, Java, and JavaScript.
|
| 65 |
+
|
| 66 |
+
### Query Types
|
| 67 |
+
|
| 68 |
+
The benchmark includes the following query categories, designed to test different aspects of code search:
|
| 69 |
+
|
| 70 |
+
| Category | Description | Example |
|
| 71 |
+
|----------|-------------|---------|
|
| 72 |
+
| **Exact name** | Query contains the exact symbol name | "Find `testMergeIntoEmptyAccumulator`" |
|
| 73 |
+
| **Definition lookup** | Ask for definition of a known symbol | "Show me the definition of `BufferEmbedding`" |
|
| 74 |
+
| **Interface/Type** | Look up an interface or type | "Look up the interface `MsObjectPattern`" |
|
| 75 |
+
| **Vague** | No specific name in query | "I'm looking for a function that does something" |
|
| 76 |
+
| **Stemmed keyword** | Query uses -ing form, name uses base | "function involving testing" β `test*` |
|
| 77 |
+
| **Returns/Calls X** | Find function that calls/returns X | "function returns `builder.startObject`" |
|
| 78 |
+
| **Near-miss** | Very similar names, must discriminate | `test_establish_connection_using_3_levels_config` vs `..._types_config` |
|
| 79 |
+
|
| 80 |
+
### Evaluation Protocol
|
| 81 |
+
|
| 82 |
+
Each query is evaluated by running the full agent loop:
|
| 83 |
+
|
| 84 |
+
1. The model receives the system prompt + user query
|
| 85 |
+
2. It generates tokens autoregressively (greedy decoding)
|
| 86 |
+
3. When it emits `<|search|>...<|end|>`, a retrieval result is injected as `<|result|>...<|end|>`
|
| 87 |
+
4. The model can perform up to **3 search hops** (multi-hop reasoning)
|
| 88 |
+
5. Generation continues until `<|finish|>` or max 600 tokens
|
| 89 |
+
|
| 90 |
+
### Metrics
|
| 91 |
+
|
| 92 |
+
| Metric | Definition |
|
| 93 |
+
|--------|------------|
|
| 94 |
+
| **Search accuracy** | The expected symbol name appears in **any** of the model's search queries (not just the first). This rewards multi-hop reasoning. |
|
| 95 |
+
| **Evidence rate** | The model emits a valid `<|evidence|>` block with code facts |
|
| 96 |
+
| **Finish rate** | The model terminates with `<|finish|>` (clean termination) |
|
| 97 |
+
|
| 98 |
+
### Results (v13)
|
| 99 |
|
| 100 |
| Metric | Score |
|
| 101 |
|--------|-------|
|
| 102 |
+
| **Search accuracy** | **92.0%** |
|
| 103 |
+
| **Evidence rate** | **100.0%** |
|
| 104 |
+
| **Finish rate** | **100.0%** |
|
| 105 |
+
|
| 106 |
+
### Progression Across Training Rounds
|
| 107 |
+
|
| 108 |
+
| Version | Search Accuracy | Evidence | Finish | EMA Loss | Dataset Size | Steps |
|
| 109 |
+
|---------|----------------|----------|--------|----------|-------------|-------|
|
| 110 |
+
| v6 | 62.0% | 96.0% | 100.0% | 0.2985 | 19K | 800 |
|
| 111 |
+
| v8 | 74.0% | 98.0% | 100.0% | 0.2680 | 42K | 800 |
|
| 112 |
+
| v9 | 78.0% | 100.0% | 100.0% | 0.2520 | 78K | 800 |
|
| 113 |
+
| v10 | 82.0% | 100.0% | 100.0% | 0.2409 | 106K | 800 |
|
| 114 |
+
| v11 | 86.0% | 100.0% | 100.0% | 0.2251 | 106K | 800 |
|
| 115 |
+
| v12 | 90.0% | 100.0% | 100.0% | 0.1871 | 138K | 1000 |
|
| 116 |
+
| **v13** | **92.0%** | **100.0%** | **100.0%** | **0.1500** | 193K | 1000 |
|
| 117 |
+
|
| 118 |
+
### Remaining Failure Modes (4/50)
|
| 119 |
+
|
| 120 |
+
The 4 remaining failures at 92% accuracy fall into two categories:
|
| 121 |
+
|
| 122 |
+
1. **Multi-hop not executed (3 cases):** The model correctly identifies the target symbol name in its reasoning but goes to `<|evidence|>` instead of issuing a second `<|search|>`. This affects vague queries ("Where is the function defined?") and indirect queries ("function returns builder.startObject").
|
| 123 |
|
| 124 |
+
2. **Character-level near-miss (1 case):** The model performs two searches but both are near-misses of the target name (`test_establish_connection_using_3_types` vs expected `test_establish_connection_using_3_levels_config`).
|
| 125 |
|
| 126 |
## Training
|
| 127 |
|
| 128 |
+
### Dataset
|
| 129 |
+
|
| 130 |
+
- **Dataset version:** v11 (192,703 traces)
|
| 131 |
+
- **Source code:** 628,100 code chunks from 20 open-source repositories
|
| 132 |
+
- **Trace types:**
|
| 133 |
+
- Multi-hop vague queries (15K) β search generic keyword β extract name β search name
|
| 134 |
+
- Multi-hop returns/calls queries (28K) β search called method β extract caller β search caller
|
| 135 |
+
- Multi-hop stemming queries (7K) β "involving testing" β search "test" β extract name β search name
|
| 136 |
+
- Multi-hop involving queries (7K) β search keyword β extract name β search name
|
| 137 |
+
- Near-miss discrimination (8K) β search wrong name β compare suffixes β search correct name
|
| 138 |
+
- Code-to-name extraction (8K) β extract function name from code snippet β search it
|
| 139 |
+
- Exact copy (44K) β single-hop: search exact name from query
|
| 140 |
+
- Inherited from v10 (137K) β prior multi-hop + single-hop traces
|
| 141 |
+
|
| 142 |
+
### Training Configuration
|
| 143 |
+
|
| 144 |
+
- **Method:** Supervised Fine-Tuning (SFT)
|
| 145 |
+
- **Base checkpoint:** sft_v12 (90% accuracy)
|
| 146 |
+
- **Optimizer:** AdamW (betas=0.9, 0.95, weight_decay=0.1)
|
| 147 |
+
- **Learning rate:** 5e-5 with cosine schedule
|
| 148 |
+
- **Batch size:** 4 (effective 32 with gradient accumulation 8)
|
| 149 |
+
- **Sequence length:** 1024
|
| 150 |
+
- **Precision:** BF16
|
| 151 |
+
- **Gradient clipping:** 1.0
|
| 152 |
+
- **Steps:** 1000
|
| 153 |
+
- **Hardware:** NVIDIA H100 80GB
|
| 154 |
+
- **Training time:** ~21 minutes
|
| 155 |
+
- **Final EMA loss:** 0.1500
|
| 156 |
+
|
| 157 |
+
### Training Progression
|
| 158 |
+
|
| 159 |
+
The model was trained iteratively across 7 SFT rounds (v6βv8βv9βv10βv11βv12βv13), with each round:
|
| 160 |
+
1. Analyzing remaining failures from the previous checkpoint
|
| 161 |
+
2. Generating targeted training traces for those failure modes
|
| 162 |
+
3. Fine-tuning from the previous checkpoint (warm start)
|
| 163 |
+
4. Re-evaluating on the held-out test set
|
| 164 |
|
| 165 |
## Usage
|
| 166 |
|
|
|
|
| 197 |
tokenizer = Tokenizer.from_file("tokenizer_agent.json")
|
| 198 |
```
|
| 199 |
|
| 200 |
+
### Agent Loop Example
|
| 201 |
+
|
| 202 |
+
```python
|
| 203 |
+
# System prompt
|
| 204 |
+
SYSTEM = (
|
| 205 |
+
"You are a code search agent. Given a query from a reasoning model, "
|
| 206 |
+
"decompose it into subqueries, search the codebase, inspect results, "
|
| 207 |
+
"and return curated evidence. Use <|search|> to issue searches, "
|
| 208 |
+
"<|reasoning|> to analyze, and <|evidence|> to return findings. "
|
| 209 |
+
"Be concise. Extract only the relevant facts. End with <|finish|>."
|
| 210 |
+
)
|
| 211 |
+
|
| 212 |
+
# Build input: [system] SYSTEM [end] [user] "Find parseBoolean" [end] [assistant]
|
| 213 |
+
# Then generate autoregressively, injecting retrieval results after each <|search|>...<|end|>
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
## License
|
| 217 |
|
| 218 |
MIT
|