tiny-jev-support-v03-supervised / JEV_COMPATIBILITY.md
sainath's picture
Upload 17 files
92be313 verified
|
Raw History Blame Contribute Delete
9.01 kB

Compare Tiny-Jev and Jev in the same application

Library version 0.4.0 adds a Jev-shaped request adapter for a documented subset. The trained heads are unchanged. This is not TypeSafe SDK compatibility, a hosted HTTP endpoint, an RLCD reproduction, or evidence of equal model capabilities.

Supported contract

Input/behavior Support
State Nonempty text or finite JSON object/array; structured state is serialized by the existing Tiny-Jev recipe
Question IDs Preserved in answers; IDs are not added to model prompts
Instructions Nonempty strings only
Choice criteria 2–128 options with text descriptions; null descriptions use the option key as text
Score criteria 2–10 ordered text levels, numbered from zero
Noul Instructions only; custom Noul criteria are rejected
Answer fields type, choice/score/noul, probabilities and Score legend as applicable
Batched questions Independently encoded state/question inputs, not Jev's shared-state architecture
Model identity Actual Tiny-Jev repository ID plus weight hash; jev-latest is rejected

Unknown fields, structured instructions/descriptions and unsupported features raise errors. Existing encoder limits apply: 256 tokens per encoded text including state/question formatting. There is no automatic truncation. Requests with long application state may fail; an adapter cannot fix that modeling limitation.

Deliberate response differences: results are Python dictionaries. There is no TypeSafe SDK attribute access, confidence, billing usage, async/streaming API, or HTTP server. Diagnostic top_probability and entropy are under tiny_jev. Do not rename maximum probability to Jev confidence or reuse confidence thresholds without evaluation. An app requiring these missing fields needs an explicit change. The adapter supplies an answers envelope; it does not claim full response-schema compatibility with a strict TypeSafe SDK parser.

Official references reviewed 2026-09-28:

Local use

Install the included tiny_jev-0.4.0-py3-none-any.whl in your GPU environment.

from tiny_jev.compat import JevAdapter

client = JevAdapter.from_release("/path/to/tiny-jev-support-v03-supervised")
response = client.system_one(
    state="I explicitly request a refund.",
    questions={
        "refund": {
            "type": "noul",
            "instructions": "Does the customer explicitly request a refund?",
        }
    },
)
print(response["answers"]["refund"]["noul"])

client.evaluate({"state": state, "questions": questions, "model": client.model_id}) accepts the three-field request envelope. It does not silently redirect a Jev model name to Tiny-Jev. With an already loaded TinyJev, use JevAdapter(model, model_id="sainath/tiny-jev-support-v03-supervised").

The supervised and RL models share this interface. An application can select its provider at initialization and pass the normalized answers dictionary into the same application function. For the Jev provider, use its HTTP response dictionary or explicitly convert SDK objects into that form.

Comparison cases

Use JSONL: one case per line with id, state, questions, and labels. Choice labels are option strings; Noul labels are JSON Booleans; Score labels are observed integer rubric levels. Every question needs a label. Example:

{"id":"example-1","state":"Please refund my payment.","questions":{"refund":{"type":"noul","instructions":"Does the customer explicitly request a refund?"}},"labels":{"refund":true}}

examples/compare_cases.jsonl contains two existing synthetic verification scenarios with four questions each. It tests wiring; it is not a fresh benchmark or independent human evaluation. Supply separately reviewed application examples to evaluate generalization. Do not use Jev predictions as ground-truth labels.

Run the two local providers

From a directory containing the downloaded model folders and examples:

python -m tiny_jev.compare --cases examples/compare_cases.jsonl --local supervised=./tiny-jev-support-v03-supervised --local rl=./tiny-jev-support-v03-rl --output comparison-local --device cuda:0

The runner writes exact input cases, per-provider responses and summary.json. It reports accuracy, Brier, NLL, ten-bin ECE, risk/coverage using the SAME maximum probability definition for all providers, per-type metrics, Score MAE, mistakes, and mean/p95 call latency. Its aggregate accuracy treats each question equally; it does not imply performance on an arbitrary task distribution. Score MAE uses the raw rubric indices and should be interpreted with their scale lengths.

All classification metrics use argmax in the request's option order; ties choose the first option. Jev's reported Choice may select another equally probable option; the application example uses the reported Choice, while metrics use this common tie policy. Noul's binary classification uses [false,true]; exact 0.5 ties choose false. Score classification accuracy uses the highest-probability level, while Score MAE uses the expected level. The example application's thresholds are a separate decision policy and can therefore disagree with these classifications.

Local model loading is measured separately. Call timing includes the first inference, starts with an empty local embedding cache and follows the input order; later repeated texts may reuse cache entries. Remote timings include networking. Record hardware, versions and dataset size. These are application timing samples, not a matched-hardware speed benchmark. Tiny demonstrations cannot support stable p95 or calibration conclusions. Multiple seeds, proper holdouts and uncertainty analysis remain necessary for strong research claims.

Include Jev without making a new API call

Saved response records use:

{"case_id":"example-1","request_sha256":"HASH","response":{"model":"ACTUAL_JEV_VERSION","answers":{"refund":{"type":"noul","noul":0.9}}}}

The number above is illustrative, not a measured Jev result. Compute HASH with tiny_jev.compat.request_hash(case["state"], case["questions"]) at the time the request is sent; retain it with the response. Preserve JSON option insertion order. Optional latency_seconds is a finite nonnegative number measured by the collector. Omit it if unknown. Imported timings are labeled user-supplied.

python -m tiny_jev.compare --cases examples/compare_cases.jsonl --local supervised=./tiny-jev-support-v03-supervised --local rl=./tiny-jev-support-v03-rl --jev-responses jev-responses.jsonl --output comparison-all --device cuda:0

Imported response IDs and request hashes must match exactly. Incorrect option keys, types, distributions, score semantics and incomplete provider outputs are rejected. A failure leaves the run marked failed with partial outputs for diagnosis; the runner does not silently drop difficult examples or report a completed comparison.

Optional live Jev comparison

Only this explicit mode sends your case states/questions to TypeSafe and can incur API charges. Set TYPESAFE_API_KEY through your environment/secret manager, not in a committed notebook. Select an available fixed model version from your account.

python -m tiny_jev.compare --cases examples/compare_cases.jsonl --local supervised=./tiny-jev-support-v03-supervised --local rl=./tiny-jev-support-v03-rl --call-jev --jev-model YOUR_FIXED_JEV_VERSION --output comparison-live --device cuda:0

The API is called once per case, without automatic retries. API credentials are not written to results. Both requested and returned model identities are recorded. No live Jev calls were made during implementation; unit tests use explicit test fixtures. Full response files retain any native Jev confidence/usage values, but these are not substituted into the common comparison metrics.

Compare the application decisions

examples/compare_application.py consumes saved provider response files and shows how identical routing logic behaves for each model:

python examples/compare_application.py comparison-all

It prints decisions and provider disagreement, and does not execute any business actions. Its example route/refund/severity thresholds are illustrative, not tuned or validated deployment policies. Replace that function with your application's actual decision rules. Disagreement alone does not identify which model is correct.

Release status

The new wrapper and comparison utilities have local contract/integration tests. The original heads and encoder/inference modules retain the earlier Kaggle check. The new wheel adds code, so the prior Kaggle report is not proof that every new integration path has been GPU-tested. Run the updated verification script after downloading the final Hub copy. No further training is needed.