@tuned-tensor/local 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/README.md +84 -210
- package/dist/artifacts.d.ts +3 -4
- package/dist/artifacts.js +55 -33
- package/dist/artifacts.js.map +1 -1
- package/dist/compare.d.ts +1 -8
- package/dist/compare.js +1 -23
- package/dist/compare.js.map +1 -1
- package/dist/contracts.d.ts +59 -366
- package/dist/contracts.js +73 -224
- package/dist/contracts.js.map +1 -1
- package/dist/dataset.d.ts +2 -4
- package/dist/dataset.js +31 -125
- package/dist/dataset.js.map +1 -1
- package/dist/doctor.d.ts +2 -3
- package/dist/doctor.js +23 -161
- package/dist/doctor.js.map +1 -1
- package/dist/evaluation.d.ts +11 -71
- package/dist/evaluation.js +212 -572
- package/dist/evaluation.js.map +1 -1
- package/dist/huggingface-cache.d.ts +8 -7
- package/dist/huggingface-cache.js +16 -8
- package/dist/huggingface-cache.js.map +1 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.js +203 -626
- package/dist/index.js.map +1 -1
- package/dist/local-project.d.ts +1 -11
- package/dist/local-project.js +33 -61
- package/dist/local-project.js.map +1 -1
- package/dist/model-registry.d.ts +3 -16
- package/dist/model-registry.js +76 -292
- package/dist/model-registry.js.map +1 -1
- package/dist/model-server.d.ts +1 -2
- package/dist/model-server.js +9 -18
- package/dist/model-server.js.map +1 -1
- package/dist/orchestrator.d.ts +11 -25
- package/dist/orchestrator.js +246 -566
- package/dist/orchestrator.js.map +1 -1
- package/dist/prefetch.d.ts +1 -5
- package/dist/prefetch.js +14 -19
- package/dist/prefetch.js.map +1 -1
- package/dist/process-runner.d.ts +10 -29
- package/dist/process-runner.js +63 -169
- package/dist/process-runner.js.map +1 -1
- package/dist/process-training.d.ts +0 -1
- package/dist/process-training.js +10 -87
- package/dist/process-training.js.map +1 -1
- package/dist/store.d.ts +1 -3
- package/dist/store.js +92 -290
- package/dist/store.js.map +1 -1
- package/docs/architecture.md +87 -152
- package/docs/spark.md +66 -97
- package/examples/dry-runner.json +14 -0
- package/examples/local-runner.json +8 -6
- package/examples/smoke-spec.json +41 -0
- package/package.json +6 -6
- package/training/local-runner/pyproject.toml +0 -5
- package/training/local-runner/src/evaluate.py +89 -234
- package/training/local-runner/src/model_contract.py +47 -0
- package/training/local-runner/src/prefetch.py +18 -4
- package/training/local-runner/src/serve.py +54 -115
- package/training/local-runner/src/sft_data.py +97 -0
- package/training/local-runner/src/train.py +146 -346
- package/training/local-runner/uv.lock +0 -1197
- package/dist/labeling-sanitize.d.ts +0 -31
- package/dist/labeling-sanitize.js +0 -158
- package/dist/labeling-sanitize.js.map +0 -1
- package/dist/labeling.d.ts +0 -155
- package/dist/labeling.js +0 -496
- package/dist/labeling.js.map +0 -1
- package/dist/openrouter.d.ts +0 -29
- package/dist/openrouter.js +0 -66
- package/dist/openrouter.js.map +0 -1
- package/dist/server.d.ts +0 -9
- package/dist/server.js +0 -211
- package/dist/server.js.map +0 -1
- package/docs/local-workflow-remediation-2026-07-13.md +0 -130
- package/docs/local-workflow-ux-review-2026-07-13.md +0 -458
- package/examples/dpo-preferences.jsonl +0 -2
- package/examples/dpo-run-request.json +0 -34
- package/examples/smoke-run-request.json +0 -34
- package/training/local-runner/src/train_dpo.py +0 -286
package/dist/evaluation.d.ts
CHANGED
|
@@ -1,83 +1,33 @@
|
|
|
1
1
|
import { type BehaviorSpecExample, type EvalReport, type EvalSplit, type LocalRunnerConfig } from "./contracts.js";
|
|
2
2
|
import type { LocalRunReporter } from "./run-reporter.js";
|
|
3
|
-
/**
|
|
4
|
-
* Token-overlap F1 between expected and actual output (bag-of-words, case and
|
|
5
|
-
* whitespace insensitive). This is a cheap deterministic reference-similarity
|
|
6
|
-
* signal for free-text tasks where exact match is always 0 and an LLM judge
|
|
7
|
-
* can be noisy; both scoring paths keep working unchanged alongside it.
|
|
8
|
-
*/
|
|
3
|
+
/** Cheap deterministic free-text similarity reported beside exact match. */
|
|
9
4
|
export declare function tokenF1(expected: string, actual: string): number;
|
|
10
|
-
/**
|
|
5
|
+
/** Deterministic 32-bit FNV-1a seed. */
|
|
11
6
|
export declare function deriveSampleSeed(value: string): number;
|
|
12
|
-
/**
|
|
13
|
-
* Selects `count` examples with a seeded shuffle so that truncated evaluation
|
|
14
|
-
* is a deterministic random sample instead of a dataset-order prefix. The
|
|
15
|
-
* selected examples keep their original relative order, so baseline and
|
|
16
|
-
* candidate evaluations that use the same seed score identical examples.
|
|
17
|
-
*/
|
|
18
7
|
export declare function sampleExamples<T>(examples: T[], count: number, seed: number): T[];
|
|
19
8
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* data. The holdout is a seeded random sample of about `holdoutRatio` of the
|
|
23
|
-
* examples, with at least 1 holdout and at least 1 training example. Both
|
|
24
|
-
* splits preserve the original example order. With fewer than 2 examples the
|
|
25
|
-
* holdout is empty and callers should fall back to training-set evaluation.
|
|
9
|
+
* Inline specs get a deterministic holdout. A real run with fewer than two
|
|
10
|
+
* examples is rejected by the shared validator before this function is used.
|
|
26
11
|
*/
|
|
27
12
|
export declare function splitSpecExamples<T>(examples: T[], seed: number, holdoutRatio?: number): {
|
|
28
13
|
train: T[];
|
|
29
14
|
holdout: T[];
|
|
30
15
|
};
|
|
16
|
+
export declare const INFERENCE_PROTOCOL_VERSION = 2;
|
|
31
17
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* the judge scores conformance to the task, not just similarity to the
|
|
35
|
-
* reference. Without it, a judge treats `expected` as a fact checklist and
|
|
36
|
-
* systematically penalizes outputs trained toward a different style (for
|
|
37
|
-
* example concise summaries) even when they follow the spec.
|
|
38
|
-
*/
|
|
39
|
-
export declare function buildJudgeMessages(args: {
|
|
40
|
-
prompt: string;
|
|
41
|
-
expected: string;
|
|
42
|
-
actual: string;
|
|
43
|
-
taskInstructions?: string;
|
|
44
|
-
}): Array<{
|
|
45
|
-
role: "system" | "user";
|
|
46
|
-
content: string;
|
|
47
|
-
}>;
|
|
48
|
-
export interface EvaluationJudgeAvailability {
|
|
49
|
-
available: boolean;
|
|
50
|
-
reason?: string;
|
|
51
|
-
}
|
|
52
|
-
export declare function evaluationJudgeAvailability(config: LocalRunnerConfig): EvaluationJudgeAvailability;
|
|
53
|
-
/**
|
|
54
|
-
* Fail before model inference when judge scoring cannot run. Exact-match
|
|
55
|
-
* fallback is allowed only when the user opted into it explicitly in config.
|
|
56
|
-
*/
|
|
57
|
-
export declare function assertEvaluationScoringReady(config: LocalRunnerConfig, scoringMode?: "exact_match" | "llm_judge" | "json_fields"): EvaluationJudgeAvailability;
|
|
58
|
-
export type RegressionCategory = "factual" | "omission" | "style" | "fallback" | "other";
|
|
59
|
-
/**
|
|
60
|
-
* Coarse category for a judge reasoning string so comparison reports can
|
|
61
|
-
* answer "what kind of worse?" without re-reading every example. Factual
|
|
62
|
-
* problems dominate omissions, which dominate style notes; fallback marks
|
|
63
|
-
* examples that were never judge-scored (their score is not comparable to
|
|
64
|
-
* judged ones).
|
|
65
|
-
*/
|
|
66
|
-
export declare function classifyJudgeReasoning(reasoning: string | null, scoredBy?: string): RegressionCategory;
|
|
67
|
-
/**
|
|
68
|
-
* Cache key for a baseline evaluation. Baseline outputs are deterministic for
|
|
69
|
-
* a given model, example set, and generation settings, and judge scores only
|
|
70
|
-
* depend on those plus the scoring configuration, so re-running a spec with
|
|
71
|
-
* an unchanged baseline can reuse the previous report instead of paying for
|
|
72
|
-
* inference and judge calls again. The package version participates so rubric
|
|
73
|
-
* or evaluator changes invalidate old entries.
|
|
18
|
+
* Deterministic local scoring needs no network credentials. This function is
|
|
19
|
+
* kept as the shared preflight hook used by validate, doctor, and run.
|
|
74
20
|
*/
|
|
21
|
+
export declare function assertEvaluationScoringReady(config: LocalRunnerConfig): void;
|
|
75
22
|
export declare function baselineCacheKey(args: {
|
|
76
23
|
modelId: string;
|
|
77
24
|
baseModelRevision?: string;
|
|
78
25
|
sourceFingerprint?: string;
|
|
79
26
|
system: string;
|
|
80
27
|
examples: BehaviorSpecExample[];
|
|
28
|
+
evalExamplesTotal: number;
|
|
29
|
+
evalSplit?: EvalSplit;
|
|
30
|
+
evalSampleSeed?: number | null;
|
|
81
31
|
config: LocalRunnerConfig;
|
|
82
32
|
packageVersion: string;
|
|
83
33
|
}): string;
|
|
@@ -98,26 +48,16 @@ export declare function evaluateExamples(args: {
|
|
|
98
48
|
sampleSeed?: number;
|
|
99
49
|
shouldCancel?: () => boolean | Promise<boolean>;
|
|
100
50
|
}): Promise<EvalReport>;
|
|
101
|
-
export declare function rescoreEvalReport(args: {
|
|
102
|
-
report: EvalReport;
|
|
103
|
-
config: LocalRunnerConfig;
|
|
104
|
-
outputPath: string;
|
|
105
|
-
system?: string;
|
|
106
|
-
reporter?: LocalRunReporter;
|
|
107
|
-
}): Promise<EvalReport>;
|
|
108
51
|
export declare function compareEvalReports(baseline: EvalReport, candidate: EvalReport): {
|
|
109
52
|
avg_score_delta: number;
|
|
110
53
|
pass_rate_delta: number;
|
|
111
54
|
exact_match_rate_delta: number;
|
|
112
55
|
token_f1_delta: number;
|
|
113
|
-
judge_only_avg_score_delta: number | null;
|
|
114
56
|
regressions: number;
|
|
115
57
|
improvements: number;
|
|
116
|
-
regression_taxonomy: Record<RegressionCategory, number> | undefined;
|
|
117
58
|
regressed_examples: {
|
|
118
59
|
prompt: string;
|
|
119
60
|
old_score: number;
|
|
120
61
|
new_score: number;
|
|
121
|
-
category: RegressionCategory;
|
|
122
62
|
}[];
|
|
123
63
|
};
|