

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Gemma 4 E2B
<a name="model-card-google-gemma-4-e2b"></a>

## ![带有彩色 G 字母图标的 Google 徽标。](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/models/google.png) 谷歌 — Gemma 4 E2B
<a name="model-card-google-gemma-4-e2b-header"></a>

## 模型详细信息
<a name="model-card-google-gemma-4-e2b-details"></a>

Gemma 4 E2B是谷歌的紧凑型模型，共有51亿个参数和23亿个使用 Per-Layer 嵌入式（PLE）的有效参数，专为低延迟工作负载而设计，具有内置推理、原生函数调用以及跨文本和图像的多模态输入，支持12.8K令牌上下文窗口。有关模型开发和性能的更多信息，请参阅[model/service 卡片](https://huggingface.co/google/gemma-4-E2B-it)。
+ **模型发布日期：2026 年 ** 3 月 31 日
+ **EOL 不早于：2027 年 ** 3 月 31 日
+ **遗产期：至**少 6 个月
+ **模型生命周期政策：**[模型生命周期（适用于 2026 年 9 月 7 日之前发布的模型）](model-lifecycle-legacy.md)
+ **模特停产日期：** N/A
+ **最终用户许可协议和使用条款：**[查看 ](https://ai.google.dev/gemma/apache_2)
+ **模型生命周期：**活跃
+ **上下文窗口：**128K 代币


| **输入模式 ** | **输出模式 ** | **[支持的 API ](apis.html) ** | **[支持的终端节点 ](endpoints.html) ** | 
| --- | --- | --- | --- | 
| ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png)音频 | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png)嵌入 | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) Responses | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) bedrock-runtime | 
| ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png)图片 | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png)图片 | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) Chat Completions | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) bedrock-mantle | 
| ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png)演讲 | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png)演讲 | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) Invoke |  | 
| ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png)文本 | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png)文本 | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) Converse |  | 
| ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png)视频 | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png)视频 | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) Messages |  | 

**注意**  
Gemma 4 型号仅在`bedrock-mantle`终端上可用。

*开启`bedrock-mantle`，此模型的服务`/openai/v1/responses`地址不是默认模式`/v1/responses`。*

## 能力和特性
<a name="model-card-google-gemma-4-e2b-capabilities"></a>

***基岩特征 * **

**使用`bedrock-mantle`终端节点支持的功能 **


| **支持的 ** | **不支持 ** | 
| --- | --- | 
|  + ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png)[Client-side 工具调用 ](tool-use.html)<br />+ ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png)[推理 ](reasoning.html)<br />+ ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png)[项目 ](projects.html)  | — | 

## 定价
<a name="model-card-google-gemma-4-e2b-pricing"></a>

