Repository navigation
Conversation
When the server cannot use a fitted model's saved cache, it fits the model again for the prediction and says so in the response metadata (cache_outcome is "fallback"). The client stored the metadata but never read that field, so a user whose saved model got slow saw no reason. Each estimator's _finish_predict now logs one warning per prediction call when any request of the prediction fell back. It is a log record, not a Python warning: a warning raised as an error would lose a prediction the server already computed and billed. The text names no cause and gives no refit advice, because the server also reports a fallback when its cache path did not answer in time. The classifier's predict, predict_proba and _predict keep their shape, so subclasses that override _predict are unaffected. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The changelog check requires the fragment to carry the PR number, which is only known once the PR exists. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The tests covered the same paths again along helper axes (via, output type, estimator) and kept a local copy of the offline-server helper. They now reuse _offline_server, which takes an optional metadata argument, and _predict from test_submit_predict.py, and keep one case per distinct invariant: it logs once on a fallback, it logs nothing for the other values, a split prediction logs once, a warning filter set to error still returns the result, a subclass that overrides _predict still works, and the metadata models of both tasks carry the field. 55 tests in 259 lines become 27 in 189. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
eddiebergman-priorlabs
previously approved these changes
Nov 25, 2026
eddiebergman-priorlabs
left a comment
Contributor
There was a problem hiding this comment.
Lovely stuff
A predict on a model whose cache another version wrote either fails or, on a server that offers it, runs without the cache. The client had no way to say which it wants. The new cache_fallback_strategy parameter on both estimators is "error" by default: it raises RefitRequiredError as before and sends nothing new. "refit" sends the key on synchronous predicts, so the server answers at once and rebuilds the cache in the background. ASYNC mode and submit_predict never send it. The value is checked in _prepare_predict, which now shares _validate_choice with output_type. A class-level default keeps estimators pickled by older versions working. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A record that holds a parameter an older client does not know fails to load there. cache_fallback_strategy says how this process talks to the server, not what the model computes, so it joins the transport params: save_model leaves it out and a loaded model uses the default. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Changes
cache_fallback_strategy("error"or"refit", default"error") onTabPFNClassifierandTabPFNRegressor. With"error"a stale cache raisesRefitRequiredError, as before, and the request carries nothing new. With"refit"the synchronous predict sends the key, and a server that offers it answers from the general pool at once and rebuilds the cache in the background. The client does not wait for the rebuild.submit_predict()never send the key and keep raisingRefitRequiredError._prepare_predict, which now shares_validate_choicewithoutput_type. A class-level default keeps estimators pickled by older versions working.save_modelleaves it out, likeapi_mode.api_models.pygets the alias and the optional field on the three predict request classes, as the server's generated models have them.cache_outcome == "fallback", once for a prediction split over several requests (estimator.py).Motivation
After a service upgrade, a fitted model's saved cache can stop working. A server that handles this predicts without the cache from the training data it stores. The answer is correct but slower and billed as a predict without a cache, and a background rebuild keeps the
model_idusable. The user should choose that, not get it by default, so the default stays the error the client always raised.A fallback response says
cache_outcome="fallback". The client kept the metadata and never read it, so a user who stored amodel_idsaw a slow prediction with no reason. The server also reports"fallback"when its cache path did not answer in time, so the text names no cause.The warning is a log record, not a Python warning. A warning raised as an error (
-W error) would lose a prediction the server had already computed and billed. The classifier'spredict,predict_probaand_predictkeep their shape, so subclasses that override_predictare unaffected.The server side is PriorLabs/tabpfn-server#1838.
How it was tested
pytest -q tests/unit: 898 passed, 1 skipped. The shared venv importstabpfn_clientfrom the main checkout, so I ran it withPYTHONPATH=<worktree>/src:<worktree>and checked that the module resolves to the worktree."refit"sends it for the inline and the upload predict, a background job never sends it, andpredict_chunksforwards it.ValueErrorbefore any request;cloneandget_paramskeep the value; a pickle from before the parameter loads and predicts with"error";save_modelleaves it out and a model saved with"refit"loads with the default.KV_CACHE_INVALIDraisesRefitRequiredErrorwhen the server does not fall back._predictand returns an array still gets arrays, and a run withwarnings.simplefilter("error")still gets its result.ruff check src testsandruff format --check src tests: clean.basedpyrighton the five changed source files with a scratch config: 0 errors.tests/integration/test_server_config.py: 1 passed.trunk check(it needs a.venvinside the worktree),tests/integration/test_tabpfn_classifier.py(it overwrites the real token cache) and a round trip against a real server.Open items
"refit"with a 422 (its request bodies forbid unknown fields), which the client raises asRuntimeError. It does so for any fit mode, because the client sends the key whatever the fit mode is. Deploy tabpfn-server#1838 to prod before releasing this PR. A user on the default sends no key and is not affected.PRIOR_KV_INVALID_CACHE_FALLBACKon, and the rebuildPRIOR_KV_STALE_CACHE_REFIT. Both default to off. With the first off,"refit"still raisesRefitRequiredError.submit_predict()never fall back. That needs a server change first (follow-up)."fallback"also covers a cache path that timed out, so the log says only that the saved cache could not be used.cache_outcome, or send another value, log nothing.🤖 Generated with Claude Code