Skip to content

armgit / sie

Public Imported from GitHub
0

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

fix(examples): image-search scores SigLIP so400m-384, the model superlinked.com/image-search sells (#476)

svonava395366cd58d0
diff --git a/examples/image-search/README.md b/examples/image-search/README.md
index e3e4e9849..482ad3f3c 100644
--- a/examples/image-search/README.md
+++ b/examples/image-search/README.md
@@ -28,13 +28,15 @@ questions whose first result is a right product.
| Product | Right product first (of 309) |
| --- | --- |
-| SIE SigLIP so400m (`google/siglip-so400m-patch14-224`) | 84.1% |
| Cohere Embed v4 | 84.1% |
+| SIE SigLIP so400m (`google/siglip-so400m-patch14-384`) | 83.2% |
| Voyage multimodal-3.5 | 75.1% |
| GPT-6 Luna captions + OpenAI text-embedding-3-small | 53.4% |
-SIE is ahead of Voyage (47 questions only SIE got right, 19 only Voyage did;
-p < 0.001) and level with Cohere (23 and 23). On Flickr30k and MS-COCO, which are
+SIE is ahead of Voyage (43 questions only SIE got right, 18 only Voyage did;
+p = 0.002). Against Cohere the difference is not significant (23 and 26,
+p = 0.78). `score.py` also prints the smaller `google/siglip-so400m-patch14-224`,
+which scores 84.1% here. On Flickr30k and MS-COCO, which are
street and scene photos rather than products, Cohere and Voyage rank the right
image first more often than SIE; `score.py` prints those too.
@@ -42,7 +44,7 @@ image first more often than SIE; `score.py` prints those too.
| Product | Called as | Photo | Query |
| --- | --- | --- | --- |
-| SIE SigLIP so400m | `google/siglip-so400m-patch14-224` on the open-source SIE server | JPEG bytes | the question |
+| SIE SigLIP so400m | `google/siglip-so400m-patch14-384` on the open-source SIE server, the checkpoint SIE Cloud serves | JPEG bytes | the question |
| Voyage multimodal-3.5 | Voyage `multimodalembeddings` | `input_type="document"` | `input_type="query"` |
| Cohere Embed v4 | Cohere v2 embed, `embed-v4.0`, float | `search_document` | `search_query` |
| GPT-6 Luna captions | GPT-6 Luna captions each photo once (`detail="low"`), then `text-embedding-3-small` embeds the caption | the caption | `text-embedding-3-small` |
@@ -77,7 +79,7 @@ SIE Cloud or at your own server:
```sh
uv run python fetch.py --photos
-sie-server serve -m google/siglip-so400m-patch14-224 # or use SIE Cloud with SIE_API_KEY
+sie-server serve -m google/siglip-so400m-patch14-384 # or use SIE Cloud with SIE_API_KEY
uv run python run.py --base-url http://localhost:8080
uv run python score.py --vectors run-output/vectors
```
diff --git a/examples/image-search/fetch.py b/examples/image-search/fetch.py
index 6b5e5fe1f..0b6d8cc33 100755
--- a/examples/image-search/fetch.py
+++ b/examples/image-search/fetch.py
@@ -31,7 +31,7 @@ HERE = Path(__file__).resolve().parent
EVIDENCE = HERE / "evidence"
DATASET = "superlinked/sie-task-evidence"
-REVISION = "edf371d5d260dcfd64bda9f215713472087b5440"
+REVISION = "96c541a6a72ecb2ca72ee3644caecdb209ed476c"
TASK = "image-search"
API = f"https://huggingface.co/api/datasets/{DATASET}/tree/{REVISION}"
@@ -47,10 +47,10 @@ REQUIRED = (
"inputs/questions.json",
"rankings/e1.json.gz",
"rankings/e0.json.gz",
- "vectors/siglip-so400m-224/images.npy",
- "vectors/siglip-so400m-224/images.ids.json",
- "vectors/siglip-so400m-224/texts.npy",
- "vectors/siglip-so400m-224/texts.ids.json",
+ "vectors/siglip-so400m-384/images.npy",
+ "vectors/siglip-so400m-384/images.ids.json",
+ "vectors/siglip-so400m-384/texts.npy",
+ "vectors/siglip-so400m-384/texts.ids.json",
"stats/e1.json",
"stats/e0.json",
)
diff --git a/examples/image-search/run.py b/examples/image-search/run.py
index 43d78a70e..7629e84a2 100755
--- a/examples/image-search/run.py
+++ b/examples/image-search/run.py
@@ -4,7 +4,7 @@
uv run python fetch.py --photos
SIE_API_KEY=... uv run python run.py # SIE Cloud
uv run python run.py --base-url http://localhost:8080 # your own server:
- # sie-server serve -m google/siglip-so400m-patch14-224
+ # sie-server serve -m google/siglip-so400m-patch14-384
uv run python score.py --vectors run-output/vectors
SigLIP puts a photo and a shopper's words in one 1,152-dimensional space, so
@@ -30,7 +30,7 @@ from sie_sdk import SIEClient
HERE = Path(__file__).resolve().parent
EVIDENCE = HERE / "evidence"
-MODEL = "google/siglip-so400m-patch14-224"
+MODEL = "google/siglip-so400m-patch14-384"
def dense(results: list, sent: int) -> list[list[float]]:
diff --git a/examples/image-search/score.py b/examples/image-search/score.py
index 144a5e15f..0ae633475 100755
--- a/examples/image-search/score.py
+++ b/examples/image-search/score.py
@@ -32,10 +32,10 @@ import numpy as np
HERE = Path(__file__).resolve().parent
EVIDENCE = HERE / "evidence"
-OURS = "sie-siglip-so400m-patch14-224"
+OURS = "sie-siglip-so400m-384-oss"
# The share of right products first that superlinked.com/image-search and its SOURCES.md state.
EXPECTED = {
- OURS: "84.1",
+ OURS: "83.2",
"cohere-embed-v4@1024": "84.1",
"voyage-mm-3.5@1024": "75.1",
"openai-caption-3-small@1024": "53.4",
@@ -83,7 +83,7 @@ def main() -> int:
parser.add_argument(
"--vectors",
type=Path,
- default=EVIDENCE / "vectors" / "siglip-so400m-224",
+ default=EVIDENCE / "vectors" / "siglip-so400m-384",
help="SIE vectors to rank: the recorded ones, or a run.py output directory",
)
args = parser.parse_args()
@@ -101,7 +101,7 @@ def main() -> int:
# 1. Our ranking, recomputed from the vectors, must be the recorded one.
ours = rank_ours(args.vectors, [r["image_id"] for r in catalogue], [q["id"] for q in questions])
recorded = {qid: [image_id for image_id, _ in rows] for qid, rows in rankings[OURS].items()}
- recorded_run = args.vectors == EVIDENCE / "vectors" / "siglip-so400m-224"
+ recorded_run = args.vectors == EVIDENCE / "vectors" / "siglip-so400m-384"
differ = [qid for qid in ours if ours[qid] != recorded[qid][:20]]
if recorded_run and differ:
print(f"{len(differ)} questions rank differently from the recording, e.g. {differ[:3]}", file=sys.stderr)