DEV Community

Cover image for A Stranger Fine-Tuned Qwen2.5-Coder-1.5B-Instruct On My Dataset. And The Results Are Genuinely INSANE.
Sumama-Jameel
Sumama-Jameel

Posted on

A Stranger Fine-Tuned Qwen2.5-Coder-1.5B-Instruct On My Dataset. And The Results Are Genuinely INSANE.

I failed to fine-tune a model on my own dataset twice. Then a developer I had only recently met did it in about 90 minutes on Kaggle's free GPUs. This post defines the problem, shows his method, and shows the numbers, base model first.

The Problem: Big Models Are Costly

Run a coding agent on a frontier model and the meter runs the whole time. Agent work multiplies the cost, because one task means dozens of model calls: read a file, run a command, parse the output, call the next tool. Renting intelligence per token is fine for a demo and painful for anything that runs every day.

What the ecosystem actually needs are small models that can do agent and code work on your own machine: pick the right tool, emit a valid call, and keep going. The catch is that small models fail at exactly this. Hand a 1.5B model a tool catalog and it mostly calls the wrong tool or emits a broken one. I knew that gap from the inside, because my own dataset was built for it and I could not close it myself.

Why I Needed One Working Result

I open-sourced MegaBit-trajectories: 66 episodes of real coding-agent sessions cut from real GitHub commits, MIT licensed, with verify.py so anyone can re-check every checksum in about 60 seconds. A dataset like this only proves its worth when training on it makes a model measurably better. Until that happens, the trajectories are just well-formatted logs.

That is why I needed a fine-tuning result, and not only for myself. One clean result showing that MegaBit trains a better model gives a lab like Sarvam AI a reason to pick up the trajectories and get more out of them. Labs adopt data that has receipts. My two attempts to produce those receipts failed in public: run one broke my pipeline and pushed tool-call schema validity from 79.6 down to 51.9 while GSM8K fell from 34.7 to 11.3, and run two collapsed format accuracy from 80% to 12% (the second failure is documented here). Then my GPU quota hit zero with the question still open.

Who He Is

His name is Abdul Moueed, a developer I got connected with recently. No lab, sponsor or brand: one engineer, one Kaggle account, two free T4s (GitHub, LinkedIn).

He did not send opinions. He sent a 25-cell Kaggle notebook and two JSON files of raw results, and opened PR #1 in my megabit-finetune repo so the whole run is reviewable. That is the entire interaction.

What He Did and How He Did It

Two things. He fine-tuned Qwen2.5-Coder-1.5B-Instruct on MegaBit with LoRA, and he evaluated base against fine-tuned under one identical protocol, then shipped the raw JSONs. The method, from his notebook:

  • Loads the dataset straight off the GitHub repo (the Hugging Face mirror is down) and runs convert_formats.py first, the converter that turns episodes into OpenAI tool-call format
  • Filters the action_only episodes, 56 of them, and holds out 12 with seed 42, so the split happened before any training ran
  • LoRA rank 16, alpha 32, dropout 0.1, targeting all seven projection modules
  • 2 epochs at 2e-4 on a cosine schedule with warmup, batch size 1 with gradient accumulation 8, sequence length 4096, bf16 with no quantization, early stopping on validation loss
  • About 90 minutes on Kaggle's free T4 x2, a zero-cost run
  • Evaluates base and fine-tuned side by side: rebuild the conversation up to each episode's first tool-calling turn, hand the model the tool catalog, generate greedily with a 3,000-token input cap, and score what comes back

Base model results first

Base Qwen2.5-Coder-1.5B-Instruct, straight off the shelf, no training:

Check Base model
All 56 episodes: schema-valid tool calls 74.1% (40 of 54)
All 56: right tool picked 17.9% (10 of 56)
Tool calls emitted 54 total
Held-out 12 episodes: schema-valid 75.0% (9 of 12)
Held-out 12: right tool picked 16.7% (2 of 12)