有关定价信息，请参阅[亚马逊基岩定价](https://aws.amazon.com/bedrock/pricing/)页面。

## 以编程方式访问
<a name="model-card-google-gemma-4-e2b-programmatic-access"></a>

使用以下模型 ID 和端点 URL 以编程方式访问此模型。有关可用 API 和终端节点的更多信息，请参阅支持[的 API ](apis.html) 和支持的[终端节点](endpoints.html)。


| **Endpoint** | **模特 ID ** | **In-Region 端点 URL ** | **地理推断 ID ** | **全局推理 ID ** | 
| --- | --- | --- | --- | --- | 
| bedrock-mantle | google.gemma-4-e2b | https://bedrock-mantle.{region}.api.aws/openai/v1 | 不支持 | 不支持 | 

*例如，如果区域为 us-east-1（弗吉尼亚北部），则基岩地堡终端节点 URL 将为 “”。https://bedrock-mantle.us-east-1.api.aws/openai/v1*

## 服务等级
<a name="model-card-google-gemma-4-e2b-tiers"></a>

Amazon Bedrock 提供多个服务等级以满足您的工作负载要求。**Standard ** 提供按代币付费的访问权限，无需承诺（设置`"service_tier": "default"`或省略该字段）。****Priority 以溢价（套装`"service_tier": "priority"`）提供最快的响应时间。**Flex ** 为灵活、非时间敏感的工作负载（套装）提供更低成本的访问权限。`"service_tier": "flex"`**预留**为可预测的工作负载提供专用吞吐量和期限承诺；它是在账户级别设置的，而不是根据每个请求设置的（请联系您的 AWS 账户团队来启用）。有关更多信息，请参阅[服务等级](service-tiers-inference.html)。


| **Standard** | **优先级** | **Flex ** | **已保留 ** | 
| --- | --- | --- | --- | 
| ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | 

## 区域可用性
<a name="model-card-google-gemma-4-e2b-regional-availability"></a>

***区域可用性一览 * **

Amazon Bedrock 提供三种推理选项：将请求**In-Region**保留在单一区域内以确保严格合规；在尊重数据驻留的情况下跨地理区域（例如美国、欧盟和亚太地区）进行地理路由；在没有居住限制的情况下，**全球 Cross-Region**路由到全球任何地方。** Cross-Region **有关更多详细信息，请参阅该[按型号划分的区域可用性](models-region-compatibility.md)页面。


| **区域** | **In-Region** | **地理 ** | **Global** | 
| --- | --- | --- | --- | 
| us-east-1（弗吉尼亚北部） | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | 
| us-east-2（俄亥俄州） | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | 
| us-west-2（俄勒冈州） | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | 
| eu-central-1（法兰克福） | ![Green circle with white checkmark icon.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-yes.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | ![Red circle with white X icon indicating error, cancel, or close action.](https://docs.aws.amazon.com/zh_cn/bedrock/latest/userguide/images/icons/icon-no.png) | 

## 配额和限制
<a name="model-card-google-gemma-4-e2b-quotas"></a>

您的 AWS 账户有默认配额，以维持服务的性能并确保适当使用 Amazon Bedrock。分配给账户的默认配额可能会根据地区因素、付款历史记录、欺诈性使用、配额[增加请求的 and/or 批准情况进行更新](quotas-increase.html)。有关更多信息，请参阅[Amazon Bedrock 的配额](quotas.md)文档并查看模型[的](/general/latest/gr/bedrock.html#limits_bedrock)限制。

在`bedrock-mantle`终端上消耗按需吞吐量时，[可用吞吐量会随着时间的推移而增加](scaling-throughput-best-practices.html#scaling-ramp-up)。在需求旺盛的时期，并非所有配额内的请求都能保证成功，因此逐步增加很重要。在此模型中，默认限制不是通过服务配额直接显示的，因此我们建议您以此为指导。

## 示例代码
<a name="model-card-google-gemma-4-e2b-sample-code"></a>

**第 1 步- AWS 账户：**如果您已经有 AWS 账户，请跳过此步骤。如果您是新手 AWS，请注册一个 A [ WS 账户](https://portal.aws.amazon.com/billing/signup)。

**第 2 步-API 密钥：**前往[亚马逊 Bedrock 控制台](https://console.aws.amazon.com/bedrock/home#/api-keys/long-term/create)并生成长期 API 密钥。

**第 3 步-获取 SDK：**要使用此入门指南，必须已安装 Python。然后根据您使用的 API 安装相关软件。

```
pip install openai
```

**第 4 步-设置环境变量：将您的环境**配置为使用 API 密钥进行身份验证。

```
OPENAI_API_KEY="<provide your Bedrock API key>"
OPENAI_BASE_URL="https://bedrock-mantle.<your-region>.api.aws/openai/v1"
```

**第 5 步-运行您的第一个推理请求：**将文件另存为 `bedrock-first-request.py`

------
#### [ Chat Completions API ]

```
from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="google.gemma-4-e2b",
    messages=[{"role": "user", "content": "Can you explain the features of Amazon Bedrock?"}]
    )
print(response)
```

------
#### [ Responses API ]

```
from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="google.gemma-4-e2b",
    input="Explain the benefits of mixture-of-experts architectures for production inference.",
    max_output_tokens=512,
)
print(response.output_text)
```

------

## 使用注意事项和限制
<a name="model-card-google-gemma-4-e2b-considerations"></a>
+ **推理模式 ** — 聊天完成和响应 API 均支持推理工作，该模型在这两种情况下都执行扩展推理。但是，推理内容仅由响应 API 返回。聊天完成 API 不返回推理令牌，因为 OpenAI 聊天完成规范不支持返回它们。
+ **推理工作 ** — 对于 Gemma 4 E2B，我们建议`reasoning_effort`将设置为`high`，这样可以启用思维模式。默认情况下，这种变体往往会进行大量推理，并且高度的推理工作会将推理保留在专用的推理通道中，从而提高输出质量并防止推理文本出现在最终响应中。
+ **并行工具调用 **-目前不支持在单回合中请求多个工具调用。一次只能调用一个请求工具。
+ **请求负载大小 ** — Gemma 4 E2B 的请求正文总负载（包括图像和视频）支持的最大大小为 3.5 MB。