/ Модель

Характеристики

Лицензия
Apache 2.0
Архитектура
gemma4 · dense
Базовая модель
gemma-4-E2B-it
Библиотека
transformers
Опубликована
28 ноя 2026

Gemma4-E2B-Function-Calling-xLAM

Генерация текстаТекст → текст3 профессии

Дообученная Gemma 4 E2B IT генерирует JSON-вызовы функций по текстовому запросу и описаниям инструментов.

341скачиваний за 30 дней0лайковвеса обновлены28 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Gemma4-E2B-Function-Calling-xLAM — дообученная Ermiaz Azarkhalili версия google/gemma-4-E2B-it для вызова функций. Модель обучалась на датасете Salesforce/xlam-function-calling-60k с QLoRA и SFTTrainer; адаптер затем объединён с копией базовой модели в формате bf16. Репозиторий содержит полный мультимодальный чекпойнт Gemma4ForConditionalGeneration, но дообучались только языковые веса, а обучение и описанный сценарий использования рассчитаны на текст.

Модель принимает текстовый запрос с описаниями инструментов в формате JSON и генерирует блок ответов с вызовами функций, также в JSON. Для промпта используется специальный тег начала, а стандартный chat template не применяется. Указанная длина обучения — до 2048 токенов; это не подтверждает максимальный контекст модели. Карточка приводит только значения потерь на обучающей и проверочной выборках, без бенчмарка точности вызова функций. Лицензия — Apache-2.0.

Сценарии применения

  • генерация вызовов API из текстового запроса
  • выбор инструмента и формирование аргументов в JSON
  • подключение функций к диалоговому ассистенту
  • автоматизация вызовов инструментов по описаниям на английском языке

Ограничения

Точность вызова функций не оценивалась отдельным бенчмарком; приведены только показатели потерь. Для промпта требуется специальный тег начала и формат без стандартного chat template.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Gemma4-E2B-Function-Calling-xLAM

google/gemma-4-E2B-it fine-tuned for function calling on Salesforce/xlam-function-calling-60k with QLoRA (Transformers + PEFT + TRL SFTTrainer), then merged into a bf16 copy of the base model.

What this repository contains

The full multimodal checkpoint (Gemma4ForConditionalGeneration). LoRA adapted only the language model; the vision and audio encoders are the base model's weights, unchanged, and the base model's processor is included. Training and the usage below are text-only.

Prompt format

Raw tagged text, no chat template. The prompt is the query and tools blocks; the model writes the answers block and then <eos>. Tools and answers are JSON. The prompt starts with <bos>, which this tokenizer does not add by itself.

<bos><query>...</query>

<tools>[...tool definitions as JSON...]</tools>

<answers>[...function calls as JSON...]</answers><eos>

Only the answers block and the EOS carried loss in training.

Usage

import json
from transformers import AutoModelForCausalLM, AutoTokenizer

repo = 'ermiaazarkhalili/Gemma4-E2B-Function-Calling-xLAM'
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype="auto", device_map="auto")