Read that second row again. Across 56 episodes the base model emitted 54 tool calls, fewer than one per episode, and picked the right tool about one time in six. It barely engages the tools at all. This is the gap everyone hits with small models.

The fine-tuned results

Same mfodel, same eval, and the only difference is the LoRA run on MegaBit-trajectories:

Check Base Fine-tuned
All 56 episodes: schema-valid tool calls 74.1% (40 of 54) 100% (519 of 519)
All 56: right tool picked 17.9% (10 of 56) 92.9% (52 of 56)
Tool calls emitted 54 total 519 total
Held-out 12 episodes: schema-valid 75.0% (9 of 12) 100% (104 of 104)
Held-out 12: right tool picked 16.7% (2 of 12) 91.7% (11 of 12)

Higher than I expected

These results are higher than I expected, and it is worth showing exactly why. Schema validity did not just improve, it hit 100% while call volume grew almost ten times, from 54 to 519: not one broken parse in 519 emitted calls. Right-tool accuracy went from 17.9 to 92.9, and on the 12 episodes that never touched training it holds at 91.7. The volume line is the one I keep staring at, because the corpus did not just teach the model to emit well-formed calls, it taught it that calling tools is the job: from under one call per episode to about nine.

And, His instruments differ from the ones in my two failed runs, so my published numbers stand untouched. What this run answers is a question my instruments never asked: does the corpus, converted through the audit-hardened converter, teach a small open model tool-calling that its base is close to useless at. Answer: yes, on train and held-out, with zero parse failures.

Thank you, Abdul Moueed

The run is his and the credit is his. Abdul Moueed (GitHub, LinkedIn) spent his free Kaggle quota on my dataset and handed back the number I could not produce. The notebook is live on Kaggle and merged as PR #1 with his name on it.

Run it yourself

If you want a small, efficient coding model on your own machine, use MegaBit trajectories to finetune one. It works on a 1.5B model on free GPUs, and it also works on a 0.6B model if finetuned properly: the megabit finetuning pipeline repo ships with a 0.6B config as its default and carries both CPT and SFT pipelines.

And for anyone asking for proof: the repo contains the PRs and the raw JSON results of the model, eval_results.json and eval_results_expanded.json. Check them, or finetune it yourself and send me your numbers. Either direction works.

Top comments (13)

Collapse
 
jackymencz profile image
jackymenCZ (jakcmencz) •

Really cool experiment! 😁🤔 You've already taught a small model to use its tools instead of just sitting there looking clever. Now I'm wondering if there's a way to make it do the same job with a little less baggage.

Have you tried trimming the context window?

Your trajectories have a median length of around 15k tokens, but the training uses a 4,096-token sequence limit. Maybe the model doesn't need to carry the entire history of a conversation on its back just to decide which tool to pick.

I'd try a little experiment: keep the system instructions, tool descriptions, current task and the most relevant recent outputs, but compare 4,096, 3,072 and 2,048 tokens.

Think of it as packing a suitcase. You want everything needed for the trip, not three spare kitchens just in case. 😂

If accuracy and valid tool calls stay roughly the same, you might get a leaner training run and less overhead during inference.

One more thing I'd be curious about: the number of tool calls jumped quite a bit in your results. That could be a good thing, especially with parallel actions, but I'd also check how many are actually useful versus repeated or unnecessary calls.

Getting the right tool is great. Getting the job done without sending the model on twelve unnecessary trips to the toolbox is even better.

Just a thought for your next experiment. Keep the results coming! 😁😊

Collapse
 
jackymencz profile image
jackymenCZ (jakcmencz) •

One more thought. I think there's an interesting optimization path for small models here. Rather than just making the model smarter, I'd try making every token work harder. 🤔😁

Here's how I'd approach it:

         SMALL CODING AGENT
                 |
                 v
      +----------------------+
      |   CURRENT PIPELINE   |
      |                      |
      | Instructions         |
      | Tool descriptions    |
      | Task context         |
      | Conversation history |
      +----------------------+
                 |
                 v
           QWEN 1.5B
                 |
                 v
            TOOL CALLS
                 |
                 v
           TASK RESULT


        THE OPTIMIZATION PATH
                 |
      +----------+----------+
      |                     |
      v                     v
