Describe the issue
The Foundry Local model gemma-4-e2b-it-generic-gpu:2 advertises a context length of 131,072 tokens, but Foundry Local SDK/runtime v2.0.1 rejects requests using more than 4,096 total tokens.
The downloaded model package contains conflicting values in genai_config.json:
model.context_length: 131072
search.max_length: 4096
At runtime, request validation uses the 4,096-token value. A text-only request with approximately 127,826 input tokens and 256 requested output tokens (128,082 total) is below the advertised 131,072-token context but is rejected as exceeding the model's maximum context length of 4,096 tokens.
Short text prompts and image inference work with the same model and WebGPU backend, so this appears to be a context-length/configuration mismatch rather than a general WebGPU execution failure.
This is similar to #969, but affects the Gemma 4 WebGPU model and limits it to 4,096 tokens.
To reproduce
- Install Foundry Local SDK/runtime v2.0.1.
- Resolve and download
gemma-4-e2b-it-generic-gpu:2 using the C++ API.
- Load the model with the WebGPU provider.
- Submit a text-only request containing approximately 127,826 input tokens and request up to 256 output tokens.
- Observe that the request is rejected against a 4,096-token maximum.
- Inspect the downloaded
genai_config.json and observe that model.context_length is 131,072 while search.max_length is 4,096.
Expected behavior
The runtime should support the advertised 131,072-token context window, with input and requested output counted together. If the model variant intentionally supports only 4,096 tokens, the catalog metadata and model.context_length should report that effective limit consistently.
Platform and architecture
macOS Apple Silicon
OS Version
macOS
Installation type
Released package/binary
Foundry Local version
Foundry Local SDK/runtime 2.0.1
API or surface area
C++ API
Hardware acceleration/backend
WebGPU
Model
gemma-4-e2b-it-generic-gpu:2
Describe the issue
The Foundry Local model
gemma-4-e2b-it-generic-gpu:2advertises a context length of 131,072 tokens, but Foundry Local SDK/runtime v2.0.1 rejects requests using more than 4,096 total tokens.The downloaded model package contains conflicting values in
genai_config.json:model.context_length:131072search.max_length:4096At runtime, request validation uses the 4,096-token value. A text-only request with approximately 127,826 input tokens and 256 requested output tokens (128,082 total) is below the advertised 131,072-token context but is rejected as exceeding the model's maximum context length of 4,096 tokens.
Short text prompts and image inference work with the same model and WebGPU backend, so this appears to be a context-length/configuration mismatch rather than a general WebGPU execution failure.
This is similar to #969, but affects the Gemma 4 WebGPU model and limits it to 4,096 tokens.
To reproduce
gemma-4-e2b-it-generic-gpu:2using the C++ API.genai_config.jsonand observe thatmodel.context_lengthis 131,072 whilesearch.max_lengthis 4,096.Expected behavior
The runtime should support the advertised 131,072-token context window, with input and requested output counted together. If the model variant intentionally supports only 4,096 tokens, the catalog metadata and
model.context_lengthshould report that effective limit consistently.Platform and architecture
macOS Apple Silicon
OS Version
macOS
Installation type
Released package/binary
Foundry Local version
Foundry Local SDK/runtime 2.0.1
API or surface area
C++ API
Hardware acceleration/backend
WebGPU
Model
gemma-4-e2b-it-generic-gpu:2