Uh oh!
There was an error while loading. Please reload this page.
OpenConceptLab/ocl_online#116 | Using Infinity for embedding and reranking with fallback to inline load of model in api/indexing services - #878
Conversation
…nking with fallback to inline load of model in api/indexing services
paynejd
left a comment
There was a problem hiding this comment.
Reviewed end-to-end. Strong PR — using off-the-shelf Infinity instead of a hand-rolled /$embed/+/$rerank/ service is the right call, the NO_LM removal is clean (no lingering settings.LM/settings.ENCODER refs), and the VectorEmbed/Reranker unit tests are good. A few items to address before merge (infra items are on oclinfrastructure#6):
Should-fix
- #1 + #3 (inline suggestion below): the local fallback rebuilds
SentenceTransformeron every call (was a preloaded singleton) and returnsnp.float32instead of.tolist()native floats. Both fixed in one suggestion. - #2 (infra): the memory right-sizing on #6 assumes models never load in-process, but the fallback loads them (the
apifallback also loads the ~1GB+ CrossEncoder). A service outage — the exact case the fallback exists for — is when the slimmed container is most likely to OOM. Keep headroom for a fallback load, or make the fallback explicitly disable-able so a slimmed container fails fast instead of OOM-thrashing.
Verify
- #5 — re-index + normalization parity: Infinity may L2-normalize
all-MiniLM-L6-v2output by default;SentenceTransformer.encodedoes not. Index-time and query-time are consistent going forward (both via the service), but (a) a full re-index is required at cutover since existing prod vectors were built in-process, and (b) a local fallback query against a service-built index could silently degrade kNN if normalization differs. Please confirm cosine(same text) ≈ 1.0 between Infinity and the local model before relying on the fallback.
Nits
- (a)
.env.example:12anddocker-compose.override.yml.bak:40still setNO_LM=TRUE— stale, replace withEMBEDDING_SERVICE_URL/INFINITY_API_KEY. (Couldn't inline-suggest — those lines aren't in the diff.) - (b) inline below — hoist
import requeststo module top. - (f) leaving
apiwithout adepends_ononocl-embeddings-apiis correct — the existing "do not depend on other services" comment is intentional and the fallback handles startup ordering gracefully. No change.
Testing: the fallback tests mock _get_embedding_locally, so they never exercise the real per-call reload (#1) or the np.float32 return (#3), and nothing covers the indexing path (documents.py) going through the service. Worth one test that lets the real local path run on a tiny input and asserts the returned vector is a list of plain floats.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
paynejd
commented
Jun 17, 2026
Re-reviewed at B3 (must-fix) — Reranker reloads the CrossEncoder on every search. B4 (must-fix) — Is the fallback actually viable in prod? Three preconditions, none currently met: (a) the Dockerfile has no model preload, and api/celery mount a volume at Nit — asymmetric error handling. Verify:
|
Linked Issue
Closes OpenConceptLab/ocl_online#116