LESS WASTED TOKENS    BETTER TOOL USE
      |                     |
Remove repeated       Keep only relevant
history and noise     tool descriptions
      |                     |
      +----------+----------+
                 |
                 v
        SAME QUALITY TARGET
                 |
                 v
      +----------------------+
      | MEASURE THE RESULT   |
      |                      |
      | Task success rate    |
      | Correct tool choice  |
      | Valid tool calls     |
      | Tokens per task      |
      | Unnecessary calls    |
      | Latency per task     |
      +----------------------+
                 |
                 v
       LOWER COST PER
       SUCCESSFUL TASK
Enter fullscreen mode Exit fullscreen mode

I'd actually split the experiment into two parts:

Experiment A: Inference efficiency

Keep the same fine-tuned model and test different input budgets. Start with your current 3,000-token evaluation limit, then try 2,048 and perhaps 1,536, using smarter context selection rather than blindly cutting off the conversation.

Experiment B: Training efficiency

Keep everything else identical and try shorter training sequences, for example 3,072 instead of 4,096, with carefully compressed trajectories.

Don't change both at once. Otherwise, you won't know which change actually helped.

One metric I'd really like to see is:

COST PER SUCCESSFUL TASK =

Total input + output tokens

Successfully completed tasks

Because there's a difference between a model that makes 10 perfect tool calls and one that makes 5 perfect tool calls.

And here's the fun part: you don't necessarily need a bigger brain. Sometimes you just need to stop making it read the same shopping list five times. 😂

The sweet spot would be a smaller, faster model that completes the same work with fewer tokens, fewer unnecessary calls and no meaningful loss in accuracy.😁😊

That would be a genuinely interesting result to publish.

Collapse
 
sumama-jameel profile image
Sumama-Jameel •

Thanks for laying this out so clearly 😁 I really like the split, it makes it way easier to tell what actually helped.

Experiment B is the one I like most. Cleaning up the trajectories and training on shorter sequences feels like the right next step. You already know I failed twice at finetuning and burned my Kaggle and Colab quotas 😅 So I have no compute right now, but I will run these as soon as I get some back.

Also XD, isn't this just a fancy way of telling me to go finetune again? 😂

Thread Thread
 
jackymencz profile image
jackymenCZ (jakcmencz) •

Hey 😁

I have a slightly unusual question for you.

You know what I've noticed in our conversations? You don't just follow suggestions. You observe, question assumptions, look for missing pieces, adjust your approach and learn from the results.

Honestly, sometimes you remind me of the kind of AI agent we're all trying to build. 😂

The funny part? You're doing it without being an AI agent yourself.

And I'm not saying this just to give you another compliment. I genuinely think you have a rare way of approaching problems, especially at your age.

I remember reading your article where you expressed some doubts about your future and whether there's really a path ahead for you in this field.

Well, I'd like to make a small proposal.

I'd be willing to sponsor your development with $100 per month, to help you continue experimenting, fine-tuning models and exploring your ideas.

Think of it as giving your experiments a little more fuel instead of asking you to build a rocket with an empty tank. 🚀

Since you're under 18, we'd need to arrange everything properly through your parent or legal guardian and a platform that supports this kind of sponsorship. No shortcuts or awkward workarounds.

But before looking into any of that, I want to ask you something:

Would you be interested in this kind of support?

No pressure, no expectations, and no obligation to produce results for me. I wouldn't want you to turn your curiosity into a monthly deadline.

Keep experimenting, keep questioning things, and don't underestimate what you can bring to this field.

Sometimes the most interesting people aren't the ones who already know all the answers. They're the ones who keep asking better questions. 😊😁

Would you be comfortable with that?

Thread Thread
 
sumama-jameel profile image
Sumama-Jameel •

