Repository navigation
fix(registry): keep search intents across colos and slow models - #442
Merged
Merged
Conversation
In production the search box answered sentences without the model. Three things combined. Understandings were cached in the per-colo Cache API, so a sentence understood in one data center was a miss in the next and the model ran again. The 800ms budget sat under the model's measured latency (inference p50 614ms, p90 815ms, max 1256ms over 24 calls), so those reruns mostly timed out. And the minute-long answer cache, keyed by the query alone, kept serving the fallback after the late reply landed. Understandings now live in the global KV-backed cache mount, the budget is 1200ms, and the answer cache key names the understanding it used. Every model call and skip now logs its result and duration, never the query.
Collaborator
Author
|
Agent check, run by hand because CI cannot cover it. Production before this change, read only:
This branch, as a local build reading production D1, Vectorize and Workers AI:
To confirm after deploy: send one new sentence twice with different |
Contributor
🤖 MERGED
GitHub merged this pull request.
Review completed. No finding above 80/100. Selected findings run after merge and open separate pull requests. |
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.
🔗 Linked issue
Related to #440
❓ Type of change
📚 Description
After #440 shipped,
GET /api/skills/searchreturned"understood": nullfor most sentences, so the search box answered them without the model. Three causes combined:edge-cachemount, which is the Workers Cache API. A sentence understood in one colo was a miss in the next, so the model ran again. The same query sent twice within seconds hit the cached understanding on one request and re-ran the model on the other.@cf/meta/llama-3.1-8b-instruct-fastshowed inference alone at p50 614ms, p90 815ms and max 1256ms over 24 calls. With an 800ms budget, many of those reruns timed out.The fix:
cachemount, which every colo reads. The volume is one write per new sentence, so the KV write cost stays negligible.skills-box:v2). A fallback answer and an understood answer for the same query no longer share an entry.search-intentwide event with its result andmodel.durationMs. Previously only fallbacks were logged, which is why skips and slow calls were invisible.The AI binding and the rate limiter work. The model also still serves with no error codes, although it is missing from the current Workers AI catalog listing.