R1 revision: MBR agent with training-caption document frequencies
Browse filesEarlier releases computed the MBR document frequencies on the COCO Karpathy-test references. frama_infer.py now uses assets/mbr_df_coco_train.json.gz, computed from the 566,747 COCO training captions; verify_infer.py compares against the R1 files; the README states the correction and the R1 numbers.
- .gitattributes +1 -0
- README.md +21 -9
- assets/mbr_df_coco_train.json.gz +3 -0
- frama_infer.py +4 -2
- verify_infer.py +4 -3
.gitattributes
CHANGED
|
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
assets/coco_train_captions.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
assets/coco_train_captions.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
predictions_r1/** filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -49,7 +49,7 @@ With `--dump_beam`, each record also holds the five retrieved captions, the hard
|
|
| 49 |
and all 20 candidates with every agent score.
|
| 50 |
|
| 51 |
`--config five`, the default, uses bigG, BLIP, VQA, MBR and ground. It is the better choice for
|
| 52 |
-
images outside COCO: NoCaps 82.
|
| 53 |
six-agent stack. `--config six` adds the LM agent and is best on COCO itself.
|
| 54 |
|
| 55 |
## What runs
|
|
@@ -71,13 +71,20 @@ checksum-verified, into `~/.cache/frama`. The other models come from the Hugging
|
|
| 71 |
|
| 72 |
## Results in the paper
|
| 73 |
|
| 74 |
-
Official COCO caption toolkit, CIDEr / SPICE.
|
| 75 |
|
| 76 |
| Benchmark | IFCap top-1 | FRAMA, 6 agents | FRAMA, 5 agents |
|
| 77 |
|---|---|---|---|
|
| 78 |
-
| COCO Karpathy test | 112.7 / 21.0 | 120.
|
| 79 |
-
| NoCaps val, overall | 70.3 / 9.8 | 81.
|
| 80 |
-
| Flickr30k Karpathy test | 63.7 / 17.0 | 70.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
### Fidelity to the paper
|
| 83 |
|
|
@@ -107,10 +114,15 @@ no stored features, so this level of drift is inherent to running the pipeline o
|
|
| 107 |
| `verify_infer.py` | stage-by-stage check against the paper's artifacts |
|
| 108 |
| `assets/coco_train_captions.json` | the retrieval corpus, COCO Karpathy-train captions |
|
| 109 |
| `assets/coco_train_captions_bigG14_fp16.npy` | their ViT-bigG/14 text embeddings, float16, 1.45 GB |
|
| 110 |
-
| `assets/
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
## License
|
| 116 |
|
|
|
|
| 49 |
and all 20 candidates with every agent score.
|
| 50 |
|
| 51 |
`--config five`, the default, uses bigG, BLIP, VQA, MBR and ground. It is the better choice for
|
| 52 |
+
images outside COCO: NoCaps 82.2 against 81.2 CIDEr and Flickr30k 72.3 against 70.7 for the
|
| 53 |
six-agent stack. `--config six` adds the LM agent and is best on COCO itself.
|
| 54 |
|
| 55 |
## What runs
|
|
|
|
| 71 |
|
| 72 |
## Results in the paper
|
| 73 |
|
| 74 |
+
Official COCO caption toolkit, CIDEr / SPICE, revised manuscript (R1, October 2026).
|
| 75 |
|
| 76 |
| Benchmark | IFCap top-1 | FRAMA, 6 agents | FRAMA, 5 agents |
|
| 77 |
|---|---|---|---|
|
| 78 |
+
| COCO Karpathy test | 112.7 / 21.0 | 120.7 / 22.2 | 120.5 / 22.2 |
|
| 79 |
+
| NoCaps val, overall | 70.3 / 9.8 | 81.2 / 11.0 | 82.2 / 11.0 |
|
| 80 |
+
| Flickr30k Karpathy test | 63.7 / 17.0 | 70.7 / 18.3 | 72.3 / 18.5 |
|
| 81 |
+
|
| 82 |
+
**Correction in R1.** Releases before October 2026 computed the n-gram document frequencies of the
|
| 83 |
+
MBR agent on the COCO Karpathy-test reference captions, which lets test statistics into the
|
| 84 |
+
selection. The MBR agent now uses frequencies from the 566,747 COCO training captions of the
|
| 85 |
+
captioner (`assets/mbr_df_coco_train.json.gz`). With the earlier frequencies the six-agent stack
|
| 86 |
+
scored 120.8 / 81.3 / 70.5 CIDEr and the five-agent stack 120.5 / 82.3 / 72.1. The selected
|
| 87 |
+
captions of every rule in the revised paper are in `predictions_r1/`.
|
| 88 |
|
| 89 |
### Fidelity to the paper
|
| 90 |
|
|
|
|
| 114 |
| `verify_infer.py` | stage-by-stage check against the paper's artifacts |
|
| 115 |
| `assets/coco_train_captions.json` | the retrieval corpus, COCO Karpathy-train captions |
|
| 116 |
| `assets/coco_train_captions_bigG14_fp16.npy` | their ViT-bigG/14 text embeddings, float16, 1.45 GB |
|
| 117 |
+
| `assets/mbr_df_coco_train.json.gz` | n-gram document frequencies of the MBR agent, from the COCO training captions |
|
| 118 |
+
| `predictions_r1/<benchmark>/<rule>__<split>.json` | the selected caption of every rule in the revised paper, with the reference captions, in the IFCap evaluation format |
|
| 119 |
+
| `assets/mbr_df_coco_karpathy_test.json.gz` | superseded: frequencies from the test references, used before the R1 revision; do not use |
|
| 120 |
+
|
| 121 |
+
The MBR agent weighs n-grams with document frequencies computed over the COCO training captions of
|
| 122 |
+
the captioner, a fixed text statistic that involves no test data. Its scores equal the released
|
| 123 |
+
`mbr_trainidf_coco.npy` of the revised paper exactly; we rechecked this on 40 COCO beams after the
|
| 124 |
+
change. The end-to-end comparison in the table above was run before the change of frequencies, and
|
| 125 |
+
`verify_infer.py` now compares against the R1 files.
|
| 126 |
|
| 127 |
## License
|
| 128 |
|
assets/mbr_df_coco_train.json.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:43314708f8202580d26a1ca15ed0a436f7e96d1b9646ad72d1d6d7d7026da095
|
| 3 |
+
size 16969177
|
frama_infer.py
CHANGED
|
@@ -363,7 +363,7 @@ def _tok(s):
|
|
| 363 |
|
| 364 |
|
| 365 |
class MbrCider:
|
| 366 |
-
"""CIDEr-D between two candidates, with
|
| 367 |
|
| 368 |
def __init__(self, path):
|
| 369 |
d = json.load(gzip.open(path, "rt"))
|
|
@@ -395,7 +395,9 @@ class MbrCider:
|
|
| 395 |
|
| 396 |
|
| 397 |
def stage_mbr(recs):
|
| 398 |
-
|
|
|
|
|
|
|
| 399 |
for r in recs:
|
| 400 |
v = [cider.vec(_tok(b["caption"])) for b in r["beam"]]
|
| 401 |
K = len(v)
|
|
|
|
| 363 |
|
| 364 |
|
| 365 |
class MbrCider:
|
| 366 |
+
"""CIDEr-D between two candidates, with n-gram document frequencies from the training captions."""
|
| 367 |
|
| 368 |
def __init__(self, path):
|
| 369 |
d = json.load(gzip.open(path, "rt"))
|
|
|
|
| 395 |
|
| 396 |
|
| 397 |
def stage_mbr(recs):
|
| 398 |
+
# Document frequencies from the 566,747 COCO training captions of the captioner. Earlier releases
|
| 399 |
+
# used frequencies computed on the COCO Karpathy-test references, which leaks test information.
|
| 400 |
+
cider = MbrCider(os.path.join(ASSETS, "mbr_df_coco_train.json.gz"))
|
| 401 |
for r in recs:
|
| 402 |
v = [cider.vec(_tok(b["caption"])) for b in r["beam"]]
|
| 403 |
K = len(v)
|
verify_infer.py
CHANGED
|
@@ -3,13 +3,14 @@ COCO Karpathy-test images in retrieval order.
|
|
| 3 |
|
| 4 |
python verify_infer.py --ifcap_root <IFCap checkout with annotations and val2014> \
|
| 5 |
--ref <folder with coco_beam_dump.json, features.npz, vqascore_coco.jsonl, ground_coco.jsonl,
|
| 6 |
-
|
| 7 |
--n 96
|
| 8 |
python verify_infer.py --ifcap_root ... --retrieval_only --n 5000
|
| 9 |
|
| 10 |
Retrieval is compared with caption_coco_image_coco_bigG_9.json, the BLIP-ITM step with
|
| 11 |
..._bigG_blip5.json and its entity file, the beam with the stored dump, every agent with its
|
| 12 |
-
released score file, and the final pick with the paper's prediction files.
|
|
|
|
| 13 |
"""
|
| 14 |
import argparse, json, os
|
| 15 |
import numpy as np
|
|
@@ -51,7 +52,7 @@ else:
|
|
| 51 |
fpos = {str(x): i for i, x in enumerate(npz["image_names"])}
|
| 52 |
vqa = {json.loads(l)["image_name"]: json.loads(l)["vqascore"] for l in open(R("vqascore_coco.jsonl"))}
|
| 53 |
gro = {json.loads(l)["image_name"]: json.loads(l) for l in open(R("ground_coco.jsonl"))}
|
| 54 |
-
mbr = np.load(R("
|
| 55 |
picks = {c: {p["image_name"]: p["prediction"] for p in json.load(open(R(f)))}
|
| 56 |
for c, f in (("six", "stack6_all_equal__overall.json"), ("five", "stack5_noLM_blip_bigG_vqa_mbr_ground__overall.json"))}
|
| 57 |
|
|
|
|
| 3 |
|
| 4 |
python verify_infer.py --ifcap_root <IFCap checkout with annotations and val2014> \
|
| 5 |
--ref <folder with coco_beam_dump.json, features.npz, vqascore_coco.jsonl, ground_coco.jsonl,
|
| 6 |
+
mbr_trainidf_coco.npy, stack6_all_equal__overall.json, stack5_noLM_blip_bigG_vqa_mbr_ground__overall.json> \
|
| 7 |
--n 96
|
| 8 |
python verify_infer.py --ifcap_root ... --retrieval_only --n 5000
|
| 9 |
|
| 10 |
Retrieval is compared with caption_coco_image_coco_bigG_9.json, the BLIP-ITM step with
|
| 11 |
..._bigG_blip5.json and its entity file, the beam with the stored dump, every agent with its
|
| 12 |
+
released score file, and the final pick with the paper's prediction files. Since the R1 revision the MBR
|
| 13 |
+
reference is mbr_trainidf_coco.npy and the prediction files are those of predictions_r1/coco/.
|
| 14 |
"""
|
| 15 |
import argparse, json, os
|
| 16 |
import numpy as np
|
|
|
|
| 52 |
fpos = {str(x): i for i, x in enumerate(npz["image_names"])}
|
| 53 |
vqa = {json.loads(l)["image_name"]: json.loads(l)["vqascore"] for l in open(R("vqascore_coco.jsonl"))}
|
| 54 |
gro = {json.loads(l)["image_name"]: json.loads(l) for l in open(R("ground_coco.jsonl"))}
|
| 55 |
+
mbr = np.load(R("mbr_trainidf_coco.npy")) # R1: MBR document frequencies from the training captions
|
| 56 |
picks = {c: {p["image_name"]: p["prediction"] for p in json.load(open(R(f)))}
|
| 57 |
for c, f in (("six", "stack6_all_equal__overall.json"), ("five", "stack5_noLM_blip_bigG_vqa_mbr_ground__overall.json"))}
|
| 58 |
|