Thanks so much💙, I actually agree, and you already know that I will use that for my startup.

Some genuine questions: How do you think we should do this if my parents agree?(Cause they will agree, or I will convince them if they do not XD) And What platform do you suggest? And should we move somewhere else or dev.to comments are good for this?

Thread Thread
 
jackymencz profile image
jackymenCZ (jakcmencz) •

That's great to hear 😁

I checked GitHub's official rules, and there's good news: GitHub Sponsors allows developers aged 13 and older to receive sponsorships. Since you're under 18, your parent or legal guardian will need to help with the Stripe identity verification process.

Here's what I suggest:

  1. First, discuss this with your parents and make sure they're comfortable with it.
  2. If they agree, we can go through the GitHub Sponsors registration together, with their help.
  3. Once your profile is approved, I'd like to support your development with $100 per month.

I want to make something clear: this is a gift to support your experiments, learning and startup development. It's not a job, an investment, or a contract. You don't owe me monthly results or deliverables. Keep building because you're curious, not because you feel pressured.

For communication, I suggest keeping our technical discussions on DEV.to and moving the financial arrangements to private email, with your parent or legal guardian included. No need to share personal or financial information publicly.

One thing we should check first: Which country do you live in? We need to make sure GitHub Sponsors supports payouts there and that your project meets its eligibility requirements.

And don't worry, I promise the payment setup won't become a more difficult experiment than fine-tuning Qwen. 😁😊

Thread Thread
 
jackymencz profile image
jackymenCZ (jakcmencz) •

I hope this support gives you a little more freedom to experiment, access computing resources and spend more time exploring your ideas. Sometimes the biggest obstacle isn't a lack of ideas, but simply not having enough resources to test them.

I believe in your potential, and I'd like to help remove at least a small part of that obstacle. There's nothing I expect in return. 😊😁

Thread Thread
 
jackymencz profile image
Comment deleted
Thread Thread
 
sumama-jameel profile image
Sumama-Jameel •

Thanks so much for checking this and You are right about all of it. I checked too, and what you said about age and guardian verification is true. I can join at 13+, but Stripe needs my guardian info.

But here is my biggest limitation: I live in Pakistan, and Pakistan is not in GitHub Sponsors supported regions for payouts. So even if my parents agree, I cannot receive through GitHub Sponsors because Stripe does not work here. It is not my age or something else that is blocking me, it is my location.

If my parents agree, can we use another platform that works in Pakistan, like Payoneer, or something else? What do you suggest?

Collapse
 
sumama-jameel profile image
Sumama-Jameel •

That suitcase analogy actually helped me understanding the "why" behind this suggestion. On context, the 4096 cap already cuts a lot, so testing 3072 and 2048 would need a clear rule for what stays and what goes. I can try it and see what changes 🫣

On tool calls, more is not automatically better. Next time I will count how many were needed, how many were repeats, and how many did nothing useful.

Will share numbers if I run it 🫡

Collapse
 
jackymencz profile image
jackymenCZ (jakcmencz) •

Haha, you caught me! 😂 I suggested shrinking the suitcase before properly explaining what we should take out of it.

You're right. Reducing the context from 4096 to 3072 or 2048 tokens is meaningless if we don't first define what information deserves to stay. Otherwise, we might throw away exactly what the model needs to make a good decision.

So I think you've spotted an important missing piece in my suggestion: context selection should come before context reduction.

And that's a useful correction. I'd rather have you challenge the experiment than blindly follow my advice. 😁

Looks like this experiment has already taught us something before we've even run it 😊😁

Thread Thread
 
sumama-jameel profile image
Sumama-Jameel •

Haha thanks for taking it well 😁 Yeah, selection first, then reduction. Will test it once I have compute again.

Collapse
 
sumama-jameel profile image
Sumama-Jameel •

Hey Jacky, I've an update, my parents agreed. But since Github sponsors does not work in Pakistan, what platform should we actually use?

Some comments may only be visible to logged-in visitors. Sign in to view all comments.