Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

Clarify reranker terminology in README and env example

Filip Makraduli0beec71678e0
diff --git a/examples/wine-recommender/.env.example b/examples/wine-recommender/.env.example
index 6ae73f172..a9111a50a 100644
--- a/examples/wine-recommender/.env.example
+++ b/examples/wine-recommender/.env.example
@@ -13,12 +13,19 @@ CLUSTER_URL=https://your-sie-cluster-url
API_KEY=your-sie-api-key
# --- Reranker configuration ---
-# "custom" uses SIE `encode` on tasting notes and reviews, then cosine-scores
-# candidates against the user query. Works with the bundled SQLite catalog
-# (which has no per-wine reviews).
-# "standard" uses SIE `score` to rerank candidate reviews against prompt terms.
-# Requires wines to have populated reviews - re-run db_creation to fetch them
-# from Vivino, otherwise every wine will score 0 and matchPercentage will be 0%.
+# Two reranker modes are available:
+#
+# custom: embedding-based reranker. Calls SIE `encode` on generated
+# tasting notes and reviews, then ranks candidates by cosine
+# similarity against the user query embedding. Works with the
+# bundled SQLite catalog (which has no per-wine reviews).
+# Also called "dense re-scoring" in the retrieval literature.
+#
+# standard: cross-encoder reranker. Calls SIE `score` on each
+# (prompt term, wine review) pair. Only produces meaningful
+# scores when wines have review text - re-run db_creation.py
+# to fetch reviews from Vivino first, otherwise every wine will
+# score 0 and matchPercentage will be 0%.
RERANK_METHOD=custom
SIE_RERANK_MODEL=BAAI/bge-reranker-v2-m3
SIE_EMBEDDING_MODEL=BAAI/bge-m3
diff --git a/examples/wine-recommender/README.md b/examples/wine-recommender/README.md
index 2adbc06fd..27cde4cc2 100644
--- a/examples/wine-recommender/README.md
+++ b/examples/wine-recommender/README.md
@@ -27,12 +27,14 @@ The duplicated database files (`wine_flavor.db`) and local `.env` setup are inte
## SIE Features Used
-- [`encode`](https://sie.dev/docs/encode) for tasting-note and review embeddings in the **custom reranker**
-- [`score`](https://sie.dev/docs/score) for cross-encoder reranking of candidate reviews in the **standard reranker**
+- [`encode`](https://sie.dev/docs/encode) for tasting-note and review embeddings in the **embedding-based reranker** (config value `custom`)
+- [`score`](https://sie.dev/docs/score) for cross-encoder reranking of candidate reviews in the **cross-encoder reranker** (config value `standard`)
- [`extract`](https://sie.dev/docs/extract) for OCR-based wine label detection
Retrieval itself (the first stage that narrows 5k+ wines down to a candidate set) runs locally with a TF-IDF cosine over structured flavor and taste attributes, so the first-stage retrieval does not call SIE. SIE engages at the reranking and extraction stages.
+A note on terminology: this demo uses the word "reranker" for both modes, but they are different kinds of reranking. A **cross-encoder reranker** (the `standard` mode) feeds each `(query, document)` pair into one model call and gets a relevance score directly, which is what SIE's `score` primitive does. An **embedding-based reranker** (the `custom` mode) embeds the query and each candidate document independently with SIE `encode`, then ranks by cosine similarity in that dense vector space. Cross-encoders are generally higher precision at the same model budget; embedding-based rerankers are cheaper per candidate and degrade more gracefully when some documents lack the text the cross-encoder would score against.
+
## Why The OCR Flow Matters
The OCR side of the demo shows that SIE is not only useful for text retrieval. In this example, `extract` is used to pull readable text from a bottle label image, then that text is matched against the local wine catalog to identify the bottle.
@@ -134,10 +136,10 @@ If you are running the full demo, put the required backend keys in the root `.en
## Reranker Modes
-The recommendation flow supports two reranking strategies, selected via `RERANK_METHOD` in `.env`:
+The recommendation flow supports two reranking strategies, selected via `RERANK_METHOD` in `.env`. Both re-order the top-20 candidates produced by the local TF-IDF retrieval stage, but they call SIE in different ways:
-- **`custom`** (default): calls SIE [`encode`](https://sie.dev/docs/encode) on generated tasting notes and (when available) per-wine reviews, then cosine-scores candidates against the user query embedding. Works out of the box with the bundled SQLite catalog, which has structured taste and flavor attributes but no per-wine reviews.
-- **`standard`**: calls SIE [`score`](https://sie.dev/docs/score) to rerank each candidate wine's reviews against structure and flavor prompt terms. This mode only produces meaningful scores when wines have reviews - the bundled catalog ships without reviews, so every wine will get a zero rerank score in `standard` mode. If you want to try `standard` mode, re-run the database ingestion under `wine_flavor/db_creation.py` to fetch reviews from Vivino.
+- **`custom` (embedding-based reranker, default)**: calls SIE [`encode`](https://sie.dev/docs/encode) on generated tasting notes and (when available) per-wine reviews, embeds the user query the same way, then ranks candidates by cosine similarity in the shared embedding space. Works out of the box with the bundled SQLite catalog, which has structured taste and flavor attributes but no per-wine reviews. The code calls this path `custom_rerank` and the config value is `custom`; in the retrieval literature this is more precisely an embedding-based reranker or a dense re-scoring pass.
+- **`standard` (cross-encoder reranker)**: calls SIE [`score`](https://sie.dev/docs/score) to rerank each candidate wine's reviews against a set of structure and flavor prompt terms, with each `(term, review)` pair scored by a cross-encoder model such as `BAAI/bge-reranker-v2-m3`. This mode only produces meaningful scores when wines actually have reviews - the bundled catalog ships without reviews, so every wine will get a zero rerank score in `standard` mode. If you want to try `standard` mode, re-run the database ingestion under `wine_flavor/db_creation.py` to fetch reviews from Vivino first.
## What To Try