Spaces:
Running on Zero
Running on Zero
Show benchmark gains, live inference, and three decision labs
Browse filesFiles changed (11)
- .gitattributes+2
- README.md+1-1
- inference.py+13-10
- public/cases.json+1-1
- public/clips/test_000125.mp4Added
- public/images/test_000125_A.pngAdded
- public/images/test_000125_B.pngAdded
- workbench/index.html+34-17
- workbench/lab.css+33-12
- workbench/lab.js+141-100
- workbench/tasks.js+1-2
46 unmodified lines47484946 unmodified linespublic/images/test_000400_B.png filter=lfs diff=lfs merge=lfs -textpublic/images/test_000699_A.png filter=lfs diff=lfs merge=lfs -textpublic/images/test_000699_B.png filter=lfs diff=lfs merge=lfs -text46 unmodified lines474849505146 unmodified linespublic/images/test_000400_B.png filter=lfs diff=lfs merge=lfs -textpublic/images/test_000699_A.png filter=lfs diff=lfs merge=lfs -textpublic/images/test_000699_B.png filter=lfs diff=lfs merge=lfs -textpublic/images/test_000125_A.png filter=lfs diff=lfs merge=lfs -textpublic/images/test_000125_B.png filter=lfs diff=lfs merge=lfs -text
11 unmodified lines1213141516171811 unmodified lines# Critique-then-Rerank · Live InferenceThe Decision Lab presents four tasks: change-state classification, caption factuality, pairwise preference, and listwise selection. The first three show diagnostic examples; listwise selection is the task used at inference. [Project page](https://thirteen7.github.io/Critique-then-Rerank/)Under listwise selection, run one of the preset pairs on ZeroGPU and follow the stream from joint visual encoding through Beam-15 and both decision stages. Swipe, compare side by side, or play the original frames as a four-second clip. The β slider reranks the active Stage 2 pool without another GPU call; the final-caption view keeps the paper setting.11 unmodified lines1213141516171811 unmodified lines# Critique-then-Rerank · Live InferenceThe Decision Lab opens with benchmark results and runs listwise selection on preset LEVIR-CC pairs. Below the live controls, explore a real Beam #15 winner, follow the state-routed trace, and test a fixed caption against two different image pairs. Change-state classification and pairwise preference are also available as diagnostic examples. [Project page](https://thirteen7.github.io/Critique-then-Rerank/)Under listwise selection, run one of the preset pairs on ZeroGPU and follow the stream from joint visual encoding through Beam-15 and both decision stages. Swipe, compare side by side, or play the original frames as a four-second clip. The β slider reranks the active Stage 2 pool without another GPU call; the final-caption view keeps the paper setting.
74 unmodified lines757677787980818283848586878889909192938 unmodified lines10210310410510610710810911011111211311474 unmodified linesconfig = profile(dataset)name = record['name']row = {'name': name, 'timings': {}}yield 'encode', rowstarted = perf_counter()initialize()features = image_features(dataset, 'test', [record], media_root, checkpoints.visual, 'cuda')row['feature_shape'] = list(features.shape)row['timings']['encode'] = perf_counter() - startedyield 'beam', rowstarted = perf_counter()row['captions'] = beam(dataset, features, checkpoints.generator, 'cuda')[0]row['timings']['beam'] = perf_counter() - startedrows = {name: row}first = list(stage1_questions(dataset, [record], rows))yield 'stage1', rowdef score_stage(stage, questions):started = perf_counter()8 unmodified linesscore_stage(1, first)anchor = max(row['stage1'], key=lambda pair: pair[1])[0]_, changed = next_stage(dataset, row['captions'], anchor, config['templates'])row.update(anchor=anchor, changed=changed)second = list(stage2_questions(dataset, [record], rows, config['templates']))row['eligible'] = list(second[0]['native_candidate_indices'].values()) if second else [index for index, _ in row['stage2']]yield 'gate', {key: value for key, value in row.items() if key != 'stage2'}if second:yield 'stage2', {key: value for key, value in row.items() if key != 'stage2'}score_stage(2, second)yield 'done', {**row, 'final': decision(dataset, row, config['beta'], config['templates'])}74 unmodified lines7576777879808182838485868788899091928 unmodified lines10110210310410510610710810911011111211311411511611774 unmodified linesconfig = profile(dataset)name = record['name']row = {'name': name, 'timings': {}}started = perf_counter()initialize()features = image_features(dataset, 'test', [record], media_root, checkpoints.visual, 'cuda')row['feature_shape'] = list(features.shape)row['timings']['encode'] = perf_counter() - startedyield 'encode', row.copy()started = perf_counter()row['captions'] = beam(dataset, features, checkpoints.generator, 'cuda')[0]row['timings']['beam'] = perf_counter() - startedyield 'beam', row.copy()rows = {name: row}first = list(stage1_questions(dataset, [record], rows))def score_stage(stage, questions):started = perf_counter()8 unmodified linesscore_stage(1, first)anchor = max(row['stage1'], key=lambda pair: pair[1])[0]row['anchor'] = anchoryield 'stage1', row.copy()_, changed = next_stage(dataset, row['captions'], anchor, config['templates'])row['changed'] = changedyield 'gate', row.copy()if changed:second = list(stage2_questions(dataset, [record], rows, config['templates']))row['eligible'] = list(second[0]['native_candidate_indices'].values()) if second else [index for index, _ in row['stage2']]yield 'filter', {key: value for key, value in row.items() if key != 'stage2'}if second:score_stage(2, second)yield 'stage2', row.copy()yield 'done', {**row, 'final': decision(dataset, row, config['beta'], config['templates'])}
1[{"name": "test_000699.png", "media": ["images/test_000699_A.png", "images/test_000699_B.png"], "clip": "clips/test_000699.mp4", "en": "Roadside houses", "zh": "沿路房屋", "title_en": "Choosing a more precise location", "title_zh": "选出更准确的位置描述", "summary_en": "Stage 1 locks Changed with Beam #1; Stage 2 selects Beam #2, which locates the houses along the road.", "summary_zh": "第一阶段用 Beam #1 锁定有变化;第二阶段选中 Beam #2,将房屋的位置描述为沿路。", "replay": {"captions": ["a row of houses is built on the right side of the scene", "a row of houses is built along the road", "a row of houses are built on the right side of the scene", "a row of houses is built on both sides of the road", "a row of houses is built on the right side of the road", "some houses are built on the right side of the road", "some houses are built along the road", "a row of houses is built on the right side", "a row of houses are built along the road", "a row of houses is built at the right corner of the scene", "a row of houses is built on the right", "some houses are built on the right side of the scene", "a row of houses is built at the edge of the scene", "some houses are built on both sides of the road", "a row of houses is built on the bareland"], "stage1": [[0, 0.1111542209982872], [1, 0.06741844117641449], [2, 0.08931492269039154], [3, 0.059496570378541946], [4, 0.07176656275987625], [5, 0.05417224019765854], [6, 0.057666048407554626], [7, 0.0653441920876503], [8, 0.07176656275987625], [9, 0.0653441920876503], [10, 0.06741844117641449], [11, 0.06138518452644348], [12, 0.050890110433101654], [13, 0.043528616428375244], [14, 0.06333376467227936]], "stage2": [[5, 0.05558950826525688], [11, 0.07364413142204285], [3, 0.04196116328239441], [14, 0.06918226182460785], [1, 0.09165161103010178], [0, 0.09456093609333038], [7, 0.09756262600421906], [12, 0.05387919768691063], [2, 0.07137834280729294], [6, 0.04905756935477257], [4, 0.08883178234100342], [10, 0.07364413142204285], [13, 0.025450732558965683], [8, 0.06299116462469101], [9, 0.050614822655916214]]}}, {"name": "test_000033.png", "en": "False Positive Blocked", "zh": "误报拦截", "media": ["images/test_000033_A.png", "images/test_000033_B.png"], "title_en": "Stage 1 Blocks Hallucinated Construction", "title_zh": "第一阶段拦截无变化幻觉", "summary_en": "Beam-15 top-1 hallucinates a new building at the bottom of the scene. Stage 1 locks the state to Unchanged and skips Stage 2 by construction.", "summary_zh": "Beam-15 首句在底部幻觉出新建筑;第一阶段将状态锁定为“无变化”,结构上直接跳过第二阶段精排。", "clip": "clips/test_000033.mp4", "replay": {"captions": ["a building appears at the bottom of the scene", "a building is built at the bottom of the scene", "the scene is the same as before", "a small building is built at the bottom of the scene", "a small building appears at the bottom of the scene", "the scene is removed and a building is built at the bottom", "some buildings are built at the bottom of the scene", "some buildings appear at the bottom of the scene", "a villa is built at the bottom of the scene", "a house is built at the bottom of the scene", "the scene is removed and a building appears at the bottom", "two buildings appear at the bottom of the scene", "a building appears at the bottom right corner of the scene", "a building is built at the bottom right corner of the scene", "two buildings are built at the bottom of the scene"], "stage1": [[0, 0.03613479062914848], [1, 0.029035119339823723], [2, 0.7034565210342407], [3, 0.021242547780275345], [4, 0.02407095767557621], [5, 0.018169714137911797], [6, 0.020588982850313187], [7, 0.018169714137911797], [8, 0.024835053831338882], [9, 0.018169714137911797], [10, 0.014599774032831192], [11, 0.017610691487789154], [12, 0.015063220635056496], [13, 0.017610691487789154], [14, 0.021242547780275345]], "stage2": []}}, {"name": "test_001549.png", "en": "Same-State Reranking", "zh": "同状态精排", "media": ["images/test_001549_A.png", "images/test_001549_B.png"], "title_en": "Stage 2 Refines Singular to Plural Houses", "title_zh": "第二阶段修正对象与复数表达", "summary_en": "Both Beam-15 top-1 and Stage 1 select a changed caption (\"a building\"). Stage 2 compares only changed candidates and promotes \"some houses\", aligning with the scene.", "summary_zh": "Beam-15 首句与第一阶段都选中变化句(a building);第二阶段仅在变化候选内重排,选中更贴合画面的 some houses。", "clip": "clips/test_001549.mp4", "replay": {"captions": ["a building appears at the bottom right corner of the scene", "some houses appear at the bottom right corner of the scene", "a building appears at the bottom of the scene", "a house appears at the bottom right corner of the scene", "some houses appear at the bottom of the scene", "some buildings appear at the bottom right corner of the scene", "a house appears at the bottom of the scene", "some buildings appear at the bottom of the scene", "a villa appears at the bottom right corner of the scene", "a few houses appear at the bottom of the scene", "a few houses appear at the bottom right corner of the scene", "some houses are built at the bottom right corner of the scene", "a small building appears at the bottom right corner of the scene", "two houses appear at the bottom right corner of the scene", "a corner of houses appears at the bottom of the scene"], "stage1": [[0, 0.09699154645204544], [1, 0.09400742501020432], [2, 0.06069576367735863], [3, 0.08559473603963852], [4, 0.0646103024482727], [5, 0.08559473603963852], [6, 0.05031855031847954], [7, 0.05031855031847954], [8, 0.06666125357151031], [9, 0.05882834643125534], [10, 0.08040881901979446], [11, 0.051915835589170456], [12, 0.04303973913192749], [13, 0.06069576367735863], [14, 0.05031855031847954]], "stage2": [[11, 0.0644257590174675], [0, 0.09978457540273666], [12, 0.053410835564136505], [9, 0.03139860928058624], [2, 0.03557928651571274], [4, 0.04427913948893547], [3, 0.09085488319396973], [7, 0.04427913948893547], [1, 0.12418390810489655], [8, 0.060522403568029404], [13, 0.09978457540273666], [6, 0.023700913414359093], [10, 0.07771230489015579], [5, 0.1166599839925766], [14, 0.03342364728450775]]}}, {"name": "test_001324.png", "en": "Length Calibration (β)", "zh": "长度惩罚权衡", "media": ["images/test_001324_A.png", "images/test_001324_B.png"], "title_en": "Drag β to Observe Concise vs. Verbose Reranking", "title_zh": "拖动 β 观察简洁与冗长候选的切换", "summary_en": "At β = 0.00, Stage 2 prefers the longer phrase (\"at the bottom side of the scene\"). With Val-selected β = 0.12, length calibration selects the concise top candidate without rewriting text.", "summary_zh": "当 β = 0.00 时第二阶段偏向较长表达(at the bottom side of the scene);启用验证集选定的 β = 0.12 后,无需重写文本即可重排回更简洁的候选句。", "clip": "clips/test_001324.mp4", "replay": {"captions": ["a road is built at the bottom", "a road is built at the bottom side of the scene", "a road is built on the bottom side of the scene", "a road appears at the bottom", "a road is built on the bareland", "a road is built on the bottom", "a road is built at the bottom of the scene", "a road appears at the bottom of the scene", "a road appears at the bottom side of the scene", "a road is built at the bottom left corner of the scene", "a road and a road is built on the bottom", "a road appears at the bottom left corner of the scene", "a road are built at the bottom", "a road and a road is built on the bareland", "a road appears on the bareland"], "stage1": [[0, 0.0876748338341713], [1, 0.07737276703119278], [2, 0.07499226182699203], [3, 0.0876748338341713], [4, 0.04995561018586159], [5, 0.062170762568712234], [6, 0.0876748338341713], [7, 0.07737276703119278], [8, 0.08236288279294968], [9, 0.06828122586011887], [10, 0.04141465947031975], [11, 0.06025797501206398], [12, 0.045485105365514755], [13, 0.03890547156333923], [14, 0.05840403214097023]], "stage2": [[0, 0.09296959638595581], [14, 0.07707450538873672], [6, 0.09010922163724899], [4, 0.051342688500881195], [2, 0.07707450538873672], [11, 0.06801801919937134], [13, 0.022082215175032616], [8, 0.08204538375139236], [5, 0.05817888677120209], [1, 0.10210712999105453], [7, 0.08464978635311127], [10, 0.02502242848277092], [3, 0.07707450538873672], [12, 0.02835412509739399], [9, 0.0638970136642456]]}}, {"name": "test_001095.png", "en": "Boundary / Failure Case", "zh": "边界与失败案例", "media": ["images/test_001095_A.png", "images/test_001095_B.png"], "title_en": "Honest Boundary: Missed Change Cannot Be Flipped", "title_zh": "算法边界:初筛漏报锁定后不可翻转", "summary_en": "A small corner house appears on the right and is present in Beam-15 top-1, but Stage 1 predicts Unchanged. Because state-locking is structural, Stage 2 cannot override a Stage 1 false negative.", "summary_zh": "画面右侧出现小范围房屋变化且位于 Beam-15 首句中,但第一阶段误判为无变化;由于状态锁定是结构保证,第二阶段无法挽回初筛漏报。", "clip": "clips/test_001095.mp4", "replay": {"captions": ["a building is built on the right", "a building is built on the bareland", "the scene is the same as before", "a scene is built on the right", "some buildings are built on the right", "some buildings are built on the bareland", "a scene is built on the bareland", "two buildings are built on the right", "a large building is built on the right", "two buildings are built on the bareland", "a building is built on the right side of the scene", "a small building is built on the right", "a building is built on the right side", "a few buildings are built on the right", "a scene is built on the right side of the scene"], "stage1": [[0, 0.05586867779493332], [1, 0.024791575968265533], [2, 0.5642536878585815], [3, 0.03839794546365738], [4, 0.02898428961634636], [5, 0.022572988644242287], [6, 0.026390496641397476], [7, 0.025578545406460762], [8, 0.0360715277493], [9, 0.02055293880403042], [10, 0.031833015382289886], [11, 0.025578545406460762], [12, 0.0360715277493], [13, 0.028092535212635994], [14, 0.034961726516485214]], "stage2": []}}]1[{"name": "test_000125.png", "media": ["images/test_000125_A.png", "images/test_000125_B.png"], "clip": "clips/test_000125.mp4", "en": "Beam #15 rises to #1", "zh": "Beam #15 升到第一", "title_en": "Houses along the road", "title_zh": "沿路新建的房屋", "summary_en": "The generator ranks this caption fifteenth. The two-stage reranker selects it from the same pool.", "summary_zh": "生成器将这句描述排在第 15 位,两阶段重排从同一候选池选中了它。", "replay": {"captions": ["a road and many houses are built on both sides of the road", "trees are removed and many houses are built on both sides of the road", "many houses are built along the road appear in the desert", "a road with many houses are built on both sides of the road", "a road and many houses are built along the road", "trees are removed and a row of houses are built on both sides of the road", "many houses are built along the road appear on both sides of the road", "trees are removed and some houses are built on both sides of the road", "many houses are built along the road in the desert", "a road with many houses are built along the road", "trees are removed and many houses are built along the road", "trees are removed and a row of houses are built along the road", "a road and some houses are built on both sides of the road", "a road with some houses are built on both sides of the road", "many houses are built along the road"], "stage1": [[0, 0.08761408179998398], [1, 0.06021621823310852], [2, 0.08230581134557724], [3, 0.07977353036403656], [4, 0.0682339146733284], [5, 0.06409982591867447], [6, 0.06409982591867447], [7, 0.05150565877556801], [8, 0.07977353036403656], [9, 0.06409982591867447], [10, 0.0682339146733284], [11, 0.06212768331170082], [12, 0.04838508740067482], [13, 0.04689643904566765], [14, 0.07263462245464325]], "stage2": [[8, 0.05565875023603439], [11, 0.05394630879163742], [4, 0.08894243091344833], [14, 0.07373587042093277], [6, 0.05742555111646652], [3, 0.07849142700433731], [7, 0.05394630879163742], [9, 0.06112918257713318], [0, 0.09467872977256775], [13, 0.05565875023603439], [12, 0.06713727116584778], [10, 0.059248436242341995], [5, 0.06507167965173721], [1, 0.08098301291465759], [2, 0.05394630879163742]]}}, {"name": "test_000699.png", "media": ["images/test_000699_A.png", "images/test_000699_B.png"], "clip": "clips/test_000699.mp4", "en": "Roadside houses", "zh": "沿路房屋", "title_en": "Choosing a more precise location", "title_zh": "选出更准确的位置描述", "summary_en": "Stage 1 locks Changed with Beam #1; Stage 2 selects Beam #2, which locates the houses along the road.", "summary_zh": "第一阶段用 Beam #1 锁定有变化;第二阶段选中 Beam #2,将房屋的位置描述为沿路。", "replay": {"captions": ["a row of houses is built on the right side of the scene", "a row of houses is built along the road", "a row of houses are built on the right side of the scene", "a row of houses is built on both sides of the road", "a row of houses is built on the right side of the road", "some houses are built on the right side of the road", "some houses are built along the road", "a row of houses is built on the right side", "a row of houses are built along the road", "a row of houses is built at the right corner of the scene", "a row of houses is built on the right", "some houses are built on the right side of the scene", "a row of houses is built at the edge of the scene", "some houses are built on both sides of the road", "a row of houses is built on the bareland"], "stage1": [[0, 0.1111542209982872], [1, 0.06741844117641449], [2, 0.08931492269039154], [3, 0.059496570378541946], [4, 0.07176656275987625], [5, 0.05417224019765854], [6, 0.057666048407554626], [7, 0.0653441920876503], [8, 0.07176656275987625], [9, 0.0653441920876503], [10, 0.06741844117641449], [11, 0.06138518452644348], [12, 0.050890110433101654], [13, 0.043528616428375244], [14, 0.06333376467227936]], "stage2": [[5, 0.05558950826525688], [11, 0.07364413142204285], [3, 0.04196116328239441], [14, 0.06918226182460785], [1, 0.09165161103010178], [0, 0.09456093609333038], [7, 0.09756262600421906], [12, 0.05387919768691063], [2, 0.07137834280729294], [6, 0.04905756935477257], [4, 0.08883178234100342], [10, 0.07364413142204285], [13, 0.025450732558965683], [8, 0.06299116462469101], [9, 0.050614822655916214]]}}, {"name": "test_000033.png", "en": "False Positive Blocked", "zh": "误报拦截", "media": ["images/test_000033_A.png", "images/test_000033_B.png"], "title_en": "Stage 1 Blocks Hallucinated Construction", "title_zh": "第一阶段拦截无变化幻觉", "summary_en": "Beam-15 top-1 hallucinates a new building at the bottom of the scene. Stage 1 locks the state to Unchanged and skips Stage 2 by construction.", "summary_zh": "Beam-15 首句在底部幻觉出新建筑;第一阶段将状态锁定为“无变化”,结构上直接跳过第二阶段精排。", "clip": "clips/test_000033.mp4", "replay": {"captions": ["a building appears at the bottom of the scene", "a building is built at the bottom of the scene", "the scene is the same as before", "a small building is built at the bottom of the scene", "a small building appears at the bottom of the scene", "the scene is removed and a building is built at the bottom", "some buildings are built at the bottom of the scene", "some buildings appear at the bottom of the scene", "a villa is built at the bottom of the scene", "a house is built at the bottom of the scene", "the scene is removed and a building appears at the bottom", "two buildings appear at the bottom of the scene", "a building appears at the bottom right corner of the scene", "a building is built at the bottom right corner of the scene", "two buildings are built at the bottom of the scene"], "stage1": [[0, 0.03613479062914848], [1, 0.029035119339823723], [2, 0.7034565210342407], [3, 0.021242547780275345], [4, 0.02407095767557621], [5, 0.018169714137911797], [6, 0.020588982850313187], [7, 0.018169714137911797], [8, 0.024835053831338882], [9, 0.018169714137911797], [10, 0.014599774032831192], [11, 0.017610691487789154], [12, 0.015063220635056496], [13, 0.017610691487789154], [14, 0.021242547780275345]], "stage2": []}}, {"name": "test_001549.png", "en": "Same-State Reranking", "zh": "同状态精排", "media": ["images/test_001549_A.png", "images/test_001549_B.png"], "title_en": "Stage 2 Refines Singular to Plural Houses", "title_zh": "第二阶段修正对象与复数表达", "summary_en": "Both Beam-15 top-1 and Stage 1 select a changed caption (\"a building\"). Stage 2 compares only changed candidates and promotes \"some houses\", aligning with the scene.", "summary_zh": "Beam-15 首句与第一阶段都选中变化句(a building);第二阶段仅在变化候选内重排,选中更贴合画面的 some houses。", "clip": "clips/test_001549.mp4", "replay": {"captions": ["a building appears at the bottom right corner of the scene", "some houses appear at the bottom right corner of the scene", "a building appears at the bottom of the scene", "a house appears at the bottom right corner of the scene", "some houses appear at the bottom of the scene", "some buildings appear at the bottom right corner of the scene", "a house appears at the bottom of the scene", "some buildings appear at the bottom of the scene", "a villa appears at the bottom right corner of the scene", "a few houses appear at the bottom of the scene", "a few houses appear at the bottom right corner of the scene", "some houses are built at the bottom right corner of the scene", "a small building appears at the bottom right corner of the scene", "two houses appear at the bottom right corner of the scene", "a corner of houses appears at the bottom of the scene"], "stage1": [[0, 0.09699154645204544], [1, 0.09400742501020432], [2, 0.06069576367735863], [3, 0.08559473603963852], [4, 0.0646103024482727], [5, 0.08559473603963852], [6, 0.05031855031847954], [7, 0.05031855031847954], [8, 0.06666125357151031], [9, 0.05882834643125534], [10, 0.08040881901979446], [11, 0.051915835589170456], [12, 0.04303973913192749], [13, 0.06069576367735863], [14, 0.05031855031847954]], "stage2": [[11, 0.0644257590174675], [0, 0.09978457540273666], [12, 0.053410835564136505], [9, 0.03139860928058624], [2, 0.03557928651571274], [4, 0.04427913948893547], [3, 0.09085488319396973], [7, 0.04427913948893547], [1, 0.12418390810489655], [8, 0.060522403568029404], [13, 0.09978457540273666], [6, 0.023700913414359093], [10, 0.07771230489015579], [5, 0.1166599839925766], [14, 0.03342364728450775]]}}, {"name": "test_001324.png", "en": "Length Calibration (β)", "zh": "长度惩罚权衡", "media": ["images/test_001324_A.png", "images/test_001324_B.png"], "title_en": "Drag β to Observe Concise vs. Verbose Reranking", "title_zh": "拖动 β 观察简洁与冗长候选的切换", "summary_en": "At β = 0.00, Stage 2 prefers the longer phrase (\"at the bottom side of the scene\"). With Val-selected β = 0.12, length calibration selects the concise top candidate without rewriting text.", "summary_zh": "当 β = 0.00 时第二阶段偏向较长表达(at the bottom side of the scene);启用验证集选定的 β = 0.12 后,无需重写文本即可重排回更简洁的候选句。", "clip": "clips/test_001324.mp4", "replay": {"captions": ["a road is built at the bottom", "a road is built at the bottom side of the scene", "a road is built on the bottom side of the scene", "a road appears at the bottom", "a road is built on the bareland", "a road is built on the bottom", "a road is built at the bottom of the scene", "a road appears at the bottom of the scene", "a road appears at the bottom side of the scene", "a road is built at the bottom left corner of the scene", "a road and a road is built on the bottom", "a road appears at the bottom left corner of the scene", "a road are built at the bottom", "a road and a road is built on the bareland", "a road appears on the bareland"], "stage1": [[0, 0.0876748338341713], [1, 0.07737276703119278], [2, 0.07499226182699203], [3, 0.0876748338341713], [4, 0.04995561018586159], [5, 0.062170762568712234], [6, 0.0876748338341713], [7, 0.07737276703119278], [8, 0.08236288279294968], [9, 0.06828122586011887], [10, 0.04141465947031975], [11, 0.06025797501206398], [12, 0.045485105365514755], [13, 0.03890547156333923], [14, 0.05840403214097023]], "stage2": [[0, 0.09296959638595581], [14, 0.07707450538873672], [6, 0.09010922163724899], [4, 0.051342688500881195], [2, 0.07707450538873672], [11, 0.06801801919937134], [13, 0.022082215175032616], [8, 0.08204538375139236], [5, 0.05817888677120209], [1, 0.10210712999105453], [7, 0.08464978635311127], [10, 0.02502242848277092], [3, 0.07707450538873672], [12, 0.02835412509739399], [9, 0.0638970136642456]]}}, {"name": "test_001095.png", "en": "Boundary / Failure Case", "zh": "边界与失败案例", "media": ["images/test_001095_A.png", "images/test_001095_B.png"], "title_en": "Honest Boundary: Missed Change Cannot Be Flipped", "title_zh": "算法边界:初筛漏报锁定后不可翻转", "summary_en": "A small corner house appears on the right and is present in Beam-15 top-1, but Stage 1 predicts Unchanged. Because state-locking is structural, Stage 2 cannot override a Stage 1 false negative.", "summary_zh": "画面右侧出现小范围房屋变化且位于 Beam-15 首句中,但第一阶段误判为无变化;由于状态锁定是结构保证,第二阶段无法挽回初筛漏报。", "clip": "clips/test_001095.mp4", "replay": {"captions": ["a building is built on the right", "a building is built on the bareland", "the scene is the same as before", "a scene is built on the right", "some buildings are built on the right", "some buildings are built on the bareland", "a scene is built on the bareland", "two buildings are built on the right", "a large building is built on the right", "two buildings are built on the bareland", "a building is built on the right side of the scene", "a small building is built on the right", "a building is built on the right side", "a few buildings are built on the right", "a scene is built on the right side of the scene"], "stage1": [[0, 0.05586867779493332], [1, 0.024791575968265533], [2, 0.5642536878585815], [3, 0.03839794546365738], [4, 0.02898428961634636], [5, 0.022572988644242287], [6, 0.026390496641397476], [7, 0.025578545406460762], [8, 0.0360715277493], [9, 0.02055293880403042], [10, 0.031833015382289886], [11, 0.025578545406460762], [12, 0.0360715277493], [13, 0.028092535212635994], [14, 0.034961726516485214]], "stage2": []}}]
5 unmodified lines6789101112133 unmodified lines1718192021222324252627282930313233343536373839404142434445464748495051525354555 unmodified lines<meta name="theme-color" content="#f7f8f6"><link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M3 12 16 5l13 7-13 7L3 12Zm0 7 13 7 13-7' fill='none' stroke='%230f766e' stroke-width='2.5'/%3E%3C/svg%3E"><title>Critique-then-Rerank · Decision Lab</title><link rel="stylesheet" href="./workbench/lab.css?v=inference-link"><script type="module" src="./workbench/lab.js?v=gpu-status"></script></head><body><header class="topbar">3 unmodified lines<main><section class="hero" aria-labelledby="headline"><div><p class="eyebrow"><span class="signal"></span> LEVIR-CC <span class="dim">/</span> ELEPHANT-1</p><h1 id="headline" data-t="headline">One model, four decision tasks.</h1><p class="lede" data-t="lede">Every task starts with two images of the same place. What changes is the question, the text the model sees, and the options it can choose.</p></div><div class="hero-index task-key"><a class="inference-link" href="#trace-title"><span data-t="openInference">Live GPU Inference</span><span aria-hidden="true">↘</span></a><p data-t="inferencePath">Image pair → Beam-15 → Final caption</p></div></section><section class="cases" aria-labelledby="case-heading"><div class="sectionbar"><h2 id="case-heading" data-t="choose">Choose a decision task</h2><span class="micro">04 TASKS / ELEPHANT-1</span></div><div class="case-grid task-grid" id="task-grid" role="group" aria-labelledby="case-heading"></div></section><div class="lab"><aside class="observation panel" aria-labelledby="observation-title"><div class="sectionbar"><h2 id="observation-title" data-t="observations">Bi-temporal observations</h2><code id="case-id"></code></div><div id="viewer"></div><div id="case-context" class="case-context"></div></aside><section class="decision panel" id="probe" aria-labelledby="probe-title"></section><section class="decision panel" id="inference-panel" aria-labelledby="trace-title" hidden><div class="sectionbar"><h2 id="trace-title" tabindex="-1" data-t="trace">04 · Listwise selection / Live inference</h2><span class="micro">T₁ / T₂ → CAPTION</span></div><p class="explain" data-t="listIntro">With two images and a list of candidates, choose the best-supported caption. Both stages use this task.</p><div class="toolbar"><div class="transport"><button type="button" id="live" data-t="live">Run on GPU</button><button type="button" id="replay" data-t="play">▷ Step through</button></div><span id="source" class="chip"></span></div><p class="run-status" id="status" role="status"></p><div id="list-protocol"></div><details class="pair-picker"><summary data-t="pairs">Change example image pair</summary><div class="case-grid case-options" id="case-grid"></div></details><nav class="pipeline" id="pipeline" aria-label="Decision trace steps"></nav><div id="inspector" class="inspector"></div></section></div><p class="sr-only" id="task-announcement" role="status"></p><noscript>This interactive trace requires JavaScript. / 交互演示需要 JavaScript。</noscript></main><footer><span>CRITIQUE-THEN-RERANK</span><span>LEVIR-CC · DECISION LAB</span></footer>5 unmodified lines6789101112133 unmodified lines17181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071725 unmodified lines<meta name="theme-color" content="#f7f8f6"><link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M3 12 16 5l13 7-13 7L3 12Zm0 7 13 7 13-7' fill='none' stroke='%230f766e' stroke-width='2.5'/%3E%3C/svg%3E"><title>Critique-then-Rerank · Decision Lab</title><link rel="stylesheet" href="./workbench/lab.css?v=decision-story"><script type="module" src="./workbench/lab.js?v=decision-story"></script></head><body><header class="topbar">3 unmodified lines<main><section class="hero" aria-labelledby="headline"><div><p class="eyebrow"><span class="signal"></span> LEVIR-CC <span class="dim">/</span> ELEPHANT-1</p><h1 id="headline" data-t="headline">The best caption isn’t always ranked first.</h1><p class="lede" data-t="lede">Critique-then-Rerank looks at both images to decide whether the scene changed, then selects the caption that best describes the change.</p></div><div class="hero-index task-key"><a class="inference-link" href="#trace-title"><span data-t="openInference">Live GPU Inference</span><span aria-hidden="true">↘</span></a><p data-t="inferencePath">Image pair → Beam-15 → Final caption</p></div></section><section class="benchmarks" aria-labelledby="results-title"><div class="sectionbar"><h2 id="results-title" data-t="results">Benchmark results</h2><span class="micro" data-t="baseline">SCST Beam-15 Top-1 → Critique-then-Rerank</span></div><div class="benchmark-grid" id="benchmark-grid"></div></section><div class="sectionbar inference-heading"><h2 id="trace-title" tabindex="-1" data-t="trace">Live GPU Inference</h2><span class="micro">LEVIR-CC / T₁ + T₂</span></div><div class="lab" aria-labelledby="trace-title"><aside class="observation panel" aria-labelledby="observation-title"><div class="sectionbar"><h2 id="observation-title" data-t="observations">Bi-temporal observations</h2><code id="case-id"></code></div><div id="viewer"></div><div id="case-context" class="case-context"></div></aside><section class="decision panel" id="inference-panel" aria-labelledby="inference-controls-title"><div class="sectionbar"><h3 id="inference-controls-title" data-t="listTitle">From two images to one caption</h3><span class="micro">T₁ / T₂ → CAPTION</span></div><p class="explain" data-t="listIntro">Pick an image pair and run the model. Follow each decision below as it arrives.</p><details class="pair-picker"><summary data-t="pairs">Choose an image pair</summary><div class="case-grid case-options" id="case-grid"></div></details><div class="toolbar"><div class="transport"><button type="button" id="live" data-t="live">Run on GPU</button><button type="button" id="replay" data-t="play">▷ Step through</button></div></div><p class="run-status" id="status" role="status"></p><div id="run-output"></div><a class="trace-link" href="#decision-trace" data-t="followTrace">Follow the decision trace ↓</a></section></div><div class="sectionbar archive-heading"><h2 data-t="decisionLabs">Inside the decision model</h2><span class="micro">ELEPHANT-1 / 03 LABS</span></div><section class="panel story" id="candidate-ranking" aria-labelledby="ranking-title"><div class="sectionbar"><h3 id="ranking-title" data-t="rankingTitle">01 · Candidate Ranking Explorer</h3><span class="chip" data-t="recordedExample">Benchmark example</span></div><p class="explain" data-t="rankingIntro">Beam order measures what the generator prefers. Visual reranking can find a better caption in the very same pool.</p><div id="rank-explorer"></div></section><section class="panel story" id="decision-trace" aria-labelledby="decision-title"><div class="sectionbar"><h3 id="decision-title" data-t="decisionTitle">02 · State-Routed Decision Trace</h3><span id="source" class="chip"></span></div><p class="explain" data-t="traceIntro">Stage 1 locks the state. If nothing changed, the model returns its anchor immediately; otherwise Stage 2 compares the remaining change descriptions.</p><nav class="pipeline" id="pipeline" aria-labelledby="decision-title"></nav><div id="route-branch"></div><div id="inspector" class="inspector"></div></section><section class="panel story" id="verification-lab" aria-labelledby="verification-title"><div class="sectionbar"><h3 id="verification-title" data-t="verificationTitle">03 · Counterfactual Verification Lab</h3><span class="chip" data-t="recordedExample">Benchmark example</span></div><div class="verify-grid"><div id="verify-images"></div><div id="probe"></div></div></section><details class="panel more-tasks"><summary data-t="moreTasks">Explore the other decision tasks</summary><div id="task-grid" class="view-mode"></div><div class="verify-grid"><div id="task-images"></div><div id="aux-probe"></div></div></details><p class="sr-only" id="task-announcement" role="status"></p><p id="load-error" role="status"></p><noscript>This interactive trace requires JavaScript. / 交互演示需要 JavaScript。</noscript></main><footer><span>CRITIQUE-THEN-RERANK</span><span>LEVIR-CC · DECISION LAB</span></footer>
57 unmodified lines58596061626364656667686930 unmodified lines1001011021031041051061071081091101114 unmodified lines11611711811912012112246 unmodified lines1691701711721731749 unmodified lines1841851861871881891902 unmodified lines19319419519619719819957 unmodified lines.sectionbar h2 { font-size: 1.05rem; letter-spacing: -.02em; }.sectionbar code { color: var(--dim); }.case-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }.task-choice { display: grid; align-content: center; justify-items: start; gap: 5px; min-height: 106px; padding: 12px clamp(10px, 1.8vw, 22px); background: var(--panel); border-color: var(--line); text-align: start; }.task-choice code { color: var(--green); }.task-choice strong { font-size: clamp(.94rem, 1.35vw, 1.12rem); line-height: 1.22; }.task-choice small { color: var(--dim); font-size: .81rem; line-height: 1.35; }.task-choice[aria-pressed='true'] { background: var(--green-wash); box-shadow: inset 0 -3px var(--green); }.task-choice:last-child:not([aria-pressed='true']) code { color: var(--warm); }.case { position: relative; display: grid; grid-template-columns: 57px minmax(0,1fr); align-items: center; gap: 10px; min-height: 80px; text-align: start; padding: 9px; background: var(--panel); }.case img { border-radius: 4px; }.case-number { position: absolute; inset: 13px auto auto 13px; background: var(--panel); color: var(--ink); border-radius: 3px; padding: 2px 3px; font: .61rem var(--mono); }30 unmodified lines.chip { font: .69rem var(--mono); border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: var(--green); background: var(--deep); }.chip[data-source='live'] { color: var(--warm); border-color: var(--warm); background: var(--warm-wash); }.run-status { margin-block: 8px 12px; min-height: 1.2rem; font-size: .8rem; color: var(--dim); }.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }.pipeline button { min-width: 0; min-height: 65px; padding: 7px; text-align: start; display: flex; flex-direction: column; justify-content: space-between; gap: 5px; }.pipeline small { font: .64rem/1.2 var(--mono); color: var(--dim); }.pipeline strong { font-size: .78rem; line-height: 1.2; }.pipeline button[aria-current='step'] { border-color: var(--green); background: var(--green-wash); box-shadow: inset 0 -2px var(--green); }.pipeline .bypass { border-style: dashed; }.inspector { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }.inspect-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }.inspect-head h3 { font-size: clamp(1.4rem, 2.1vw, 2rem); line-height: 1.13; margin-block: 4px 6px; letter-spacing: -.036em; }4 unmodified lines.protocol > div { display: grid; align-content: start; gap: 5px; background: var(--deep); padding: 10px; }.protocol small { color: var(--green); font: .72rem/1.3 var(--mono); }.protocol strong { font-size: .88rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }.decision blockquote { margin: 12px 0; border-inline-start: 3px solid var(--green); background: var(--deep); padding: 9px 12px; line-height: 1.5; }.probe-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }.probe-option { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; row-gap: 4px; border: 1px solid var(--line); padding: 10px 12px; border-radius: 7px; background: var(--deep); font-size: .91rem; line-height: 1.4; }.probe-option span { flex: 1 1 130px; }46 unmodified linessummary { cursor: pointer; font-size: .8rem; color: var(--green); min-height: 22px; }details p { color: var(--dim); line-height: 1.5; font-size: .85rem; padding-top: 6px; }.beam-list li { display: flex; gap: 10px; padding-block: 5px; border-top: 1px solid var(--line); font-size: .84rem; }.eligible { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 9px 0; font-size: .8rem; color: var(--dim); }.eligible span { margin-right: 5px; }.eligible code { padding: 3px 4px; border: 1px dashed var(--line); border-radius: 3px; text-decoration: line-through; }9 unmodified lines.empty h4 { color: var(--ink); margin-block: 4px 8px; }footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--dim); padding-block: 16px 22px; }@media (prefers-reduced-motion: no-preference) {.deck > div, .route-root, .branches, .comparison > div:last-child { animation: arrive .24s ease-out both; }@keyframes arrive { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }}@media (max-width: 960px) {2 unmodified lines.pipeline button { min-height: 53px; }}@media (max-width: 700px) {.hero, .lab { grid-template-columns: minmax(0,1fr); }.hero { margin-top: 12px; }.swipe, video { max-width: 380px; margin-inline: auto; }}57 unmodified lines58596061626364656667686970717273747576777879808182838485868730 unmodified lines1181191201211221231241251261271281291301314 unmodified lines13613713813914014114246 unmodified lines1891901911921931941959 unmodified lines2052062072082092102112 unmodified lines21421521621721821922057 unmodified lines.sectionbar h2 { font-size: 1.05rem; letter-spacing: -.02em; }.sectionbar code { color: var(--dim); }.case-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }.benchmark-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }.benchmark h3 { margin-bottom: 10px; font-size: 1rem; }.metric { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: baseline; padding-block: 7px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }.metric small, .metric span { color: var(--dim); }.metric strong { color: var(--ink); }.metric b { color: var(--green); font: 600 .75rem var(--mono); }.metric .decrease { color: var(--warm); }.inference-heading, .archive-heading { margin-top: clamp(30px, 4vw, 52px); }.inference-heading h2, .archive-heading h2 { font-size: clamp(1.45rem, 2.4vw, 2rem); }.story { margin-bottom: 14px; }.story h3, .decision .sectionbar h3 { font-size: clamp(1.1rem, 2vw, 1.38rem); }.verify-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; gap: clamp(12px, 2vw, 28px); }.verify-grid > div { min-width: 0; }.rank-jump { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; color: var(--dim); }.rank-jump strong { font: 700 clamp(1.4rem, 3vw, 2.35rem)/1.15 var(--mono); color: var(--green); }.explorer-pool { grid-auto-rows: min-content; }.explorer-pool .slot { grid-template-columns: 20px minmax(0, 1fr) auto; }.run-caption { display: grid; gap: 5px; border: 1px solid var(--green); border-radius: 8px; background: var(--green-wash); padding: 12px; margin-bottom: 12px; }.run-caption small, .mapping { color: var(--green); font: .72rem var(--mono); }.mapping { margin-block: 10px; }.trace-link { display: inline-flex; align-items: center; min-height: 32px; font-size: .87rem; }.more-tasks { margin-bottom: 28px; }.more-tasks .view-mode { margin-block: 10px; }#load-error:empty { display: none; }.case { position: relative; display: grid; grid-template-columns: 57px minmax(0,1fr); align-items: center; gap: 10px; min-height: 80px; text-align: start; padding: 9px; background: var(--panel); }.case img { border-radius: 4px; }.case-number { position: absolute; inset: 13px auto auto 13px; background: var(--panel); color: var(--ink); border-radius: 3px; padding: 2px 3px; font: .61rem var(--mono); }30 unmodified lines.chip { font: .69rem var(--mono); border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: var(--green); background: var(--deep); }.chip[data-source='live'] { color: var(--warm); border-color: var(--warm); background: var(--warm-wash); }.run-status { margin-block: 8px 12px; min-height: 1.2rem; font-size: .8rem; color: var(--dim); }.pipeline { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }.pipeline button { min-width: 0; min-height: 65px; padding: 7px; text-align: start; display: flex; flex-direction: column; justify-content: space-between; gap: 5px; }.pipeline small { font: .64rem/1.2 var(--mono); color: var(--dim); }.pipeline strong { font-size: .78rem; line-height: 1.2; }.pipeline [data-state='done'] { border-color: var(--green); background: var(--green-wash); }.pipeline [aria-current='step'] { box-shadow: inset 0 -3px var(--green); }.pipeline [data-state='skipped'], .pipeline [data-state='direct'] { border-style: dashed; border-color: var(--line); color: var(--dim); background: #eff1ef; }.pipeline [data-state='skipped'][aria-current='step'], .pipeline [data-state='direct'][aria-current='step'] { box-shadow: inset 0 -3px var(--control); }.inspector { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }.inspect-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }.inspect-head h3 { font-size: clamp(1.4rem, 2.1vw, 2rem); line-height: 1.13; margin-block: 4px 6px; letter-spacing: -.036em; }4 unmodified lines.protocol > div { display: grid; align-content: start; gap: 5px; background: var(--deep); padding: 10px; }.protocol small { color: var(--green); font: .72rem/1.3 var(--mono); }.protocol strong { font-size: .88rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }.story blockquote { margin: 12px 0; border-inline-start: 3px solid var(--green); background: var(--deep); padding: 9px 12px; line-height: 1.5; }.probe-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }.probe-option { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 10px; row-gap: 4px; border: 1px solid var(--line); padding: 10px 12px; border-radius: 7px; background: var(--deep); font-size: .91rem; line-height: 1.4; }.probe-option span { flex: 1 1 130px; }46 unmodified linessummary { cursor: pointer; font-size: .8rem; color: var(--green); min-height: 22px; }details p { color: var(--dim); line-height: 1.5; font-size: .85rem; padding-top: 6px; }.beam-list li { display: flex; gap: 10px; padding-block: 5px; border-top: 1px solid var(--line); font-size: .84rem; }.beam-list li small { color: var(--dim); margin-inline-start: auto; text-align: end; }.eligible { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 9px 0; font-size: .8rem; color: var(--dim); }.eligible span { margin-right: 5px; }.eligible code { padding: 3px 4px; border: 1px dashed var(--line); border-radius: 3px; text-decoration: line-through; }9 unmodified lines.empty h4 { color: var(--ink); margin-block: 4px 8px; }footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--dim); padding-block: 16px 22px; }@media (prefers-reduced-motion: no-preference) {.deck > div, .route-root, .branches, .comparison > div:last-child, .explorer-pool .winner, .pipeline [data-state='done'][aria-current='step'] { animation: arrive .24s ease-out both; }@keyframes arrive { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }}@media (max-width: 960px) {2 unmodified lines.pipeline button { min-height: 53px; }}@media (max-width: 700px) {.hero, .lab, .verify-grid, .benchmark-grid { grid-template-columns: minmax(0,1fr); }.hero { margin-top: 12px; }.swipe, video { max-width: 380px; margin-inline: auto; }}
1234567891011121314151617181920212223242526271 unmodified line293031323334352 unmodified lines38394041424344454647484950515253545556573 unmodified lines6162636465666768697071721 unmodified line74757677787980811 unmodified line8384858687888990919293949514 unmodified lines1101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591604 unmodified lines1651661671681691701711721731741 unmodified line17617717817918018118218318418518618718818919019119219319419519619719819920020120220320420533 unmodified lines2392402412422432442457 unmodified lines2532542552562572582592602612622632648 unmodified lines2732742752762772782795 unmodified lines28528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033134 unmodified lines366367368369370371372373374375376377378379import { probeContent, protocol, tasks } from './tasks.js';const byId = id => document.getElementById(id);const escape = value => String(value ?? '').replace(/[&<>"']/g, char => ({'&':'&', '<':'<', '>':'>', '"':'"', "'":'''}[char]));const steps = ['encode', 'generate', 'lock', 'rerank', 'output'];const labels = {project: ['Project ↗','项目主页 ↗'], headline: ['One model, four decision tasks.','一个模型,四种决策任务。'],lede: ['Every task starts with two images of the same place. What changes is the question, the text the model sees, and the options it can choose.','四项任务都从同一地点的两期影像出发,区别在于问什么、给模型哪些文字,以及它要从哪些选项中作答。'],choose: ['Choose a decision task','选择决策任务'], observations: ['Bi-temporal observations','双时相观测'], trace: ['04 · Listwise selection / Live inference','04 · 列表选句 / 实时推理'],openInference: ['Live GPU Inference','GPU 实时推理'], inferencePath: ['Image pair → Beam-15 → Final caption','双时相影像 → Beam-15 → 最终描述'],listIntro: ['With two images and a list of candidates, choose the best-supported caption. Both stages use this task.','给定双时相影像和一组候选,选出最符合影像的一句。正式推理的两个阶段都使用这项任务。'],pairs: ['Change example image pair','更换示例影像'],encode: ['Encode the pair','编码双图'], generate: ['Generate captions','生成候选'], lock: ['Lock the state','锁定状态'],rerank: ['Same-state reranking','同状态精排'], output: ['Final caption','最终描述'],play: ['▷ Step through','▷ 逐步演示'], pause: ['Ⅱ Pause','Ⅱ 暂停演示'], live: ['Run on GPU','开始 GPU 推理'],};const inferenceHash = '#trace-title';let lang = new URLSearchParams(location.search).get('lang') === 'zh' ? 'zh' : 'en';const text = (en, zh) => lang === 'zh' ? zh : en;const label = key => text(...labels[key]);let catalog, selected, trace, phase = 2, mode = 'archive', liveEvent, busy = false, follow = true, failure = null, timer;let view = 'swipe', divider = 50, beta = 0.12;let activeTask = 0, alternate = false;const listwise = () => activeTask === tasks.length - 1;function translate() {document.documentElement.lang = text('en','zh-CN');1 unmodified linefor (const node of document.querySelectorAll('[data-t]')) node.textContent = label(node.dataset.t);byId('language').textContent = text('中文','EN');byId('language').setAttribute('aria-label', text('切换到中文','Switch to English'));renderTasks();}const media = path => `./media/${path.split('/').map(encodeURIComponent).join('/')}`;2 unmodified linesconst image = (path, later) => `<img src="${media(path)}" width="256" height="256" alt="${later ? text('T₂: later satellite image','T₂:后一时相遥感影像') : text('T₁: earlier satellite image','T₁:前一时相遥感影像')}">`;function renderTasks() {byId('task-grid').innerHTML = tasks.map((task, index) => `<button type="button" class="task-choice" data-task="${index}" aria-pressed="${index === activeTask}" ${!catalog || busy ? 'disabled' : ''}><code>0${index + 1}</code><strong>${text(...task.label)}</strong><small>${text(...task.hint)}</small></button>`).join('');}function showTask() {byId('probe').hidden = listwise();byId('inference-panel').hidden = !listwise();if (listwise()) {byId('list-protocol').innerHTML = protocol(tasks[activeTask], text);render();} else {byId('probe').innerHTML = probeContent(activeTask, alternate, text);}renderViewer();}function renderCases() {3 unmodified lines}function renderViewer() {const current = listwise() ? selected : [catalog.cases.find(item => item.name === 'test_000033.png'),catalog.task_pairs[alternate ? '000400' : '000325'], catalog.task_pairs['000109']][activeTask];byId('case-id').textContent = current.name.replace('.png','');const [before, after] = current.media;const modes = [['swipe',text('Swipe','拉帘')],['pair',text('Side by side','并排')],['video',text('Playback','时序播放')]];const frame = (path, later) => `<div class="frame">${image(path, later)}<span>${later ? 'T₂' : 'T₁'}</span></div>`;let stage;if (view === 'swipe') stage = `<div class="swipe" style="--split:${divider}%">${image(before, false)}<div class="after">${image(after, true)}</div><span class="t1">T₁</span><span class="t2">T₂</span><span class="divider" aria-hidden="true"><b>‹ ›</b></span><input id="divider" type="range" min="0" max="100" value="${divider}" aria-valuetext="${divider}%"></div>1 unmodified lineif (view === 'pair') stage = `<div class="pair">${frame(before, false)}${frame(after, true)}</div>`;if (view === 'video') stage = `<video controls playsinline preload="metadata" poster="${media(before)}" src="${media(current.clip)}" aria-label="${text('T₁ to T₂ playback','T₁ 到 T₂ 时序播放')}"></video><p class="fine">${text('Original frames only · 2 s per observation','仅播放两张原始影像 · 每个时相 2 秒')}</p>`;byId('viewer').innerHTML = `<div class="view-mode">${modes.map(([key, title]) => `<button type="button" data-view="${key}" aria-pressed="${view === key}">${title}</button>`).join('')}</div>${stage}`;byId('case-context').hidden = !listwise();byId('case-context').innerHTML = listwise() ? `<span class="micro">${text('EXAMPLE PAIR','示例影像')}</span><h3>${escape(text(selected.title_en, selected.title_zh))}</h3><p>${escape(text(selected.summary_en, selected.summary_zh))}</p>` : '';}function select(index) {1 unmodified linestopReplay();selected = catalog.cases[index];trace = selected.replay;phase = 2;mode = 'archive';beta = catalog.beta;divider = 50;failure = null;renderCases();showTask();}function stopReplay() {14 unmodified linesbeta = catalog.beta;failure = null;timer = setInterval(() => {phase += trace.changed === false && phase === 2 ? 2 : 1;if (phase === 4) stopReplay();render();}, 1650);render();}function level() {return mode === 'archive' ? 4 : ({encode: 0, beam: 1, stage1: 2, gate: 2, stage2: 3, done: 4}[liveEvent] ?? -1);}function render() {const reached = level();const titles = [label('encode'), label('generate'), label('lock'), label('rerank'), label('output')];const short = ['RSCaMa', 'Beam-15', 'Elephant-1 · S1', trace?.changed === false ? text('Bypass','跳过') : 'Elephant-1 · S2 + β', 'Caption'];const focused = document.activeElement?.dataset.step;byId('pipeline').innerHTML = titles.map((title, index) => `<button type="button" data-step="${index}" ${index > reached ? 'disabled' : ''} ${phase === index ? 'aria-current="step"' : ''} class="${index === 3 && trace?.changed === false ? 'bypass' : ''}"><small>0${index + 1} / ${short[index]}</small><strong>${title}</strong></button>`).join('');if (focused !== undefined) byId('pipeline').querySelector(`[data-step="${focused}"]`)?.focus({preventScroll: true});byId('source').textContent = mode === 'archive' ? text('Case walkthrough','案例演示') : text('ZeroGPU · live run','ZeroGPU · 实时推理');byId('source').dataset.source = mode;byId('replay').textContent = label(timer ? 'pause' : 'play');byId('replay').disabled = busy;byId('live').disabled = busy || !catalog.live;const status = failure ? failureMessage(failure) : (mode === 'archive'? (catalog.live ? text('Select a step to see how the model made its decision.', '点击任意步骤,查看模型如何做出决策。') : text('Explore the case below. Live inference is temporarily unavailable.', '可以继续查看案例,实时推理暂不可用。')): ({encode: text('Encoding T₁ and T₂ on GPU…','GPU 正在编码双时相影像…'),beam: text('Decoding the 15 caption beams…','正在解码 15 条候选…'),stage1: text('Stage 1 is scoring the caption slots…','第一阶段正在为候选槽位打分…'),gate: text('Change state locked. Routing the candidate pool…','状态已锁定,正在确定候选分流…'),stage2: text('Stage 2 is scoring the eligible pool…','第二阶段正在为同状态候选打分…'),done: text('Inference complete. Inspect any step.','推理完成,可回看任意步骤。'),}[liveEvent] ?? text('Queued for a ZeroGPU lease…','正在等待 ZeroGPU 分配…')));if (byId('status').textContent !== status) byId('status').textContent = status;byId('inspector').innerHTML = reached < 0 ? `<div class="empty">${failure? text('No live result. Choose Step through to explore this pair without using GPU quota.', '本次没有实时结果。点击「逐步演示」可查看这组影像的推理流程,不消耗 GPU 配额。'): text('The trace will open when the GPU starts.','GPU 开始运行后会打开决策记录。')}</div>` : inspect();if (phase === 3 && trace?.stage2?.length > 1) updateRanking();}function head(index, description) {const time = trace?.timings?.[['encode','beam','stage1','stage2'][index]];return `<div class="inspect-head"><div><span class="micro">STEP 0${index + 1}</span><h3>${label(steps[index])}</h3></div>${time === undefined ? '' : `<time>${time.toFixed(2)} s</time>`}</div><p class="explain">${description}</p>`;}function inspect() {if (phase === 0) return head(0, text('RSCaMa encodes the earlier and later views of the same location into joint visual features for the caption generator.','RSCaMa 将同一地点的前后影像编码为联合视觉特征,交给描述生成器。')) + `<div class="encoding"><div class="feature-pair">${selected.media.map((path, index) => `<div>${image(path, index === 1)}<b>T${index + 1}</b></div>`).join('')}</div>4 unmodified lines<div class="deck"><i aria-hidden="true"></i><i aria-hidden="true"></i><div><small>BEAM ${rankLabel(0)} / TOP-1</small><strong lang="en">${escape(trace.captions[0])}</strong></div></div><details><summary>${text('Inspect all Beam-15 candidates','查看全部 15 条候选')}</summary><ol class="beam-list">${trace.captions.map((caption, index) => `<li><code>${rankLabel(index)}</code><span lang="en">${escape(caption)}</span></li>`).join('')}</ol></details>` : pending());if (phase === 2) return head(2, text('Elephant-1 sees both images and the 15 descriptions. The highest-probability slot becomes the anchor; its caption sets the change state.','Elephant-1 读取双图和 15 条描述,选择概率最高的槽位作为锚点,由这条描述锁定变化状态。')) + (trace?.stage1 ? `<div class="route-map" data-changed="${trace.changed}"><div class="route-root"><span>ARGMAX · STAGE 1</span><strong>Beam ${rankLabel(trace.anchor)}</strong></div><svg viewBox="0 0 400 43" preserveAspectRatio="none" aria-hidden="true"><path d="M200 0V19H100V43"/><path d="M200 0V19H300V43"/></svg><div class="branches"><div class="branch unchanged"><small>${trace.changed ? '○' : '●'} ${stateLabel(false)}</small><b>${text('Output the anchor','直接输出锚点')}</b></div><div class="branch changed"><small>${trace.changed ? '●' : '○'} ${stateLabel(true)}</small><b>${text('Route to Stage 2','进入第二阶段')}</b></div></div></div><div class="pool-head"><span>${text('Stage 1 slots · sorted by probability','第一阶段槽位 · 按概率排序')}</span><span>P(slot)</span></div><ol class="pool">${trace.stage1.slice().sort((first, second) => second[1] - first[1]).map(([index, prob]) => {const isAnchor = index === trace.anchor;1 unmodified line}).join('')}</ol>` : pending()) + task(0);if (phase === 3) {if (trace.changed === false) return head(3, text('Stage 1 locked Unchanged. The anchor goes straight to the output.','第一阶段已锁定无变化,锚点直接作为最终输出。')) + `<div class="empty bypass-note"><span class="micro">BYPASS / UNCHANGED</span><h4>${text('No Stage 2 call','未调用第二阶段')}</h4><p>${text('There are no Stage 2 scores on this route. A wrong state lock also cannot be reversed downstream.','这条路径没有第二阶段得分。若第一阶段锁错状态,下游也无法翻转。')}</p></div>`;return head(3, text('Keep only distinct eligible change captions. Elephant-1 scores their factual fit; β trades off the slot score against caption length.','过滤无变化和重复候选。Elephant-1 对保留的变化描述打分,再用 β 在槽位得分和句子长度之间做权衡。')) + `<div class="eligible"><span>${trace.eligible?.length ?? 0} / ${trace.captions?.length ?? 0} ${text('eligible','条保留')}</span>${trace.captions?.map((caption, index) => `<code class="${trace.eligible?.includes(index) ? 'kept' : ''}" title="${escape(caption)}">${rankLabel(index)}</code>`).join('') ?? ''}</div>` +(trace.stage2?.length > 1 ? `<div class="formula"><code>log(max(P(slot), 10⁻³⁰)) − β × words</code><label class="range-label" for="beta">${text('Length penalty β','长度惩罚 β')}<output id="beta-value">${beta.toFixed(2)}</output></label><input id="beta" type="range" min="0" max="0.20" step="0.02" value="${beta}"><p class="fine">${text('The slider explores this fixed candidate pool. The final tab uses the paper’s β.', '滑块只改变当前候选的排序;最终描述页仍使用论文 β。')}</p></div><div id="ranks"></div>` : liveEvent === 'done' || mode === 'archive' ? `<div class="empty">${trace.eligible?.length ? text('One eligible caption: selected directly.','仅一条合格候选,直接选择。') : text('No eligible captions: keep the Stage 1 anchor.','无合格候选,保留第一阶段锚点。')}</div>` : pending()) + task(1);}return head(4, trace.changed ? text(`The change state remains locked. The final caption uses the paper setting β = ${catalog.beta.toFixed(2)}.`,`变化状态保持锁定。最终描述使用论文设置 β = ${catalog.beta.toFixed(2)}。`) : text('The Stage 1 anchor is the final output; Stage 2 was bypassed.','第一阶段锚点直接输出,第二阶段未执行。')) + `<div class="comparison">${[[text('Generator baseline','生成器基线'),0], [text('Stage 1 anchor','第一阶段锚点'),trace.anchor], [label('output'),trace.final],].map(([title, index]) => `<div><small>${title} · BEAM ${rankLabel(index)}</small><p lang="en">${escape(trace.captions[index])}</p></div>`).join('')}</div>`;}const pending = () => `<div class="empty">${text('Waiting for this stage’s GPU output…','等待该阶段返回 GPU 结果…')}</div>`;const task = index => `<details class="task"><summary>${text('Inspect the actual task instruction','查看实际任务指令(英文)')}</summary><p lang="en">${escape(catalog.tasks[index])}</p></details>`;function updateRanking() {const needle = byId('beta');byId('beta-value').textContent = beta.toFixed(2);needle.setAttribute('aria-valuetext', beta.toFixed(2));const ranked = trace.stage2.map(([index, probability], slot) => {const caption = trace.captions[index];const words = caption.trim() ? caption.trim().split(/\s+/u).length : 0;const log = Math.log(Math.max(probability, 1e-30));return {index, probability, slot, words, log, score: log - beta * words, caption};}).sort((first, second) => second.score - first.score);byId('ranks').innerHTML = `<div class="pool-head"><span>${text('Eligible pool · sorted by calibrated score','同状态候选 · 按校准分排序')}</span><span>${text('Score','得分')}</span></div><ol class="pool">${ranked.map(({index, probability, slot, words, log, score, caption}, position) => `<li class="slot ${position === 0 ? 'winner warm' : ''}"><code>${rankLabel(index)}</code><div><span lang="en">${escape(caption)}</span><small>item_${slot + 1} · P ${(probability * 100).toFixed(2)}% · ln P ${log.toFixed(3)} · ${words} ${text('words','词')} · −${(beta * words).toFixed(3)}</small></div><div class="prob"><b>${score.toFixed(4)}</b>${position === 0 ? `<small>${text('SELECTED','选中')}</small>` : ''}</div></li>`).join('')}</ol>`;}33 unmodified linesphase = 0;beta = catalog.beta;renderCases();renderTasks();render();let source;try {7 unmodified linesconst onTrace = event => {try {const [payload] = JSON.parse(event.data);if (payload.name !== selected.name || !['encode','beam','stage1','gate','stage2','done'].includes(payload.step)) throw new Error('Invalid trace');if (event.type === 'complete' && payload.step !== 'done') throw new Error('Incomplete trace');trace = payload;liveEvent = payload.step;if (follow) phase = level();if (liveEvent === 'gate' && trace.changed === false && follow) phase = 2;if (event.type === 'complete') resolve();render();} catch (error) { reject(error); }8 unmodified linessource?.close();busy = false;renderCases();renderTasks();render();}}5 unmodified lineselse url.searchParams.delete('lang');history.replaceState(null, '', url);translate();if (catalog) { renderCases(); showTask(); }});function chooseTask(index) {if (!catalog || busy || index === activeTask) return;stopReplay();activeTask = index;alternate = false;divider = 50;renderTasks();showTask();}function followInferenceLink() {if (!catalog || location.hash !== inferenceHash) return;chooseTask(tasks.length - 1);const title = byId('trace-title');title.scrollIntoView();title.focus({preventScroll: true});}window.addEventListener('hashchange', followInferenceLink);byId('task-grid').addEventListener('click', event => {const button = event.target.closest('[data-task]');if (!button || !catalog || busy) return;chooseTask(Number(button.dataset.task));if (!listwise() && location.hash === inferenceHash) {const url = new URL(location.href);url.hash = '';history.replaceState(null, '', url);}byId('task-grid').querySelector(`[data-task="${activeTask}"]`)?.focus({preventScroll:true});});byId('probe').addEventListener('click', event => {const button = event.target.closest('[data-variant]');if (!button || (button.dataset.variant === '1') === alternate) return;alternate = button.dataset.variant === '1';byId('probe').innerHTML = probeContent(activeTask, alternate, text);if (activeTask === 1) renderViewer();byId('probe').querySelector(`[data-variant="${Number(alternate)}"]`).focus({preventScroll:true});byId('task-announcement').textContent = byId('probe').querySelector('.probe-picked').textContent;});byId('case-grid').addEventListener('click', event => {const button = event.target.closest('[data-case]');34 unmodified linesbyId('live').addEventListener('click', () => { if (catalog) run(); });translate();byId('live').disabled = byId('replay').disabled = true;try {const response = await fetch('./catalog');if (!response.ok) throw new Error('Catalog unavailable');catalog = await response.json();select(0);renderTasks();followInferenceLink();} catch {byId('probe').textContent = text('Examples could not load. Refresh to retry.', '未能加载示例,请刷新重试。');}12345678910111213141516171819202122232425262728293031321 unmodified line3435363738392 unmodified lines424344454647484950515253545556575859606162636465666768697071727374757677787980813 unmodified lines858687888990919293941 unmodified line969798991001011021 unmodified line10410510610710810911011111211311411511611714 unmodified lines1321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022034 unmodified lines2082092102112122132141 unmodified line21621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325433 unmodified lines2882892902912922937 unmodified lines3013023033043053063073083093103118 unmodified lines3203213223233243255 unmodified lines33133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836934 unmodified lines404405406407408409410411412413414415416417418419420import { probeContent, tasks } from './tasks.js';const byId = id => document.getElementById(id);const escape = value => String(value ?? '').replace(/[&<>"']/g, char => ({'&':'&', '<':'<', '>':'>', '"':'"', "'":'''}[char]));const steps = ['encode', 'generate', 'score', 'lock', 'filter', 'rerank', 'output'];const events = ['encode', 'beam', 'stage1', 'gate', 'filter', 'stage2', 'done'];const labels = {project: ['Project ↗','项目主页 ↗'], headline: ['The best caption isn’t always ranked first.','排名第一的,不一定是最好的描述。'],lede: ['Critique-then-Rerank looks at both images to decide whether the scene changed, then selects the caption that best describes the change.','Critique-then-Rerank 先看双时相影像判断场景是否变化,再从现有候选中选出最符合影像的描述。'],observations: ['Bi-temporal observations','双时相观测'], trace: ['Live GPU Inference','GPU 实时推理'],openInference: ['Live GPU Inference','GPU 实时推理'], inferencePath: ['Image pair → Beam-15 → Final caption','双时相影像 → Beam-15 → 最终描述'],results: ['Benchmark results','基准成果'], baseline: ['SCST Beam-15 Top-1 → Critique-then-Rerank','SCST Beam-15 首选 → 两阶段重排'],listTitle: ['From two images to one caption','从双时相影像到变化描述'], listIntro: ['Pick an image pair and run the model. Follow each decision below as it arrives.','选择一组影像并开始推理,下方会随结果到达逐步点亮决策路径。'],pairs: ['Choose an image pair','选择示例影像'], followTrace: ['Follow the decision trace ↓','查看决策过程 ↓'],decisionLabs: ['Inside the decision model','模型如何做决策'], recordedExample: ['Benchmark example','基准示例'],rankingTitle: ['01 · Candidate Ranking Explorer','01 · 候选排序探索'], rankingIntro: ['Beam order measures what the generator prefers. Visual reranking can find a better caption in the very same pool.','Beam 排名反映生成器的偏好;视觉重排能从同一组候选中选出更符合影像的描述。'],decisionTitle: ['02 · State-Routed Decision Trace','02 · 状态分流与决策过程'], traceIntro: ['Stage 1 locks the state. If nothing changed, the model returns its anchor immediately; otherwise Stage 2 compares the remaining change descriptions.','第一阶段锁定变化状态。无变化时直接返回锚点;有变化时才进入第二阶段比较剩余的变化描述。'],verificationTitle: ['03 · Counterfactual Verification Lab','03 · 反事实核验实验室'], moreTasks: ['Explore the other decision tasks','查看其他决策任务'],encode: ['Encode the pair','编码双图'], generate: ['Generate Beam-15','生成 Beam-15'], score: ['Score all candidates','全候选评分'], lock: ['Route by state','按状态分流'], filter: ['Filter the pool','过滤候选池'],rerank: ['Compare + calibrate','精排与长度校准'], output: ['Map to original Beam ID','回映原始 Beam ID'],play: ['▷ Step through','▷ 逐步演示'], pause: ['Ⅱ Pause','Ⅱ 暂停演示'], live: ['Run on GPU','开始 GPU 推理'],};const inferenceHash = '#trace-title';let lang = new URLSearchParams(location.search).get('lang') === 'zh' ? 'zh' : 'en';const text = (en, zh) => lang === 'zh' ? zh : en;const label = key => text(...labels[key]);let catalog, selected, trace, phase = 3, mode = 'archive', liveEvent, busy = false, follow = true, failure = null, timer;let view = 'swipe', divider = 50, beta = 0.12;let activeTask = 0, alternate = false, verifySwap = false, rankedView = false;function translate() {document.documentElement.lang = text('en','zh-CN');1 unmodified linefor (const node of document.querySelectorAll('[data-t]')) node.textContent = label(node.dataset.t);byId('language').textContent = text('中文','EN');byId('language').setAttribute('aria-label', text('切换到中文','Switch to English'));}const media = path => `./media/${path.split('/').map(encodeURIComponent).join('/')}`;2 unmodified linesconst image = (path, later) => `<img src="${media(path)}" width="256" height="256" alt="${later ? text('T₂: later satellite image','T₂:后一时相遥感影像') : text('T₁: earlier satellite image','T₁:前一时相遥感影像')}">`;function renderTasks() {byId('task-grid').innerHTML = [0, 2].map(index => `<button type="button" data-task="${index}" aria-pressed="${index === activeTask}">${text(...tasks[index].label)}</button>`).join('');const current = activeTask === 0 ? catalog.cases.find(item => item.name === 'test_000033.png') : catalog.task_pairs['000109'];byId('task-images').innerHTML = pair(current);byId('aux-probe').innerHTML = probeContent(activeTask, alternate, text);}const frame = (path, later) => `<div class="frame">${image(path, later)}<span>${later ? 'T₂' : 'T₁'}</span></div>`;const pair = item => `<div class="pair">${item.media.map((path, index) => frame(path, index === 1)).join('')}</div>`;function renderResults() {const metrics = [['LEVIR-CC', '146.35', '147.65', '+1.30', '67.14', '69.35', '+2.21'],['WHU-CDC', '161.89', '162.35', '+0.46', '77.50', '78.15', '+0.65'],['DUBAI-CC', '117.00', '121.26', '+4.26', '45.47', '44.11', '−1.36'],];const metric = (name, before, after, delta) => `<div class="metric"><small>${name}</small><span>${before} → <strong>${after}</strong></span><b class="${delta.startsWith('−') ? 'decrease' : ''}">${delta}</b></div>`;byId('benchmark-grid').innerHTML = metrics.map(([dataset, ciderBefore, ciderAfter, ciderDelta, bleuBefore, bleuAfter, bleuDelta]) => `<article class="panel benchmark"><h3>${dataset}</h3>${metric('CIDEr-D', ciderBefore, ciderAfter, ciderDelta)}${metric('BLEU-4', bleuBefore, bleuAfter, bleuDelta)}</article>`).join('');}function renderExplorer() {const example = catalog.cases.find(item => item.name === 'test_000125.png');const {captions, final, stage2} = example.replay;const order = rankedView ? calibrated(stage2, captions, catalog.beta).map(candidate => candidate.index) : captions.map((_, index) => index);byId('rank-explorer').innerHTML = `<div class="verify-grid"><div><div class="rank-jump"><strong>15 <span aria-hidden="true">→</span> 1</strong><span>${text('Beam rank → final rank','原始 Beam 排名 → 最终排名')}</span></div>${pair(example)}<blockquote lang="en">${escape(captions[final])}</blockquote><p class="fine">LEVIR-CC · ${escape(example.name)} · β = ${catalog.beta.toFixed(2)}</p></div><div><div class="view-mode" role="group" aria-label="${text('Ranking order','排序方式')}"><button type="button" data-rank="0" aria-pressed="${!rankedView}">${text('Generator order','生成器排序')}</button><button type="button" data-rank="1" aria-pressed="${rankedView}">${text('Reranked order','视觉重排后')}</button></div><ol class="pool explorer-pool">${order.map((index, rank) => `<li class="slot ${index === final ? 'winner' : ''}"><code>${rank + 1}</code><span lang="en">${escape(captions[index])}</span><code>Beam ${rankLabel(index)}</code></li>`).join('')}</ol></div></div>`;const pool = byId('rank-explorer').querySelector('.pool');if (!rankedView) pool.scrollTop = pool.scrollHeight;}function renderVerification() {byId('verify-images').innerHTML = pair(catalog.task_pairs[verifySwap ? '000400' : '000325']);byId('probe').innerHTML = probeContent(1, verifySwap, text);}function renderCases() {3 unmodified lines}function renderViewer() {const current = selected;byId('case-id').textContent = current.name.replace('.png','');const [before, after] = current.media;const modes = [['swipe',text('Swipe','拉帘')],['pair',text('Side by side','并排')],['video',text('Playback','时序播放')]];let stage;if (view === 'swipe') stage = `<div class="swipe" style="--split:${divider}%">${image(before, false)}<div class="after">${image(after, true)}</div><span class="t1">T₁</span><span class="t2">T₂</span><span class="divider" aria-hidden="true"><b>‹ ›</b></span><input id="divider" type="range" min="0" max="100" value="${divider}" aria-valuetext="${divider}%"></div>1 unmodified lineif (view === 'pair') stage = `<div class="pair">${frame(before, false)}${frame(after, true)}</div>`;if (view === 'video') stage = `<video controls playsinline preload="metadata" poster="${media(before)}" src="${media(current.clip)}" aria-label="${text('T₁ to T₂ playback','T₁ 到 T₂ 时序播放')}"></video><p class="fine">${text('Original frames only · 2 s per observation','仅播放两张原始影像 · 每个时相 2 秒')}</p>`;byId('viewer').innerHTML = `<div class="view-mode">${modes.map(([key, title]) => `<button type="button" data-view="${key}" aria-pressed="${view === key}">${title}</button>`).join('')}</div>${stage}`;byId('case-context').innerHTML = `<span class="micro">${text('EXAMPLE PAIR','示例影像')}</span><h3>${escape(text(selected.title_en, selected.title_zh))}</h3>`;}function select(index) {1 unmodified linestopReplay();selected = catalog.cases[index];trace = selected.replay;phase = 3;mode = 'archive';beta = catalog.beta;divider = 50;failure = null;renderCases();renderViewer();render();}function stopReplay() {14 unmodified linesbeta = catalog.beta;failure = null;timer = setInterval(() => {phase = phase === 3 && trace.changed === false ? 6 : phase + 1;if (phase === 6) stopReplay();render();}, 1650);render();}function level() {return mode === 'archive' ? steps.length - 1 : events.indexOf(liveEvent);}function render() {const reached = level();const completed = timer ? phase : reached;const short = ['RSCaMa', 'Beam-15', 'Stage 1', text('State Gate','状态门控'), text('Change Branch','变化分支'), 'Stage 2 · β', 'Caption'];const focused = document.activeElement?.dataset.step;const early = trace?.changed === false && completed >= 3;const direct = trace?.changed === true && completed >= 4 && trace.eligible?.length <= 1;byId('pipeline').innerHTML = steps.map((step, index) => {const skipped = (index === 4 || index === 5) && early;const state = skipped ? 'skipped' : (direct && index === 5) ? 'direct' : index <= completed ? 'done' : 'pending';const title = skipped ? text('Skipped — Early Exit','已跳过 — 提前退出') : state === 'direct' ? text('No Stage 2 call','未调用 Stage 2') : label(step);return `<button type="button" data-step="${index}" data-state="${state}" ${index > completed && !skipped ? 'disabled' : ''} ${phase === index && reached >= 0 ? 'aria-current="step"' : ''}><small>0${index + 1} / ${short[index]}</small><strong>${title}</strong></button>`;}).join('');const branch = completed >= 3 && typeof trace?.changed === 'boolean' ? routing() : '';if (byId('route-branch').dataset.route !== branch) {byId('route-branch').innerHTML = branch;byId('route-branch').dataset.route = branch;}if (focused !== undefined) byId('pipeline').querySelector(`[data-step="${focused}"]`)?.focus({preventScroll: true});byId('source').textContent = mode === 'archive' ? text('Case walkthrough','案例演示') : text('ZeroGPU · live run','ZeroGPU · 实时推理');byId('source').dataset.source = mode;const result = mode === 'live' && liveEvent === 'done' ? trace : mode === 'archive' && (!timer || phase === 6) ? trace : null;byId('run-output').innerHTML = result ? `<div class="run-caption"><small>${mode === 'live' ? text('LIVE CAPTION','实时输出') : text('EXAMPLE CAPTION','示例输出')} · BEAM ${rankLabel(result.final)}</small><p lang="en">${escape(result.captions[result.final])}</p></div>` : '';byId('replay').textContent = label(timer ? 'pause' : 'play');byId('replay').disabled = busy;byId('live').disabled = busy || !catalog.live;const status = failure ? failureMessage(failure) : (mode === 'archive'? (catalog.live ? text('Select a step to see how the model made its decision.', '点击任意步骤,查看模型如何做出决策。') : text('Explore the case below. Live inference is temporarily unavailable.', '可以继续查看案例,实时推理暂不可用。')): ({encode: text('Images encoded. Generating candidates…','双图编码完成,正在生成候选…'),beam: text('Beam-15 ready. Stage 1 is scoring the pool…','Beam-15 已生成,第一阶段正在评分…'),stage1: text('Stage 1 scored all candidates.','第一阶段已完成全候选评分。'),gate: trace?.changed ? text('Changed locked. Filtering the pool…','已锁定有变化,正在过滤候选…') : text('Unchanged locked. Stage 2 skipped.','已锁定无变化,跳过第二阶段。'),filter: text('Change pool ready. Comparing the eligible captions…','变化候选池已就绪,正在比较保留的描述…'),stage2: text('Stage 2 scored the pool. Mapping the final choice…','第二阶段评分完成,正在回映最终选择…'),done: text('Inference complete. Inspect any step.','推理完成,可回看任意步骤。'),}[liveEvent] ?? text('Queued for a ZeroGPU lease…','正在等待 ZeroGPU 分配…')));if (byId('status').textContent !== status) byId('status').textContent = status;byId('inspector').innerHTML = reached < 0 ? `<div class="empty">${failure? text('No live result. Choose Step through to explore this pair without using GPU quota.', '本次没有实时结果。点击「逐步演示」可查看这组影像的推理流程,不消耗 GPU 配额。'): text('The trace will open when the GPU starts.','GPU 开始运行后会打开决策记录。')}</div>` : inspect();if (phase === 5 && trace?.stage2?.length > 1) updateRanking();}function head(index, description) {const time = trace?.timings?.[['encode','beam','stage1',null,null,'stage2'][index]];return `<div class="inspect-head"><div><span class="micro">STEP 0${index + 1}</span><h3>${label(steps[index])}</h3></div>${time === undefined ? '' : `<time>${time.toFixed(2)} s</time>`}</div><p class="explain">${description}</p>`;}function routing() {return `<div class="route-map" data-changed="${trace.changed}"><div class="route-root"><span>ARGMAX · STAGE 1</span><strong>Beam ${rankLabel(trace.anchor)}</strong></div><svg viewBox="0 0 400 43" preserveAspectRatio="none" aria-hidden="true"><path d="M200 0V19H100V43"/><path d="M200 0V19H300V43"/></svg><div class="branches"><div class="branch unchanged"><small>${stateLabel(false)}</small><b>${text('Early Exit · return anchor','提前退出 · 直接输出锚点')}</b></div><div class="branch changed"><small>${stateLabel(true)}</small><b>${text('Change Branch · filter candidates','变化分支 · 过滤候选')}</b></div></div></div>`;}function inspect() {if (phase === 0) return head(0, text('RSCaMa encodes the earlier and later views of the same location into joint visual features for the caption generator.','RSCaMa 将同一地点的前后影像编码为联合视觉特征,交给描述生成器。')) + `<div class="encoding"><div class="feature-pair">${selected.media.map((path, index) => `<div>${image(path, index === 1)}<b>T${index + 1}</b></div>`).join('')}</div>4 unmodified lines<div class="deck"><i aria-hidden="true"></i><i aria-hidden="true"></i><div><small>BEAM ${rankLabel(0)} / TOP-1</small><strong lang="en">${escape(trace.captions[0])}</strong></div></div><details><summary>${text('Inspect all Beam-15 candidates','查看全部 15 条候选')}</summary><ol class="beam-list">${trace.captions.map((caption, index) => `<li><code>${rankLabel(index)}</code><span lang="en">${escape(caption)}</span></li>`).join('')}</ol></details>` : pending());if (phase === 2) return head(2, text('Elephant-1 reads both images and scores all 15 caption slots.','Elephant-1 读取双图并为全部 15 个候选槽位打分。')) + (trace?.stage1 ? `<div class="pool-head"><span>${text('Stage 1 slots · sorted by probability','第一阶段槽位 · 按概率排序')}</span><span>P(slot)</span></div><ol class="pool">${trace.stage1.slice().sort((first, second) => second[1] - first[1]).map(([index, prob]) => {const isAnchor = index === trace.anchor;1 unmodified line}).join('')}</ol>` : pending()) + task(0);if (phase === 3) {return head(3, text('The highest-scoring caption anchors the decision. Its state determines which branch runs.','得分最高的描述成为锚点,由它的变化状态决定走哪条分支。'));}if (phase === 4 || phase === 5) {if (trace.changed === false) return head(phase, text('Stage 1 locked Unchanged. The anchor goes straight to the output.','第一阶段已锁定无变化,锚点直接作为最终输出。')) + `<div class="empty bypass-note"><h4>${text('Skipped — Early Exit','已跳过 — 提前退出')}</h4><p>${text('No change candidates were filtered or scored by Stage 2.','这条路径不进行变化候选过滤,也不调用第二阶段。')}</p></div>`;if (phase === 4) return head(4, text('Drop no-change captions and duplicates before comparing change details.','先去掉无变化描述和重复描述,再比较变化细节。')) + `<div class="eligible"><span>${trace.eligible?.length ?? 0} / ${trace.captions.length} ${text('kept','条保留')}</span>${trace.captions.map((caption, index) => `<code class="${trace.eligible?.includes(index) ? 'kept' : ''}" title="${escape(caption)}">${rankLabel(index)}</code>`).join('')}</div><ol class="beam-list">${trace.captions.map((caption, index) => `<li><code>${rankLabel(index)}</code><span lang="en">${escape(caption)}</span><small>${trace.eligible?.includes(index) ? text('Kept','保留') : text('Filtered','已过滤')}</small></li>`).join('')}</ol>`;return head(5, text('Elephant-1 compares the remaining descriptions. β calibrates the score by caption length.','Elephant-1 比较剩余描述,再按句长用 β 校准得分。')) +(trace.stage2?.length > 1 ? `<div class="formula"><code>log(max(P(slot), 10⁻³⁰)) − β × words</code><label class="range-label" for="beta">${text('Length penalty β','长度惩罚 β')}<output id="beta-value">${beta.toFixed(2)}</output></label><input id="beta" type="range" min="0" max="0.20" step="0.02" value="${beta}"><p class="fine">${text('The slider explores this fixed pool. The model output uses the validation-selected β.', '滑块只探索当前候选池;正式输出使用验证集选定的 β。')}</p></div><div id="ranks"></div>` : `<div class="empty">${trace.eligible?.length ? text('One eligible caption: selected directly.','仅一条合格候选,直接选择。') : text('No eligible captions: keep the Stage 1 anchor.','无合格候选,保留第一阶段锚点。')}</div>`) + task(1);}const slot = trace.stage2?.findIndex(([index]) => index === trace.final);const mapping = slot >= 0 && trace.stage2.length > 1 ? `item_${slot + 1} → Beam ${rankLabel(trace.final)}` : `Beam ${rankLabel(trace.final)}`;return head(6, trace.changed ? text(`The selected option maps back to its original caption. β = ${catalog.beta.toFixed(2)}.`,`将选中的选项回映为原始候选描述。β = ${catalog.beta.toFixed(2)}。`) : text('The Stage 1 anchor is the final output; Stage 2 was bypassed.','第一阶段锚点直接输出,第二阶段未执行。')) + `<p class="mapping"><code>${mapping}</code></p><div class="comparison">${[[text('Generator baseline','生成器基线'),0], [text('Stage 1 anchor','第一阶段锚点'),trace.anchor], [text('Final caption','最终描述'),trace.final],].map(([title, index]) => `<div><small>${title} · BEAM ${rankLabel(index)}</small><p lang="en">${escape(trace.captions[index])}</p></div>`).join('')}</div>`;}const pending = () => '';const task = index => `<details class="task"><summary>${text('Inspect the actual task instruction','查看实际任务指令(英文)')}</summary><p lang="en">${escape(catalog.tasks[index])}</p></details>`;function calibrated(scores, captions, penalty) {return scores.map(([index, probability], slot) => {const caption = captions[index];const words = caption.trim() ? caption.trim().split(/\s+/u).length : 0;const log = Math.log(Math.max(probability, 1e-30));return {index, probability, slot, words, log, score: log - penalty * words, caption};}).sort((first, second) => second.score - first.score);}function updateRanking() {byId('beta-value').textContent = beta.toFixed(2);byId('beta').setAttribute('aria-valuetext', beta.toFixed(2));const ranked = calibrated(trace.stage2, trace.captions, beta);byId('ranks').innerHTML = `<div class="pool-head"><span>${text('Eligible pool · sorted by calibrated score','同状态候选 · 按校准分排序')}</span><span>${text('Score','得分')}</span></div><ol class="pool">${ranked.map(({index, probability, slot, words, log, score, caption}, position) => `<li class="slot ${position === 0 ? 'winner warm' : ''}"><code>${rankLabel(index)}</code><div><span lang="en">${escape(caption)}</span><small>item_${slot + 1} · P ${(probability * 100).toFixed(2)}% · ln P ${log.toFixed(3)} · ${words} ${text('words','词')} · −${(beta * words).toFixed(3)}</small></div><div class="prob"><b>${score.toFixed(4)}</b>${position === 0 ? `<small>${text('SELECTED','选中')}</small>` : ''}</div></li>`).join('')}</ol>`;}33 unmodified linesphase = 0;beta = catalog.beta;renderCases();render();let source;try {7 unmodified linesconst onTrace = event => {try {const [payload] = JSON.parse(event.data);if (payload.name !== selected.name || !events.includes(payload.step)) throw new Error('Invalid trace');if (event.type === 'complete' && payload.step !== 'done') throw new Error('Incomplete trace');trace = payload;liveEvent = payload.step;if (follow) phase = level();if (event.type === 'complete') resolve();render();} catch (error) { reject(error); }8 unmodified linessource?.close();busy = false;renderCases();render();}}5 unmodified lineselse url.searchParams.delete('lang');history.replaceState(null, '', url);translate();if (catalog) { renderCases(); renderViewer(); renderExplorer(); renderVerification(); renderTasks(); render(); }});byId('task-grid').addEventListener('click', event => {const button = event.target.closest('[data-task]');if (!button || !catalog || Number(button.dataset.task) === activeTask) return;activeTask = Number(button.dataset.task);alternate = false;renderTasks();byId('task-grid').querySelector(`[data-task="${activeTask}"]`)?.focus({preventScroll:true});});byId('probe').addEventListener('click', event => {const button = event.target.closest('[data-variant]');if (!button || (button.dataset.variant === '1') === verifySwap) return;verifySwap = button.dataset.variant === '1';renderVerification();byId('probe').querySelector(`[data-variant="${Number(verifySwap)}"]`).focus({preventScroll:true});byId('task-announcement').textContent = byId('probe').querySelector('.probe-picked').textContent;});byId('aux-probe').addEventListener('click', event => {const button = event.target.closest('[data-variant]');if (!button || (button.dataset.variant === '1') === alternate) return;alternate = button.dataset.variant === '1';renderTasks();byId('aux-probe').querySelector(`[data-variant="${Number(alternate)}"]`).focus({preventScroll:true});byId('task-announcement').textContent = byId('aux-probe').querySelector('.probe-picked').textContent;});byId('rank-explorer').addEventListener('click', event => {const button = event.target.closest('[data-rank]');if (!button || (button.dataset.rank === '1') === rankedView) return;rankedView = button.dataset.rank === '1';renderExplorer();byId('rank-explorer').querySelector(`[data-rank="${Number(rankedView)}"]`).focus({preventScroll:true});});byId('case-grid').addEventListener('click', event => {const button = event.target.closest('[data-case]');34 unmodified linesbyId('live').addEventListener('click', () => { if (catalog) run(); });translate();renderResults();byId('live').disabled = byId('replay').disabled = true;try {const response = await fetch('./catalog');if (!response.ok) throw new Error('Catalog unavailable');catalog = await response.json();select(0);renderExplorer();renderVerification();renderTasks();if (location.hash === inferenceHash) byId('trace-title').scrollIntoView();} catch {byId('load-error').textContent = text('Examples could not load. Refresh to retry.', '未能加载示例,请刷新重试。');}
54 unmodified lines555657585960616254 unmodified linesconst unchanged = 'no change has occurred';options = [option('A',alternate ? unchanged : house,!alternate,'96.9%'), option('B',alternate ? house : unchanged,alternate,'91.5%')];}return `<div class="sectionbar"><h2 id="probe-title">${text(...task.label)}</h2><span class="chip">${text('Task example','任务示例')}</span></div><h3 class="probe-question">${text(...task.hint)}</h3><p class="explain">${text(...task.explanation)}</p>${protocol(task, text)}${controls}<div class="pool-head">${text('Example decision','示例决策')}</div><ul class="probe-options" role="list">${options.join('')}</ul>`;}54 unmodified lines5556575859606154 unmodified linesconst unchanged = 'no change has occurred';options = [option('A',alternate ? unchanged : house,!alternate,'96.9%'), option('B',alternate ? house : unchanged,alternate,'91.5%')];}return `<h4 class="probe-question">${text(...task.hint)}</h4><p class="explain">${text(...task.explanation)}</p>${protocol(task, text)}${controls}<div class="pool-head">${text('Example decision','示例决策')}</div><ul class="probe-options" role="list">${options.join('')}</ul>`;}
.gitattributes+2
README.md+1-1
inference.py+13-10
public/cases.json+1-1
public/clips/test_000125.mp4Added
public/images/test_000125_A.pngAdded

Large File Pointer Details
- SHA256: 29b3d31bc4f7606abaa955dc715b8a735144d8694072a54b75d0069365b5e6a0
- Pointer size: 131 Bytes
- Size of remote file: 153 kB
public/images/test_000125_B.pngAdded

Large File Pointer Details
- SHA256: 663c374c1450d9298f31a952a5f45f0a53935b624d4b5cf85cd31965a7f55728
- Pointer size: 131 Bytes
- Size of remote file: 143 kB
workbench/index.html+34-17
workbench/lab.css+33-12
workbench/lab.js+141-100
workbench/tasks.js+1-2