/ Модель

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

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

Gemma4-E4B-Function-Calling-xLAM

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

Дообученная Gemma 4 E4B Instruct для формирования JSON-вызовов функций по текстовому запросу и описаниям инструментов.

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

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Ограничения

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

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

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

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

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

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

Открыть на Hugging Face

Gemma4-E4B-Function-Calling-xLAM

google/gemma-4-E4B-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-E4B-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-E4B-it
hub_model_idermiaazarkhalili/Gemma4-E4B-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-e4b-function-calling-xlam
num_train_epochs1
per_device_train_batch_size4
per_device_eval_batch_size2
gradient_accumulation_steps2
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.024887873865815674
train_runtime_s17820.447
evaluations20
last_eval{'eval_loss': 0.015246130526065826, 'eval_runtime': 66.1699, 'eval_samples_per_second': 15.113, 'eval_steps_per_second': 7.556, 'eval_entropy': 0.01657911641136161, 'eval_mean_token_accuracy': 0.9956827517747879, 'eval_num_tokens': 23235017.0, 'step': 7123}
trainable_params38879232
lora_layers{'model.language_model': 343}
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
Ревизия весов
09418bb

0 моделей