query = 'What information can be obtained about the Maine Coon cat breed?'
tools = json.loads('[{"name": "get_breed_information", "description": "Fetch information about a specific cat breed from the Cat Breeds API.", "parameters": {"breed": {"description": "The name of the cat breed to fetch information for.", "type": "str", "default": "aegean"}}}, {"name": "country_region_cities", "description": "Fetches a list of cities within a specified region of a given country from the GeoDB API.", "parameters": {"countryid": {"description": "An ISO-3166 country code or WikiData ID.", "type": "str", "default": "US"}, "regioncode": {"description": "An ISO-3166 or FIPS region code.", "type": "str", "default": "CA"}, "limit": {"description": "The maximum number of results to retrieve. Defaults to None.", "type": "int, optional", "default": ""}, "hateoasmode": {"description": "Include HATEOAS-style links in results. Defaults to None.", "type": "bool, optional", "default": ""}, "asciimode": {"description": "Display results using ASCII characters. Defaults to None.", "type": "bool, optional", "default": ""}, "nameprefixdefaultlangresults": {"description": "Match on names in the default language if a non-default language is requested when prefix-matching. Defaults to None.", "type": "bool, optional", "default": ""}, "timezoneids": {"description": "Only include cities in these time zones. Comma-separated values. Defaults to None.", "type": "str, optional", "default": ""}, "nameprefix": {"description": "Only include cities whose names start with this prefix. If languagecode is set, the prefix will be matched on the name as it appears in that language. Defaults to None.", "type": "str, optional", "default": ""}, "types": {"description": "Only include cities of these types (comma-separated): CITY, ADM2. Defaults to None.", "type": "str, optional", "default": ""}, "minpopulation": {"description": "Only include cities with at least this population. Defaults to None.", "type": "int, optional", "default": ""}, "languagecode": {"description": "Display results in this language. Defaults to None.", "type": "str, optional", "default": ""}, "offset": {"description": "The zero-based offset into the results. Defaults to None.", "type": "int, optional", "default": ""}, "maxpopulation": {"description": "Only include cities with no more than this population. Defaults to None.", "type": "int, optional", "default": ""}, "includedeleted": {"description": "Whether to include any cities marked deleted. Options are: ALL, SINCE_YESTERDAY, SINCE_LAST_WEEK, NONE. Defaults to None.", "type": "str, optional", "default": ""}, "sort": {"description": "How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = elevation, name, population. Defaults to None.", "type": "str, optional", "default": ""}}}, {"name": "company_details", "description": "Fetch details of a company from Indeed\'s API.", "parameters": {"company_id": {"description": "The unique identifier of the company to fetch details for.", "type": "str", "default": "Microsoft"}, "locality": {"description": "The locality or country code for Indeed\'s subdomain. Default is \'us\' if not provided.", "type": "str, optional", "default": ""}}}]')
prompt = (
    '<bos>'
    + '<query>' + query + '</query>' + '\n\n'
    + '<tools>' + json.dumps(tools, ensure_ascii=False) + '</tools>' + '\n\n'
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=995, do_sample=False, eos_token_id=tokenizer.eos_token_id)
text = tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True)
calls = json.loads(text.split('<answers>', 1)[1].split('</answers>', 1)[0])
print(calls)

Training

Smoke test: False.

SettingValue
model_namegoogle/gemma-4-E2B-it
hub_model_idermiaazarkhalili/Gemma4-E2B-Function-Calling-xLAM
max_length2048
load_in_4bitTrue
bnb_4bit_quant_typenf4
bnb_4bit_compute_dtypebfloat16
use_double_quantTrue
attn_implementationsdpa
r16
lora_alpha32
lora_dropout0.05
target_modulesall-linear
biasnone
task_typeCAUSAL_LM
output_dir./gemma4-e2b-function-calling-xlam
num_train_epochs1
per_device_train_batch_size2
per_device_eval_batch_size2
gradient_accumulation_steps4
learning_rate0.0001
lr_scheduler_typecosine
warmup_steps0.05
weight_decay0.01
bf16True
logging_steps10
eval_strategysteps
eval_steps0.05
save_strategysteps
save_steps0.05
save_total_limit2
report_tonone
push_to_hubFalse
seed42
dataset_nameSalesforce/xlam-function-calling-60k
dataset_num_proc4
eval_fraction0.05
eval_max_samples1000
label_check_rows8
smoke_num_samples100
smoke_max_steps5

Results

SettingValue
rows_loaded60000
train_rows56979
eval_rows1000
train_dropped_over_max_length21
eval_dropped_over_max_length0
global_step7123
train_loss0.029327279820365676
train_runtime_s20307.302
evaluations20
last_eval{'eval_loss': 0.01685495674610138, 'eval_runtime': 75.3256, 'eval_samples_per_second': 13.276, 'eval_steps_per_second': 6.638, 'eval_entropy': 0.017483734060122515, 'eval_mean_token_accuracy': 0.995086551785469, 'eval_num_tokens': 23235017.0, 'step': 7123}
trainable_params26333184
lora_layers{'model.language_model': 276}
resumed_fromNone

These are training and held-out loss figures only. No function-calling accuracy benchmark was run.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
Gemma4ForConditionalGeneration
Ревизия весов
f17077c

0 моделей