Repository navigation
Avoid encoding context for cached Tabular predictions - #52
Merged
Merged
Conversation
Signed-off-by: GraysonWu <graysonw@nvidia.com>
Collaborator
Author
|
CI follow-up for
#51 addresses the dependency compatibility problems and installs the built wheels explicitly, with a check of their origin. It is still open. The recommended next step is to update this branch after #51 merges and rerun CI, rather than duplicate those fixes here. The envelope/session test file was rerun locally on this PR: 29 passed, including the new regression tests. Hosted CI remains failing until the shared fixes are incorporated and verified. |
GraysonWu
marked this pull request as ready for review
October 26, 2026 22:02
GraysonWu
requested review from
JGagacheva,
Manushpm8 and
adi-kumo
as code owners
October 26, 2026 22:02
adi-kumo
approved these changes
Oct 27, 2026
Manushpm8
approved these changes
Oct 27, 2026
JGagacheva
pushed a commit
that referenced
this pull request
Nov 2, 2026
Cached Tabular predictions build a full envelope, including encoding every context row, and then discard the context before sending the request. Skip that encoding for session scoring while retaining schema checks, pinned dtype conversion, and query serialization. One-shot predictions and session creation still encode the context. ## Measured benefits Mean one-row prediction latency fell from **467.4 ms to 52.4 ms**: approximately **415 ms saved per call, 89% lower latency, or 8.9× faster**. This improvement comes from removing repeated encoding of the already-cached context. ## Benchmark configuration - GPU: NVIDIA A10G; client and server on the same machine. - Model: Kumo Tabular Large, BF16, one estimator. - Task: fraud classification using a fitted session with a cached context. - Input: 10,000 context rows, 30 numerical features, one query row. - Timed operation: `FittedModel.predict(...).to_pandas()`; context fit and Request construction are outside the timer. ## Validation - Same server and fitted session, two warmups followed by 20 alternating measurements per version. This is a sequential latency comparison, not a throughput or P99 claim. - Payload contents matched excluding request IDs. Predictions were bitwise identical for query batches of 1, 8 and 1,000 rows. - Four regression cases covering classification/regression with and without a pinned schema fail before the change and pass afterward. Public API and all nine wire-payload snapshots are unchanged. - Ruff, formatting, mypy, repository hygiene and attribution checks passed for this patch. - CI currently needs the compatibility and built-wheel test fixes in #51. Verified this patch applied to #51 at `f54b0938af0fcb12706b3a740304d26ae4837f0c` with pandas 3.1.0 and DuckDB 2.0.0: main suite 2,679 passed, separate engine suite 2,580 passed, and 1,963 client tests passed against the exact newly built wheel installed by filename. Live-service tests were excluded; engine verification reused the unchanged native extension. These are local combined-tree results, not a green CI claim for this PR alone. Signed-off-by: GraysonWu <graysonw@nvidia.com> Co-authored-by: Manush Murali <91221099+Manushpm8@users.noreply.github.com> Signed-off-by: Jana Gagacheva <jgagacheva@nvidia.com>
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.
Cached Tabular predictions build a full envelope, including encoding every context row, and then discard the context before sending the request. Skip that encoding for session scoring while retaining schema checks, pinned dtype conversion, and query serialization. One-shot predictions and session creation still encode the context.
Measured benefits
Mean one-row prediction latency fell from 467.4 ms to 52.4 ms: approximately 415 ms saved per call, 89% lower latency, or 8.9× faster. This improvement comes from removing repeated encoding of the already-cached context.
Benchmark configuration
FittedModel.predict(...).to_pandas(); context fit and Request construction are outside the timer.Validation
f54b0938af0fcb12706b3a740304d26ae4837f0cwith pandas 3.1.0 and DuckDB 2.0.0: main suite 2,679 passed, separate engine suite 2,580 passed, and 1,963 client tests passed against the exact newly built wheel installed by filename. Live-service tests were excluded; engine verification reused the unchanged native extension. These are local combined-tree results, not a green CI claim for this PR alone.