You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ce8d9cf
Browse filesBrowse the repository at this point in the historyBrowse files
Most LLM-based classification pipelines use a large language model for every single input. In practice, the vast majority of that traffic is predictable - a lightweight traditional ML model (logistic regression, gradient-boosted trees, or a small neural net) can match the LLM's output with near-perfect agreement.
@@ -22,25 +21,6 @@ TRACER learns the decision boundary between "easy" and "hard" inputs directly fr
teacher TA 0.920 surrogate matches teacher on handled traffic
38
-
39
-
Cost Projection (10k queries/day)
40
-
Without TRACER 10,000 LLM calls/day $20.00/day
41
-
With TRACER 863 LLM calls/day $ 1.73/day $6,670 saved/yr
42
-
```
43
-
44
24
## Quickstart
45
25
46
26
Input: a JSONL file where each line contains the original text (`input`) and the label your LLM assigned (`teacher`).
@@ -63,10 +43,11 @@ out = router.predict("What is my balance?")
63
43
# 3. Fallback - only invokes the LLM when the surrogate declines
64
44
out = router.predict("Some edge case", fallback=lambda: call_my_llm(text))
65
45
```
46
+
The [API reference](docs/api.md) covers fitting, routing, updates, and reports.
47
+
See [concepts](docs/concepts.md) for the pipeline and [watch](docs/watch.md) for
48
+
local trace recording and opt-in exports to your own backend.
66
49
67
-
> **Want to go deeper?** The [concepts guide](docs/concepts.md) explains the full pipeline, model zoo, and parity gate. The [API reference](docs/api.md) covers every parameter. The [CLI reference](docs/cli.md) covers `tracer fit`, `tracer serve`, and more. For observability see [watch](docs/watch.md), and to drive Tracer Cloud from your shell see the [`tracer cloud` reference](docs/cloud.md).
68
-
69
-
## Watch your LLM traffic (free observability)
50
+
## Watch your LLM traffic
70
51
71
52
Before you fit anything, just *watch*. Wrap any LLM call and every request is
72
53
recorded locally as an OpenTelemetry GenAI span, no account, no key, nothing
return call_my_llm(ticket) # traces append to .tracer/watch/*.jsonl
83
64
```
84
65
85
-
Want them in a dashboard? Tracer Cloud observability is **free**. Mint a key
86
-
(`tracer cloud ingest-keys create`, or the Watch page in the app) and set one
87
-
env var, your traffic streams in within seconds, prod-safe (batched, never adds
88
-
latency or throws):
89
-
90
-
```bash
91
-
export TRACER_CLOUD_KEY=trobs_... # or watch(..., cloud_key="trobs_...")
92
-
```
93
-
94
66
The same watched spans map 1:1 to `TraceRecord`, so once you have traffic you can
95
-
`tracerfit` a router from it. Full guide: [docs/watch.md](docs/watch.md).
67
+
call `tracer.fit()` to train a router from it. Full guide: [docs/watch.md](docs/watch.md).
96
68
97
69
## Using from JavaScript / Node.js
98
70
99
-
**Watch your JS LLM calls (free observability):**[`@tracer-llm/watch`](https://www.npmjs.com/package/@tracer-llm/watch) mirrors the Python decorator with zero dependencies, recording every call as an OpenTelemetry GenAI span (local by default, or streamed free to Tracer Cloud).
71
+
**Watch your JS LLM calls (free observability):**[`@tracer-llm/watch`](https://www.npmjs.com/package/@tracer-llm/watch) mirrors the Python decorator with zero dependencies, recording every call as an OpenTelemetry GenAI span (local by default, with opt-in export to your own backend).
Full guide: [docs/javascript.md](docs/javascript.md). To route (not just observe) from JS, log traces, fit offline with the CLI, run `tracerserve` as a sidecar, and call it via `fetch`:
86
+
Full guide: [docs/javascript.md](docs/javascript.md). To route (not just observe) from JS, log traces, fit offline with `tracer.fit()`, run `tracer.serve()` in a Python sidecar, and call it via `fetch`:
The surrogate is **not another LLM** - it is a classical ML or shallow DL model. By default the zoo is lightweight and fast (logistic regression, SGD, and small feed-forward nets); the tree-based models (decision tree, random forest, extra-trees, gradient boosting) are heavier and opt-in with `tracer fit --trees`. This is what makes the cost reduction real: inference is CPU-bound, sub-millisecond, and free.
114
+
The surrogate is **not another LLM** - it is a classical ML or shallow DL model. The Python API searches linear, neural, and tree-based candidates. For a lighter sweep, pass `FitConfig(skip_candidates=("dt", "rf", "et", "gbt", "xgb"))` to exclude tree models. Inference runs locally on your CPU.
143
115
144
116
1.**Fit** - train a suite of candidate surrogates on your LLM's classification traces; select the best via cross-validated teacher agreement
145
117
2.**Gate** - attach a learned acceptor that estimates, per-input, whether the surrogate will agree with the teacher
@@ -155,7 +127,7 @@ The surrogate is **not another LLM** - it is a classical ML or shallow DL model.
_Banking77 is a 77-class task; the tree models help here, so these numbers are with `tracer fit --trees`. The lightweight default (linear + MLP) is faster and enough for most tasks._
130
+
_Banking77 is a 77-class task; these results include tree-based candidates. Candidate selection and coverage depend on your data._
X = tracer.embed(texts) # default: all-MiniLM-L6-v2 (384-dim)
195
167
```
196
168
197
-
## CLI
169
+
## Inspect traffic before fitting
170
+
171
+
`tracer.scan()` groups traces by similarity and estimates the certifiable share
172
+
using held-out bounds. Pass the embeddings that correspond to your trace rows:
198
173
199
-
| Command | What it does |
200
-
|---------|-------------|
201
-
|`tracer demo`| Zero-setup demo on real data |
202
-
|`tracer scan traces.jsonl --html scan.html`| Day-one read: how much traffic is certifiably routable, with a 3D map |
203
-
|`tracer fit traces.jsonl --target 0.95`| Fit a routing policy |
204
-
|`tracer update new_traces.jsonl`| Refit with new traces |
205
-
|`tracer report-html`| Open the HTML report |
206
-
|`tracer serve .tracer --port 8000`| HTTP prediction server |
207
-
|`tracer cloud login`| Drive Tracer Cloud from the terminal: create, train, route, test, and watch tracers, at parity with the dashboard ([docs](docs/cloud.md)) |
`tracer scan` is the fast, conservative first look (similarity grouping plus exact held-out bounds, no training). It needs about 1,000 traces and works best around 5,000; below 1,000 it asks you to collect more, or pass `--force` for a best-effort floor. Embeddings are computed locally by default (sentence-transformers), or point it at your own embedding service with `--embed-url`. `tracer fit` then trains the real router and certifies more of the same traffic. The HTML report includes an interactive 3D map of your embedding space with a verdict/label colour toggle. See the [CLI reference](docs/cli.md) for every flag.
183
+
A scan needs at least 1,000 traces; around 5,000 is recommended. Use `force=True`
184
+
only for an explicitly marked thin-data estimate. It does not train a router;
185
+
use `tracer.fit()` for training. See the [scan guide](docs/scan.md).
[PDF in this repository](research/pricing-capability.pdf) | [Research article](https://tracerml.ai/research/pricing-capability/) | [Canonical PDF](https://tracerml.ai/research/pricing-capability/pricing-capability-paper.pdf)
242
+
[PDF in this repository](research/pricing-capability.pdf)
266
243
267
244
This repository preserves the 21-page final submission dated August 25, 2026. The paper defines Capability Alpha under controlled evaluation, develops Price-Implied Uplift, studies Spirit Aviation's selected data-and-software bid, and compares four public AI data and content agreements. The public PDF preserves the final submission's text, bookmarks, citations, and internal navigation, corrects one internal section reference, and adds descriptive document metadata. It is independent research without a peer review or journal acceptance claim.
Copy file name to clipboardExpand all lines: docs/api.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -478,6 +478,8 @@ class FitConfig:
478
478
min_deploy_coverage: float=0.05
479
479
max_fit_labels: int=8_000
480
480
seed: int=42
481
+
verbose: bool=True
482
+
skip_candidates: tuple= ()
481
483
```
482
484
483
485
| Field | Description |
@@ -487,6 +489,8 @@ class FitConfig:
487
489
|`min_deploy_coverage`| Minimum coverage fraction to consider a method deployable. |
488
490
|`max_fit_labels`| Subsample to this size for efficiency on large datasets (stratified). |
489
491
|`seed`| Random seed for reproducibility. |
492
+
|`verbose`| Emit fitting progress to stderr. Set `False` for quiet runs. |
493
+
|`skip_candidates`| Candidate names to exclude. Use `("dt", "rf", "et", "gbt", "xgb")` for a linear/neural sweep. An empty tuple keeps all available candidates. |
0 commit comments