Repository navigation
feat(fine_tuning): compare few-shot with zero-shot and fine-tuning - #36
Merged
Merged
Conversation
Few-shot uses knowledgator/gliclass-instruct-edge-v1.0 (same size as the edge model and trained to read examples; edge v3.0 given examples puts every row in one label) with one training row per label, which is what fits the 1,024-token window on the parser set. Few-shot scored below zero-shot on both datasets (Banking77 26.0% vs 63.3%, parser checks 15.0% vs 20.0%); fine-tuning stays at 93.3% and 86.7%. SIE's adapter (gliclass 0.1.17) gives the same numbers; serve.py scores all four approaches and matched recipe.py on 840 of 840 decisions. Adds both GLiClass models to MODELS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- check_fits() measures each input as GLiClass builds it (labels, prompt, the row, then the examples); it undercounted by leaving out the prompt. Parser set: 693 tokens at one example per label, 1,111 (refused) at two. - Say what overflow actually does: GLiClass cuts the examples off the end, not the row. - Pass rules.yaml's window to the pipeline as max_length, so editing it changes the model as well as the check. - serve.py records the example count in results.json, as recipe.py does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
Self-reviewTwo passes, code and security, since the diff is 209 lines in 7 files. Nothing Critical, and the security pass found nothing. Fixes are in aa05d36. Important (3, all fixed)
Suggestions
The code pass checked every number in the README against both run outputs, and all of them match. No test row is used as a few-shot example, and nothing refers to the old |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a few-shot step to
fine_tuning/fine_tune_a_decision_model, between zero-shot and fine-tuning, and adds both GLiClass models toMODELS.md.gliclass-instruct-edge-v1.0. It's the same size as the edge model (131 MB), and its model card documents few-shot examples.gliclass-edge-v3.0doesn't read examples: given them, it put every test row in one label at a score of 0.999.check_fits()stops the run instead of letting the model silently cut the row short.Test split
The test rows are held out from training. Banking77 training rows come from its train split and test rows from its test split; the parser set is generated per label and split 17/10. There's no overlap in either dataset. The test sets have 150 and 60 rows.
Tested
recipe.pyrun on an Apple M-series laptop; the fine-tuned numbers are unchanged.serve.pyrun againstv0.11.1-cpu-defaultin Docker: all 840 decisions (4 approaches × 210 rows) match the local run, every score within 0.0001.selfcheck.py(new few-shot check), ruff, mypy--strictandcheck_tree.pypass.🤖 Generated with Claude Code