{ "model": "google/embeddinggemma-2", "revision": "914f7f89142e33e77833254d9c9b90c3cef7303b", "hf_advertised_context": 8192, "hf_advertised_context_source": "/home/hous/.cache/huggingface/hub/models--google--embeddinggemma-2/snapshots/914f7f89142e33e77833254d9c9b90c3cef7303b/README.md lines 45, 68, 229-236: 8,192-token context shared by all modalities", "config_rope_position_limit": 262144, "config_rope_position_limit_source": "config.json text_config.max_position_embeddings = 262144; RoPE table bound, not the trained or advertised context", "tokenizer_model_max_length": "unbounded (1e30 in tokenizer_config.json); sentence_bert_config.json sets no max_seq_length", "target_context": 8192, "target_context_decision": "Target is the card value 8192. Stage T6 probes 16384, 32768 and beyond and records the largest length that runs in probed_contexts; it does not raise target_context above the card value.", "current_supported_context": 65536, "current_supported_context_owner": "T6-full-text, re-verified by T7-optimized-text", "per_modality_budget_from_card": { "text_tokens": 8192, "image_soft_tokens_default": 280, "image_soft_tokens_range": [ 70, 1120 ], "video_tokens_per_frame_default": 140, "audio_tokens_per_second": 25, "audio_max_seconds_card": 327 }, "limiting_reason": "device_dram", "capacity_evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/full_text/raw/long_probe_131071.json", "probed_contexts": [ { "context": 8192, "batch": 1, "runs": true, "forward_s": [ 0.175, 0.1 ], "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/optimized_full_text/raw/long_probe_8192.json", "stage": "T7-optimized-text" }, { "context": 16384, "batch": 1, "runs": true, "forward_s": [ 2.544, 0.243 ], "cos_vs_hf_fp32_768": 0.9999654357372991, "ids_source": "hf_long_refs", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/optimized_full_text/raw/long_probe_16384.json", "stage": "T7-optimized-text" }, { "context": 32768, "batch": 1, "runs": true, "forward_s": [ 2.679, 0.676 ], "cos_vs_hf_fp32_768": 0.999914147043677, "ids_source": "hf_long_refs", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/optimized_full_text/raw/long_probe_32768.json", "stage": "T7-optimized-text" }, { "context": 65535, "batch": 1, "runs": true, "forward_s": [ 4.776, 2.257 ], "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/optimized_full_text/raw/long_probe_65535.json", "stage": "T7-optimized-text" }, { "context": 65536, "batch": 1, "runs": true, "forward_s": [ 4.089, 2.185 ], "cos_vs_hf_fp32_768": 0.9998118937694584, "ids_source": "hf_long_refs", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/optimized_full_text/raw/long_probe_65536.json", "stage": "T7-optimized-text" }, { "context": 131071, "batch": 1, "runs": false, "forward_s": null, "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": "TT_FATAL @ /home/hous/dev/embedding-gemma-2/tt-metal/tt_metal/impl/allocator/bank_manager.cpp:495: false", "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/full_text/raw/long_probe_131071.json", "stage": "T6-full-text" }, { "context": 131072, "batch": 1, "runs": true, "forward_s": [ 13.143, 7.744 ], "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/optimized_full_text/raw/long_probe_131072.json", "stage": "T7-optimized-text" }, { "context": 262144, "batch": 1, "runs": true, "forward_s": [ 144.971, 145.093 ], "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/full_text/raw/long_probe_262144.json", "stage": "T6-full-text" }, { "context": 524288, "batch": 1, "runs": true, "forward_s": [ 588.317 ], "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/full_text/raw/long_probe_524288.json", "stage": "T6-full-text" } ], "checker": "python $TT_MODEL_BRINGUP_ROOT/scripts/check_context_contract.py --model-dir $TT_METAL_HOME/models/autoports/google_embeddinggemma_2 --require-contract (no --hf-model, so the target is hf_advertised_context and not the RoPE bound)", "audio_length_facts": { "feature_extractor_default": "Gemma4AudioFeatureExtractor truncates at max_length=480000 samples (30 s, 750 audio tokens) when truncation=True, the default (feature_extraction_gemma4.py:230-231).", "untruncated": "With truncation=False passed through processor audio_kwargs, length is limited only by the 8192-token context: 25 audio tokens per second, about 327 s (card line 236). Host probe: 60 s gives 1500 tokens.", "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/architecture.md Section 6.3; /home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/bringup/references/README.md" }, "per_modality_targets": { "text_max_tokens": 8192, "audio_max_tokens": 8000, "audio_max_seconds": 320, "audio_truncation": false, "audio_target_reason": "Card advertises about 327 s in the shared 8192-token context. 8000 audio tokens leave room for prompt and special tokens.", "vision_soft_token_budgets": [ 70, 280, 1120 ], "vision_default_budget": 280, "video_max_frames_tested": 58, "video_target_reason": "Card advertises about 58 frames. HF default max_frames is 32. Reference vid04 (320x240, max_frames=58) gives 58 frames, 130 tokens per frame, 7658 ids, which fits 8192. Frames that pool to the full 140 tokens cost 142 ids each, so 57 frames is the limit for those (8096 ids).", "multi_image_max_images": 29, "multi_image_reason": "Card lists about 29 images at the default budget 280 in one 8192 context. HF probe: 29 images give 7774 ids.", "video_low_budget_max_frames": 114, "video_low_budget_soft_tokens": 70, "video_low_budget_reason": "Card lists about 114 images or frames at a lower vision budget. HF probe: 114 frames at budget 70 give 7412 ids." }, "functional_encoder_layer": { "stage": "T1-functional-text", "prefill_max_tested_with_hf_golden": 8192, "prefill_lengths_tested_with_hf_golden": [ 1, 7, 31, 32, 33, 100, 128, 511, 512, 513, 514, 515, 544, 545, 546, 577, 1000, 1024, 1025, 1026, 1056, 1100, 2048, 2049, 3001, 4096, 8191, 8192 ], "prefill_probed_beyond_target": [ 16384, 32768 ], "prefill_probe_result": "both layer kinds run at 16384 and 32768 (batch 1); PCC vs torch reference >= 0.99982; evidence doc/functional_encoder_layer/evidence/long_probe.json", "decode": "not applicable: encoder, no KV cache and no decode step", "capability_reduction": null, "note": "Layer-level evidence only. current_supported_context for the full embedder is owned by T6-full-text." }, "fused_encoder_layer": { "stage": "T2-fused-text", "prefill_max_tested_with_hf_golden": 8192, "prefill_lengths_tested_with_hf_golden": [ 1, 7, 31, 32, 33, 100, 128, 511, 512, 513, 514, 515, 544, 545, 546, 577, 1000, 1024, 1025, 1026, 1056, 1100, 2048, 2049, 3001, 4096, 8191, 8192 ], "prefill_probed_beyond_target": [ 16383, 16384, 16385, 32768 ], "prefill_probe_result": "both layer kinds run at 16383, 16384, 16385 and 32768 (batch 1); PCC vs torch reference >= 0.99986", "prefill_probe_evidence": [ "doc/fused_encoder_layer/evidence/long_probe.json" ], "decode": "N/A: encoder, no KV cache", "kv_cache_dtype": "N/A: no KV cache", "capability_change": "none. Every logical length >= 1 and batch 1..32 stays supported; no public alignment restriction.", "layout_change": "Uniform-length inputs (every valid length equal to S, any batch) use 32-aligned physical rows and no attention mask; SDPA sees a logical-length view; sliding layers use sliding_window_size=1024, full layers use no window when ceil(S/chunk) is even, else a window of 2x the physical rows. Mixed or bucket-padded inputs use mixed_physical_length(S, B) rows (256-aligned if S >= 2048 or S >= 1024 with B >= 8; 128-aligned if S >= 512 and 64-alignment forces dense chunk 32; else 64-aligned); sliding layers keep the dense [B,1,S,S] bf16 mask; full layers fold the batch into rows with cu_window_seqlens when folded_chunk(B, rows, dense_chunk) selects it (measured crossover), else the dense mask.", "memory_change": "Maskless path frees the dense mask (128 MiB at S=8192 B=1, 4 GiB at S=8192 B=32). Each layer stores packed QKV plus Q and packed K/V copies: +2 MiB (sliding) or +3 MiB (full) bf16 per layer, 52 MiB for 20 sliding and 4 full layers.", "current_supported_context_owner": "T6-full-text", "maskless_inputs": "every uniform-length input, all S >= 1; full layers also for folded mixed batches" }, "optimized_encoder_layer": { "stage": "T3-optimized-text", "prefill_max_tested_with_hf_golden": 8192, "prefill_lengths_tested_with_hf_golden": [ 1, 7, 31, 32, 33, 100, 128, 511, 512, 513, 514, 515, 544, 545, 546, 577, 1000, 1024, 1025, 1026, 1056, 1100, 2048, 2049, 3001, 4096, 8191, 8192 ], "prefill_probed_beyond_target": [ 16383, 16384, 16385, 32768 ], "prefill_probe_result": "both layer kinds run at [16383, 16384, 16385, 32768] (batch 1); min PCC vs torch reference 0.999686", "prefill_probe_evidence": [ "doc/optimized_encoder_layer/evidence/long_probe.json" ], "decode": "N/A: encoder, no KV cache", "kv_cache_dtype": "N/A: no KV cache", "capability_change": "none. Every logical length >= 1 and batch 1..32 stays supported; no public alignment restriction.", "layout_change": "Activations in L1 interleaved when B x S_phys <= 8192 (MLP intermediates <= 6144, input-norm outputs <= 16384), DRAM above; full-layer Q/K/V always DRAM. B=1 S<=32 uses DRAM-sharded matmuls with width-sharded L1 activations inside the layer. Uniform B>1 folds the batch into rows (windowed SDPA) per the measured fold rule. Layer input and output stay [B,1,S_phys,512] BF16 DRAM.", "memory_change": "Weights per 24 layers: 227 MiB (T2 300 MiB; attention and PLE BFP8, MLP BF16) plus 187 MiB DRAM-sharded copies for the S<=32 path. BFP8 MLP/PLE/head intermediates halve those activation buffers. L1 use is bounded by the row limits above (CB clash beyond them, measured).", "current_supported_context_owner": "T6-full-text" }, "current_supported_context_basis": "Eager (untraced) path on one p150 (1x1 mesh, grid 11x10): every logical length up to 65536 runs; T7 code re-ran [8192, 16384, 32768, 65535, 65536, 131072] at batch 1 (cos vs HF fp32 in probed_contexts). The model card trains and advertises 8192.", "limiting_reason_detail": "Single inputs longer than 8192 that are not 256-aligned use one cached [S, S] BF16 band mask that also masks the padded keys (the model-dir SDPA kernel narrows the K loop to the window but its generated window mask, copied from stock TTNN, still ignores key padding). At 131071 tokens the mask is 32 GiB, above p150 device DRAM (T6 probe). 256-aligned lengths need no mask and ran to 524288 in T6.", "capacity_evidence_log": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/full_text/evidence/logs/long_probe_final.log", "capacity_evidence_detail": "2026-10-17 11:17:25.886 | critical | Always | TT_FATAL: Out of Memory: Not enough space to allocate 34359738368 B DRAM buffer across 8 banks, where each bank needs to store 4294967296 B, but bank size is 4272341376 B (allocated: 155155520 B, free: 4117185856 B, largest free block: 4117185856 B) (assert.hpp:104)", "probe_beyond_target_reason": "Probed 16384 to 524288 at batch 1; see probed_contexts.", "full_text": { "stage": "T6-full-text; embedder and batch contract updated in T7-optimized-text", "embedder": "tt/embedder.py build_embedder; eager by default with max_tokens = current_supported_context; traced=True captures per-bucket slots and caps max_tokens at 8192", "batching": "length-sorted batches, at most 32768 tokens per batch, bucket padding up to 8192, exact length above", "batch_contract": "batch 1 primary; batch 2..32 tested on the 256-input corpus: T7 cos vs batch 1 >= 0.999916 (bar 0.9999; T6 measured 0.99995 with its own plans)", "rope_position_limit_config": 262144, "decode": "N/A: encoder, no KV cache" }, "traced_contract": { "stage": "T7-optimized-text", "traced_supported_context": 8192, "basis": "build_embedder(..., traced=True) captures one trace per (bucket, batch) slot for buckets 32..8192 and caps max_tokens at the largest traced bucket. Running the eager path after capture compiles programs into memory the traces use (TT_METAL_TRACE_ALLOC_TRACKING reported 25 live buffers before replay), so a traced embedder rejects longer inputs; use an untraced embedder for 8193..65536 tokens.", "slots": "batch sizes 1, 2, 4, 8, 16, 32 capped at 32768 tokens per batch: 42 slots", "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/optimized_full_text/raw/trace_check.json" }, "multimodal": { "stage": "06-multimodal", "shared_context": "Text, image, video and audio share one 8192-token text context. Media soft tokens and their markers count against it: image <|image> + S x <|image|> + ; video per frame <|image> + K x <|video|> + ; audio <|audio> + A x <|audio|> + .", "embedder": "tt/embedder.py build_multimodal_embedder(model_dir, mesh, traced=...); mesh opened with l1_small_size=32768 (audio conv2d) and trace_region_size >= 2.5e9 when traced", "eager_supported": { "text_tokens": 65536, "image_budgets": [ 70, 140, 280, 560, 1120 ], "multi_image_max_images_tested": 29, "video_max_frames_tested": { "budget_140": 58, "budget_70": 114 }, "audio_max_tokens_tested": 8000, "audio_max_seconds_tested": 320, "audio_truncation_false_supported": true }, "traced_contract": { "rule": "One trace per media slot (kind, batch, physical text length, tower images/frames or audio token bucket, patches). A traced embedder runs only inputs that fit a captured slot and raises ValueError otherwise; eager after capture is not trace-safe (T7 finding).", "default_media_slots": [ { "kind": "image", "batch": 1, "physical_len": 512, "tower_n": 1, "patches": 2520 }, { "kind": "image", "batch": 8, "physical_len": 512, "tower_n": 8, "patches": 2520 }, { "kind": "image", "batch": 1, "physical_len": 8192, "tower_n": 1, "patches": 2520 }, { "kind": "image", "batch": 1, "physical_len": 8192, "tower_n": 32, "patches": 2520 }, { "kind": "video", "batch": 1, "physical_len": 2048, "tower_n": 8, "patches": 1260 }, { "kind": "video", "batch": 1, "physical_len": 8192, "tower_n": 32, "patches": 1260 }, { "kind": "audio", "batch": 1, "physical_len": 1024, "tower_n": 768, "patches": 0 }, { "kind": "audio", "batch": 8, "physical_len": 1024, "tower_n": 768, "patches": 0 }, { "kind": "audio", "batch": 1, "physical_len": 8192, "tower_n": 768, "patches": 0 } ], "long_media_slots_verified": [ "image 70/140/560/1120 budgets b1", "29 images 8192", "video 64 frames 8192 (58-frame input)", "video 128 frames at 630 patches 8192 (114-frame input)", "audio 1504 tokens 2048", "audio 8000 tokens 8192" ], "text_slots": "T7 default 42 slots, buckets 32..8192", "default_media_slots_note": "kind, batch, physical text rows, tower capacity (images/frames, or audio token bucket), patches per image or frame; covers default processor settings, captions up to 8192 ids with one image or one 30 s clip, up to 32 images, 8 or 32 video frames", "source": "tt/embedder.py DEFAULT_MEDIA_SHAPES", "long_caption_and_multi_image_traced_vs_eager_bitwise": { "image": true, "video": true, "audio": true, "image_long_caption": true, "audio_long_caption": true, "multi_image_29": true } }, "limits": [ "one media kind per input (image list, one video, or one audio clip); mixed kinds raise ValueError", "one audio clip per input", "audio sampling rate 16000", "inputs longer than 8192 ids in traced mode need an untraced embedder", "one traced embedder per mesh: the eager guard checks only its own pipeline's trace state" ], "verified_cases_cos768_vs_hf_fp32": { "max_multi_image": { "case": "img29_cycle_640x480__soft280", "ids": 7774, "cos": 0.999932 }, "max_video_frames_140": { "case": "vid04_slideshow_58s", "ids": 7658, "cos": 0.999942 }, "max_video_frames_70": { "case": "vid05_slideshow_114s", "ids": 7412, "cos": 0.999943 }, "max_audio": { "case": "aud08_speech_320s__untruncated", "ids": 8004, "cos": 0.999945 }, "max_image_budget": { "case": "img08_document_page__soft1120", "cos": 0.999909 } }, "evidence": [ "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/multimodal/raw/e2e_traced4.json", "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/multimodal/raw/e2e_eager4.json", "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/multimodal/raw/trace_check.json", "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/multimodal/raw/audio_shapes.json" ] }, "tt_metal": { "sha": "3be67656b28e3902f0366ea8bab03c41e7e5bd6c", "modified": false, "revalidated_by": "R1-self-contained: probes, accuracy and traced slots re-run on the stock build" }, "datatype_sweep": { "stage": "08-datatype-sweep", "selected_policy_id": "x02_u10_audio_attn_ffn_bfp8_hifi2", "selected_policy_file": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/tt/precision_policy.json", "kv_cache_dtype": "N/A: encoder, no KV cache; K and V live only inside one forward (bf16 SDPA inputs).", "capacity_effect": "Selected policy x02_u10_audio_attn_ffn_bfp8_hifi2 lowers weight bytes (audio ffn_down, audio ffn_up, audio post, audio qkv, text ple_gate, text ple_proj, vision down, vision gate, vision o, vision qkv, vision up at BFP8) and intermediate activation bytes (gate_up output, geglu output, heads_dtype bfp8, ple_gate output, ple_mul output, ple_proj output; text residual bf16). No KV cache, trace buffer layout or chunking change. No buffer grows, so the advertised and supported contexts are kept and re-verified below.", "probed_contexts_selected_policy": [ { "context": 8192, "batch": 1, "runs": true, "finite": true, "forward_s": [ 0.136, 0.07 ], "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/long_probe_8192.json" }, { "context": 16384, "batch": 1, "runs": true, "finite": true, "forward_s": [ 0.452, 0.163 ], "cos_vs_hf_fp32_768": 0.9998667695125596, "ids_source": "hf_long_refs", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/long_probe_16384.json" }, { "context": 32768, "batch": 1, "runs": true, "finite": true, "forward_s": [ 0.544, 0.46 ], "cos_vs_hf_fp32_768": 0.9998331148106778, "ids_source": "hf_long_refs", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/long_probe_32768.json" }, { "context": 65535, "batch": 1, "runs": true, "finite": true, "forward_s": [ 1.621, 1.538 ], "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/long_probe_65535.json" }, { "context": 65536, "batch": 1, "runs": true, "finite": true, "forward_s": [ 1.636, 1.467 ], "cos_vs_hf_fp32_768": 0.9996995336745357, "ids_source": "hf_long_refs", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/long_probe_65536.json" }, { "context": 131072, "batch": 1, "runs": true, "finite": true, "forward_s": [ 5.122, 5.118 ], "cos_vs_hf_fp32_768": null, "ids_source": "synthetic corpus cycle", "error": null, "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/long_probe_131072.json" } ], "largest_probed_context_that_runs": 131072, "current_supported_context_kept": 65536, "current_supported_context_reverified": true, "non_aligned_and_band_edge_cases": { "n_cases": 88, "cos_min_vs_hf_fp32": 0.9993343291927769, "lengths_include": [ 512, 513, 514, 545, 1025, 1026, 8191 ], "evidence": "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/length_cases.json" }, "traced_supported_context": 8192, "traced_reverified": { "text_slots_captured": 47, "all_slots_replayed": true, "over_context_rejected": "inputs [0] exceed the supported context of 8192 tokens", "multimodal_captures": 51, "multimodal_result": "pass", "evidence": [ "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/trace_check.json", "/home/hous/dev/embedding-gemma-2/tt-metal/models/autoports/google_embeddinggemma_2/doc/datatype_sweep/post_selection/raw/multimodal/trace_check.json" ] }, "construction_paths_use_same_max_context": "build_embedder / build_multimodal_embedder set max_tokens = supported_tokens() (eager) or the largest traced bucket 8192 (traced) independently of the precision policy; the policy file has no context field." } }