Spaces:
Running
Running
Sync from felladrin/MiniSearch@a6d99cd
Browse filesFiles changed (6)
1 unmodified line23456781 unmodified line# Renovate keeps this pin current via the customManager in renovate.json,# whose regex matches this exact line: keep the quoted 40-character form.ARG SEARXNG_COMMIT_SHA="2d500cb6b8e98b5f57fb446786e91f8de03be89f"ENV PORT=7860EXPOSE $PORT1 unmodified line23456781 unmodified line# Renovate keeps this pin current via the customManager in renovate.json,# whose regex matches this exact line: keep the quoted 40-character form.ARG SEARXNG_COMMIT_SHA="c6ee3e9fd0235004a694e63720efc869bb1e3594"ENV PORT=7860EXPOSE $PORT
3 unmodified lines4567893 unmodified lines## 2026-11-22- The in-browser AI answers several times faster: the browser engine, wllama, is now version 4.0.0. Measured with Qwen 3.5 0.8B on CPU (four threads, headless Chromium on a Ryzen AI MAX+ 395) over 15 questions run twice: the model reads the prompt 4.1x faster (81 against 20 tokens per second, median), writes the answer 3.7x faster (34 against 9), and loads from the cache in 3.4 seconds instead of 9.4. Models already downloaded stay in the cache and are not downloaded again. A new browser model under 2000 MiB can now ship as the single GGUF file from its original HuggingFace repo, because wllama 4 loads a GGUF as-is; bigger models stay split, since an incognito window stops each file at 2000 MiB.## 2026-11-193 unmodified lines45678910113 unmodified lines## 2026-11-22- `INTERNAL_OPENAI_COMPATIBLE_API_MODEL` now takes several models, separated by commas, in order of preference. When a model fails before the answer starts, the server moves to the next one, and after the last one it starts the list over once. A server with a single model used to give up on the first error; that model now gets one retry, so a short outage of the upstream no longer fails the answer. `/status` also counts each failed attempt by reason (`inference.attemptFailures`: rate limit, server error, other HTTP error, stall, or other), which tells whether the upstream wants fewer requests, a retry or another model.- Search results are ranked much faster on servers with few CPUs, such as a 2-vCPU Hugging Face Space. The reranker's model now uses at most four threads, and no more than the CPUs the server is allowed to use. It used to start one thread per core of the host machine, even inside a container limited to two CPUs, so the threads fought over those two. Under a 2-CPU limit, scoring one result went from 138ms to 5.6ms; the public demo averaged 2.1 seconds per text rerank before this change. Rankings stay the same.- The in-browser AI answers several times faster: the browser engine, wllama, is now version 4.0.0. Measured with Qwen 3.5 0.8B on CPU (four threads, headless Chromium on a Ryzen AI MAX+ 395) over 15 questions run twice: the model reads the prompt 4.1x faster (81 against 20 tokens per second, median), writes the answer 3.7x faster (34 against 9), and loads from the cache in 3.4 seconds instead of 9.4. Models already downloaded stay in the cache and are not downloaded again. A new browser model under 2000 MiB can now ship as the single GGUF file from its original HuggingFace repo, because wllama 4 loads a GGUF as-is; bigger models stay split, since an incognito window stops each file at 2000 MiB.## 2026-11-19
325 unmodified lines326327328329330331332333334325 unmodified lines```When a model stalls or fails before the first token, the server retries withanother model from the provider's list, up to 5 attempts. That ladder needs thelist: with `INTERNAL_OPENAI_COMPATIBLE_API_MODEL` pinned there is no secondmodel to try, so the first failure is the last attempt. Once bytes have beenwritten the status line is already sent, so a later failure arrives as a dataframe carrying an `error` field, followed by `[DONE]`, rather than as a statuscode.325 unmodified lines326327328329330331332333334335325 unmodified lines```When a model stalls or fails before the first token, the server retries withanother model, up to 5 attempts. With `INTERNAL_OPENAI_COMPATIBLE_API_MODEL`empty, the next model is a random one from the provider's list. With it set,the next model is the next one in that comma-separated list, and the list iswalked twice, so a single configured model gets one retry. Once bytes have beenwritten the status line is already sent, so a later failure arrives as a dataframe carrying an `error` field, followed by `[DONE]`, rather than as a statuscode.
54 unmodified lines555657585960615 unmodified lines67686970717254 unmodified lines| ----------------------------------------- | -------------- | ------------------------------------------------------------------ || `INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL` | `''` | Base URL of your API (e.g., `https://api.internal.company.com/v1`) || `INTERNAL_OPENAI_COMPATIBLE_API_KEY` | `''` | API key for authentication || `INTERNAL_OPENAI_COMPATIBLE_API_MODEL` | `''` | Model ID to use (auto-detected if empty) || `INTERNAL_OPENAI_COMPATIBLE_API_NAME` | `Internal API` | Display name shown in UI |**Example:**5 unmodified linesINTERNAL_OPENAI_COMPATIBLE_API_NAME="Company LLM"```### Default Behavior| Variable | Default | Description |54 unmodified lines555657585960615 unmodified lines676869707172737454 unmodified lines| ----------------------------------------- | -------------- | ------------------------------------------------------------------ || `INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL` | `''` | Base URL of your API (e.g., `https://api.internal.company.com/v1`) || `INTERNAL_OPENAI_COMPATIBLE_API_KEY` | `''` | API key for authentication || `INTERNAL_OPENAI_COMPATIBLE_API_MODEL` | `''` | Model ID, or a comma-separated list (random model if empty) || `INTERNAL_OPENAI_COMPATIBLE_API_NAME` | `Internal API` | Display name shown in UI |**Example:**5 unmodified linesINTERNAL_OPENAI_COMPATIBLE_API_NAME="Company LLM"````INTERNAL_OPENAI_COMPATIBLE_API_MODEL` takes several models, separated by commas, in order of preference (`"llama-3.1-8b,qwen-3-8b"`). When a model fails before sending the first token, the server moves to the next one, and after the last one it starts the list over once, up to 5 attempts in all. So a single model gets one retry. Left empty, each request picks a random model from the API's `/models` list, which includes every model the API serves.### Default Behavior| Variable | Default | Description |
379 unmodified lines38038138238338438512 unmodified lines398399400401402403404405406407408409379 unmodified lines| `modelFallbacks` | number | Times a retry moved to another model || `modelsRefetched` | number | Times the model pool was re-listed mid-retry || `streamsEndedWithoutFinish` | number | Attempts whose stream closed with no finish part, counted per attempt because the retry can still succeed || `failed.failedBeforeFirstToken` | number | Every model failed before a token was sent, answered 503 || `failed.failedMidStream` | number | The answer broke after content was already sent, so no retry was possible || `failed.abandoned` | number | The client was gone before or during the answer; the only outcome with no response to observe it by |12 unmodified lines`authorization.bySurface.inference.authorized`, and a gap between the two is arequest that never finished at all.Two fields read differently on a single-model deployment. With`INTERNAL_OPENAI_COMPATIBLE_API_MODEL` set there is no pool to fall back to, sothe loop stops after the first failure: `averageAttempts` cannot exceed 1 and`modelFallbacks` stays at 0 however badly the upstream behaves. The pool alsonever refreshes in that mode, so `modelsRefetched` stays at 0; read`failed.failedBeforeFirstToken` for that case instead.Model ids are configuration rather than user data, and `/inference` alreadysends the id to the browser in every chunk, so naming them here publishes379 unmodified lines38038138238338438538612 unmodified lines399400401402403404405406407408409410411412413414415416417379 unmodified lines| `modelFallbacks` | number | Times a retry moved to another model || `modelsRefetched` | number | Times the model pool was re-listed mid-retry || `streamsEndedWithoutFinish` | number | Attempts whose stream closed with no finish part, counted per attempt because the retry can still succeed || `attemptFailures` | object | Failed attempts by reason: `rateLimited` (429), `serverError` (5xx), `otherHttpError`, `stalled` (no part within the idle timeout) and `other` || `failed.failedBeforeFirstToken` | number | Every model failed before a token was sent, answered 503 || `failed.failedMidStream` | number | The answer broke after content was already sent, so no retry was possible || `failed.abandoned` | number | The client was gone before or during the answer; the only outcome with no response to observe it by |12 unmodified lines`authorization.bySurface.inference.authorized`, and a gap between the two is arequest that never finished at all.With `INTERNAL_OPENAI_COMPATIBLE_API_MODEL` set, the models tried are the onesit lists, in its order, and then the same list once more, so a single modelgets one retry. A retry of the same model counts in `averageAttempts` but notin `modelFallbacks`, which only counts moves to another model, so asingle-model deployment keeps `modelFallbacks` at 0. The list is neverre-fetched in that mode, so `modelsRefetched` stays at 0 too.`attemptFailures` says what to change when `failed.failedBeforeFirstToken`grows: mostly `rateLimited` means the upstream wants fewer or slower requests,`serverError` that a retry or another model can help, and `stalled` that themodel takes longer than the idle timeout to start. An attempt whose streamclosed without a finish part lands in `other`, and is also counted in`streamsEndedWithoutFinish`.Model ids are configuration rather than user data, and `/inference` alreadysends the id to the browser in every chunk, so naming them here publishes
54 unmodified lines55565758596054 unmodified linesScoring one pair at a time removes the padding, and with it the coupling. It also suits the reason batching was introduced in the first place: `onnxruntime-node` wraps a synchronous native call, and one pair holds the event loop for about 13ms instead of the 50ms a batch of 10 takes. The cost is throughput, roughly 12% more wall time for 30 documents on two threads and up to 47% more where there are cores to spare.### ShutdownOn server close, `stopRerankerService()` clears the readiness flag and releases the inference session.54 unmodified lines5556575859606162636454 unmodified linesScoring one pair at a time removes the padding, and with it the coupling. It also suits the reason batching was introduced in the first place: `onnxruntime-node` wraps a synchronous native call, and one pair holds the event loop for about 13ms instead of the 50ms a batch of 10 takes. The cost is throughput, roughly 12% more wall time for 30 documents on two threads and up to 47% more where there are cores to spare.### Thread CountThe session runs on `min(availableParallelism(), 4)` intra-op threads. Left at its default, ONNX Runtime sizes the pool from the host's cores and ignores a container's CPU quota, so on a 2-vCPU host its threads fight over two CPUs: one pair took 138ms there, against 5.6ms with two threads. The public demo, on a 2-vCPU Hugging Face Space, averaged 2131ms per text rerank before the cap. Above four threads a pair this small gets no faster: on 32 unconstrained cores, four threads scored a pair in 3.8ms and the default in 5.6ms. The measurements are in a comment above `MAX_INTRA_OP_THREADS` in `server/rerankerService.ts`.### ShutdownOn server close, `stopRerankerService()` clears the readiness flag and releases the inference session.
Dockerfile+1-1
changelog.md+2
docs/api.md+4-3
docs/configuration.md+3-1
docs/overview.md+14-6
docs/reranking.md+4