--- base_model: Qwen/Qwen3.5-2B library_name: peft license: apache-2.0 pipeline_tag: text-generation language: - en tags: - grpo - lora - reinforcement-learning - small-model - on-device - superbird-labs model-index: - name: a-02-database-agent results: - task: type: text-generation name: question answering through tool calls dataset: name: chinook via mcp-server-sqlite (184 held-out) type: chinook-mcp metrics: - type: accuracy name: right answer value: 81.5 --- ![A-02 Database Agent](https://huggingface.co/superbird-labs/a-02-database-agent/resolve/main/cover.png) # A-02 · Database Agent **superbird labs · Agent unit · 2B** > Answers questions by driving a live database through MCP tools. It never sees the schema up front, and it stopped wandering. [**Watch real runs**](https://huggingface.co/spaces/cetusian/model-hangar)  |  [**Docs and full recipe**](https://docs.superbirdlabs.com/models/a-02/)  |  [**Run it offline**](https://docs.superbirdlabs.com/models/a-02/#run-it)  |  [All superbird models](https://superbirdlabs.com/units)  |  [Custom models for your company](https://superbirdlabs.com/business) **Open source.** Apache-2.0 weights, the full training recipe and the exact prompt are all public. Use it, ship it, retrain it. ## Spec plate | | | |---|---| | Serial | `A-02` · 2B | | Frame | `DA-24` · Qwen3.5 hybrid · 24 layers in a 3:1 rhythm: 18 gated DeltaNet (fast running memory) + 6 full attention (the deep look back), width 2048 | | Mission | Answers questions about a music store by driving a real [MCP](https://modelcontextprotocol.io) server: list the tables, read the columns, write the SQL, give the answer. It never sees the schema up front. | | Held-out questions | 184 (20% of albums, artists and customers never seen in training) | | Before → after | 48.4% → **81.5%** | | Training | 30 GRPO steps · one L40S · 55 min | | Recipe | LoRA r16 · LR 5e-5, cosine to a tenth · 16 questions × 8 rollouts · up to 8 turns of 512 tokens | | Datasets | [chinook](https://github.com/lerocha/chinook-database) (MIT) over the reference [mcp-server-sqlite](https://pypi.org/project/mcp-server-sqlite/), read-only tools | **Reward:** 1 for the right answer, in any phrasing, else 0. Numbers to the cent, names whole-word. A reply that lists guesses gets nothing, so hedging doesn't pay. ## Where it earns its keep | | | |---|---| | **Ask your own database in plain words** | Point it at an MCP server over your data (SQLite, postgres, an internal API) and retrain on your questions. The kit is built for exactly that swap. | | **An analytics helper that shows its work** | Every answer comes from tool calls you can log and replay, not from memory. | | **A template for agent RL** | The cleanest way to see GRPO teach a small model to stop exploring and commit. | ## Mission log Real missions from the held-out set. Same question, before and after training. **How long is the album 'Big Ones' in whole minutes, rounded down?** Before training: ``` 8 tool calls. Out of turns. No answer. ``` After, A-02: ``` 4 tool calls. "The album 'Big Ones' is 73 minutes long." ``` **How long is the album 'Faceless' in whole minutes, rounded down?** Before training: ``` "216006 / 60 = 3600.1. Rounding down gives 3600 minutes." ``` *Divides milliseconds by 60.* After, A-02: ``` "The album 'Faceless' is 47 minutes long." ``` ## Receipts | | right answer (184 held-out) | no answer | |---|---|---| | Base Qwen3.5-2B | 48.4% | 0.0% | | step 10 | 69.0% | 0.0% | | step 20 | 78.8% | 1.1% | | **step 30 (A-02)** | **81.5%** | 0.5% | | step 40 | 77.7% | 4.9% | Greedy decoding, same prompt and budget as training, one run. The highlighted checkpoint ships. **Outside check.** Served on its own, outside the training run, same 184 questions: base 52.7% → adapter 89.1%. Fixed 67, broke 0. 4.7 tool calls a question instead of 5.8, out of turns on 14 questions instead of 68. ## Scars What it cost to get here, and what we learned. - **Score the skill, not the format.** V1 only paid for `` tags. Base scored 0% while it was actually finding most answers in plain sentences. The 0% measured the tags. Fixed, honest baseline: 48.4%. - **A reviewer broke our reward.** Short lists of guesses still scored. Now a name must appear whole, alone. Rescored everything: the base lost one hedged answer, this one lost none. It never learned to hedge. - **Constant LR 1e-4 ate it alive.** Peaked at step 20, then more and more tool calls until it ran out of turns. Half the rate with cosine decay held. ## Pilot's manual ```python from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel tok = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-2B") base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-2B", torch_dtype="bfloat16") model = PeftModel.from_pretrained(base, "superbird-labs/a-02-database-agent") ``` Pass the three read tools (`list_tables`, `describe_table`, `read_query`) with `tools=` and `enable_thinking=False`, run the tool loop yourself. Or `surogate serve Qwen/Qwen3.5-2B --enable-auto-tool-choice` with the adapter loaded at runtime. ## Weak spots - One database, 15 question types. New database, new questions. - A name must match as stored. A different spelling is wrong. - One run, one seed. Expect a few points of wobble. ## Built with One GPU and the open-source [surogate engine](https://github.com/invergent-ai/surogate) (Apache-2.0). The whole kit (configs, environment, reward, walkthrough) is open, so you can rebuild this unit or point it at your own task: [docs.surogate.ai/engine/examples/kits/mcp](https://docs.surogate.ai/engine/examples/kits/mcp/). Also published as [cetusian/octorig-2b](https://huggingface.co/cetusian/octorig-2b). ## The fleet | Serial | Unit | Mission | Before → after | |---|---|---|---| | `L-01` | [l-01-document-extractor](https://huggingface.co/superbird-labs/l-01-document-extractor) | document → the JSON your schema asks for | 67.6% → 87.8% | | `L-02` | [l-02-policy-guard](https://huggingface.co/superbird-labs/l-02-policy-guard) | written policy + message → safe / unsafe | 54.4% → 78.1% | | `L-42` | [l-42-galaxy-guide](https://huggingface.co/superbird-labs/l-42-galaxy-guide) | explains anything, offline | the guide | | `A-01` | [a-01-function-caller](https://huggingface.co/superbird-labs/a-01-function-caller) | phone request → exact function calls | 74.2% → 85.3% | | `A-02` | **a-02-database-agent** | questions answered through a live MCP database | 48.4% → 81.5% | | `A-03` | [a-03-solver](https://huggingface.co/superbird-labs/a-03-solver) | countdown arithmetic, every step written | 1% → 69.5% | --- *Nobody built a model for it. So we did.* **[superbirdlabs.com](https://superbirdlabs.com)**: open small models for every industry, free to run offline, and custom models built for companies. [Docs](https://docs.superbirdlabs.com) | [All models](https://huggingface.co/superbird-labs) | [Work with us](https://superbirdlabs.com/business) | hello@superbirdlabs.com