logoalt Hacker News

Good results fine tuning a local LLM like Qwen 3:0.6B to categorize questions

197 pointsby dev-experimentsyesterday at 10:55 PM43 commentsview on HN

Comments

nltoday at 1:56 AM

If you are going to go to the bother of fine tuning for trivial problems like subject classification then I think you'll find Scikit Learn with a SGDClassifier on 2-grams will do probably just as well and be under 1MB for the trained classifier.

You can train it in under a minute, and it will work perfectly well on embedded devices.

Small LLMs are good choices for text classification in two cases:

- If you next to provide in-context examples and classifier based on them.

- Your classification goes beyond simple subject-type classifiers. For example, multiple choice question answering is classification where small LLM will work but traditional ML methods won't/

show 2 replies
deepsquirrelnettoday at 2:57 AM

If you want to go deeper on language models, try these project ideas:

- Zero-shot encoders like tasksource or GliNER

- Natural language inference: https://huggingface.co/blog/dleemiller/nli-xenc-ways-to-use

- GRPO training

- GEPA prompt tuning Qwen 0.6B (or GEPA, then GRPO)

- Use an embedding model and train a classifier (MLP, logistic, svm)

- Use a larger LLM to generate a synthetic dataset (beware of lack of diversity, mine "seed text" from real sources first)

- Synthetically generate "hard examples" where more than one category may be valid and DPO tune your preferred responses

mickael-kerjeantoday at 2:43 AM

If you are interested in small language model to fine tune, gemma3:270m is quite interesting for its size

nextaccountictoday at 3:58 AM

> The model invents new categories (e.g. apartments) and doesn’t stick to the provided list of allowed categories

Can this specific failure mode be solved by providing a grammar that the output must adhere to? (Not sure if Qwen has this feature, it's used for eg. to ensure the output is parseable json)

show 1 reply
doubtfulusertoday at 5:15 AM

But why using an encoder model instead of a BERT based model? For a pure classification that should be easier to train and work quite well

GardenLetter27today at 3:38 PM

If you're gonna fine-tune for a closed set classification problem like this, you could just fine-tune BERT and get a faster model with better performance.

zwapstoday at 5:03 AM

Has anyone compared recently doing something like ModernBERT plus classifier vs. full or lora FT of a small LM like qwen?

pj_mukhtoday at 5:20 AM

“As an example, the question “When did we replace our pool pump?” will be mapped to a category called “pool” before querying the Index database.”

Cool write up! Really appreciate it but incidentally how does this categorization help you get better retrieval results?

show 1 reply
jszymborskitoday at 1:26 AM

I think the Qwen 0.6B is so cool. It is super fast and as illustrated here it has a clear niche, esp. when fine-tuned.

I'm also interested in it as a student for distillation.

electroglyphtoday at 4:04 AM

existing embedding models like alibaba's modernbert tune or one of the jina v5s would probably map query to category automatically. (i.e. store embeddings of each category and calculate cosine sim for each incoming query vs. categories and pick the closest)

also, you could stick a classifier head on a BERT model as another option.

abhashanand1501today at 4:41 AM

Do small language models run on cpus or you still need a gpus to run them?

throwa356262today at 5:32 AM

Are 0.6b models useful without fine tuning?

Half of the times I ask qwen 0.6b "what is 1 + 2?" it ends up in a thinking loop of "but wait, the user is asking me to ..."

show 2 replies
armcattoday at 8:13 AM

I mean it's always nice to play around with sLLM finetuning, but for practical purposes I would always start with a lazy learner using embeddings (something like a small Stella model), pre-embed the topics/categories, embed the question, perform a kNN using cosine distance. You can use an LLM to "expand" the topics before embedding to make them more contextual. This is usually super fast and super simple and gives you a nice baseline. Then I would add a classification head after embedding layer (with maybe some dropout + 2-3 MLP layers) and train my own classifier, and compare that to lazy learner. Only after that would I start finetuning an LLM.

danielhanchentoday at 7:36 AM

Very cool write-up and GitHub repo!

737maxtoday at 2:45 PM

Is it just me or half these comments read like AI

crimsoneertoday at 8:23 AM

Tangentially related, but the UK Gov Incubator for AI has quite a nifty LLM driven classification pipeline for survey answers.

https://github.com/i-dot-ai/consult

VaporJournalAPPtoday at 5:02 AM

[flagged]

mlpickertoday at 6:09 AM

[flagged]

cold_harbortoday at 1:18 PM

[dead]

lastdroptoday at 6:58 AM

[dead]