Add classic-ml-vs-llm module: Tribuo 4.3.2 and Smile 7.3.0 text classifiers, a zero-shot LLM client and a cost model
Seeded synthetic support tickets in five categories; Tribuo and Smile logistic regression and Smile naive Bayes against a majority baseline; skewed classes, train/test duplicates, vocabulary drift and the three different answers to a ticket of unseen words; a zero-shot client for OpenAI-compatible endpoints tested against a fake endpoint (no model was called) and a cost formula with assumed prices. Every figure is written to output/ by the tests that assert it. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b69H5rTewUKPyhGS8r
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# classic-ml-vs-llm
|
||||
|
||||
Companion module for the ankurm.com post *Text Classification in Java Without an LLM: Tribuo vs Smile vs a Zero-Shot LLM*.
|
||||
|
||||
Five support-ticket categories, a seeded generator for 3000 synthetic tickets, three classic classifiers
|
||||
(Tribuo `LogisticRegression`, Smile `LogisticRegression`, Smile `DiscreteNaiveBayes`), a majority-class baseline, and a
|
||||
zero-shot client for any OpenAI-compatible endpoint. Every figure in the post comes from `output/`, written by the tests.
|
||||
|
||||
```bash
|
||||
export JAVA_HOME=/path/to/jdk-25 # Smile 7.3.0 is compiled for Java 25
|
||||
scripts/run-all.sh # or: mvn test -pl classic-ml-vs-llm
|
||||
```
|
||||
|
||||
**The data is synthetic.** Accuracy on it measures the harness, not your tickets. **No LLM was called** while this module was
|
||||
written: `ZeroShotLlm` is tested against a local fake endpoint, so no LLM accuracy figure exists here. To measure one, call
|
||||
`new ZeroShotLlm(baseUrl, model, apiKey).score(test)` on `Fixtures.SPLIT.test()` against your own endpoint.
|
||||
|
||||
| Output | Shows |
|
||||
|---|---|
|
||||
| `01-dataset.txt` | class counts, train/test duplicates, sample tickets |
|
||||
| `02-models.txt` | accuracy, macro-F1, training time, latency, model size; Tribuo's evaluator against ours |
|
||||
| `03-confusion-tribuo.txt` | confusion matrix and per-class precision/recall |
|
||||
| `04-imbalance.txt` | accuracy against macro-F1 on skewed classes |
|
||||
| `05-duplicates.txt` | accuracy on tickets seen in training against unseen ones |
|
||||
| `06-vocabulary-drift.txt` | the drop when the wording changes |
|
||||
| `07-no-known-words.txt` | three libraries, three behaviours on a ticket of unseen words |
|
||||
| `08-llm-harness.txt` | request shape and reply guard, against a fake endpoint |
|
||||
| `09-cost-model.txt` | cost formula with assumed prices |
|
||||
| `10-class-file-versions.txt` | the Java version each library's bytecode needs |
|
||||
|
||||
Timing columns drift between runs and machines. Accuracy and F1 are deterministic.
|
||||
Reference in New Issue
Block a user