Files
ModelHub XC 3046e1d40b 初始化项目,由ModelHub XC社区提供模型
Model: twinkle-ai/Llama-3.2-3B-F1-Instruct
Source: Original Platform
2026-06-17 04:50:12 +08:00

15 KiB
Raw Permalink Blame History

license, language, base_model, library_name, tags, datasets, model-index, metrics
license language base_model library_name tags datasets model-index metrics
llama3.2
en
zh
meta-llama/Llama-3.2-3B
transformers
Taiwan
R.O.C
zhtw
SLM
Llama-32
lianghsun/tw-reasoning-instruct
minyichen/tw-instruct-R1-200k
minyichen/tw_mm_R1
name results
Llama-3.2-3B-F1-Instruct
task dataset metrics
type name
question-answering Single Choice Question
type name config split revision
ikala/tmmluplus tmmlu+ all test c0e8ae955997300d5dbf0e382bf0ba5115f85e8c
name type value
single choice accuracy 44.11
task dataset metrics
type name
question-answering Single Choice Question
type name config split revision
cais/mmlu mmlu all test c30699e
name type value
single choice accuracy 50.64
task dataset metrics
type name
question-answering Single Choice Question
type name config split revision
lianghsun/tw-legal-benchmark-v1 tw-legal-benchmark-v1 all test 66c3a5f
name type value
single choice accuracy 35.24
accuracy

Model Card for Llama-3.2-3B-F1-Instruct (a.k.a Formosa-1 or F1)

image/png

Llama-3.2-3B-F1-Instructa.k.a Formosa-1 or F1 是由 Twinkle AIAPMIC 合作開發,並在國家高速網路與計算中心技術指導之下,針對中華民國台灣語境與任務需求所微調之繁體中文語言模型,涵蓋法律、教育、生活應用等多元場景,並以高指令跟隨能力為目標進行強化。

Model Details

Model Description

Model Sources

Evaluation

Results

下表採用 🌟 Twinkle Eval 評測框架

模型 評測模式 TMMLU+(%) 台灣法律(%) MMLU(%) 測試次數 選項排序
mistralai/Mistral-Small-24B-Instruct-2501 box 56.15 (±0.0172) 37.48 (±0.0098) 74.61 (±0.0154) 3 隨機
meta-llama/Llama-3.2-3B-Instruct box 15.49 (±0.0104) 25.68 (±0.0200) 6.90 (±0.0096) 3 隨機
meta-llama/Llama-3.2-3B-Instruct pattern 35.85 (±0.0174) 32.22 (±0.0023) 59.33 (±0.0168) 3 隨機
MediaTek-Research/Llama-Breeze2-3B-Instruct pattern 40.32 (±0.0181) 38.92 (±0.0193) 55.37 (±0.0180) 3 隨機
🌟twinkle-ai/Llama-3.2-3B-F1-Instruct (ours) box 44.11 (±0.0179) 35.24 (±0.0119) 50.64 (±0.0189) 3 隨機

Function Calling Benchmark

我們採用了 BFCL (Berkeley Function Calling Leaderboard) 來評估模型在 Function Calling函式呼叫任務中的表現。

測試使用的指標如下:

  • AST AccuracyAST 正確率)
    比較模型生成的函式呼叫與目標答案在抽象語法樹AST上的結構相似度。涵蓋四種題型
    • 單一函式Simple Function
    • 多函式Multiple Function
    • 平行函式Parallel Function
    • 平行多函式Parallel Multiple Function
Model Overall Accuracy AST Accuracy (S.) AST Accuracy (M.) AST Accuracy (P.) AST Accuracy (P.M.)
meta-llama/Llama-3.2-3B-Instruct 84 92 92 80 74
MediaTek-Research/Llama-Breeze2-3B-Instruct 85 92 92 84 81
meta-llama/Llama-3.1-8B-Instruct 57 56 54 49 35
MediaTek-Research/Llama-Breeze2-8B-Instruct 87 91 93 86 81
GPT-4o-mini(2024-07-18) 87 91 93 90 84
🌟twinkle-ai/Llama-3.2-3B-F1-Instruct (ours) 91 93 95 91 87

Note: 部分數據取自 Breeze 的論文


🔧 Tool Calling

本模型使用 Hermes 格式訓練並支援平行呼叫Parallel calling以下為完整範例流程。 Tool call 模板已經為大家寫好放進 chat-template 了Enjoy it

1 啟動 vLLM 後端

vllm serve twinkle-ai/Llama-3.2-3B-F1-Instruct \
  --port 8001 \
  --enable-auto-tool-choice \
  --tool-call-parser hermes

2 定義工具Functions

def get_weather(location: str, unit: str):
    return f"{location}的氣溫是{unit}26度晴朗無風"

def search(query: str):
    return "川普終於宣布對等關稅政策,針對 18 個經濟體課徵一半的對等關稅,並從 4/5 起對所有進口產品徵收10%的基準關稅!美國將針對被認定為不當貿易行為(不公平貿易) 的國家,於 4/9 起課徵報復型對等關稅 (Discounted Reciprocal Tariff),例如:日本將被課徵 24% 的關稅,歐盟則為 20%,以取代普遍性的 10% 關稅。\n針對中國則開啟新一波 34% 關稅,並疊加於先前已實施的關稅上,這將使中國進口商品的基本關稅稅率達到 54%,而且這尚未包含拜登總統任內或川普第一任期所施加的額外關稅。加拿大與墨西哥則不適用這套對等關稅制度,但川普認為這些國家在芬太尼危機與非法移民問題尚未完全解決,因此計畫對這兩國的大多數進口商品施加 25% 關稅。另外原本針對汽車與多數其他商品的關稅豁免將於 4/2 到期。\n台灣的部分美國擬向台灣課徵32的對等關稅雖然並未針對晶片特別課徵關稅但仍在記者會中提到台灣搶奪所有的電腦與半導體晶片最終促成台積電對美國投資計劃額外加碼 1,000 億美元的歷史性投資歐盟則課徵20的對等關稅。最後是汽車關稅將於 4/2 起對所有外國製造的汽車課徵25% 關稅。"

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get the current weather in a given location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {"type": "string", "description": "國家或城市名, e.g., 'Taipei'、'Jaipei'"},
                    "unit": {"type": "string", "description": "氣溫單位,亞洲城市使用攝氏;歐美城市使用華氏", "enum": ["celsius", "fahrenheit"]}
                },
                "required": ["location", "unit"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "search",
            "description": "這是一個類似 Google 的搜尋引擎,關於知識、天氣、股票、電影、小說、百科等等問題,如果你不確定答案就搜尋一下。",
            "parameters": {
                "type": "object",
                "properties": {
                    "query": {"type": "string", "description": "should be a search query, e.g., '2024 南韓 戒嚴'"}
                },
                "required": ["query"]
            }
        }
    }
]

3 執行工具調用Tool Calls

⚠️ 注意system_prompt 可以不用帶,除非是需要時間基準的工具。

response = client.chat.completions.create(
    model=client.models.list().data[0].id,
    messages=[
        {"role": "system", "content": "記住你的知識截止於 2024/12今天是 2025/4/7"},
        {"role": "user", "content": "台北氣溫如何? 另外,告訴我川普最新關稅政策"},
    ],
    max_tokens=1500,
    temperature=0.6,
    top_p=0.95,
    tools=tools,
    tool_choice="auto",
    extra_body={"skip_special_tokens": False}
)

print(response.choices[0].message.tool_calls)

⚙️ Tool Calls List:

[ChatCompletionMessageToolCall(id='chatcmpl-tool-35e74420119349999913a10133b84bd3', function=Function(arguments='{"location": "Taipei", "unit": "celsius"}', name='get_weather'), type='function'), ChatCompletionMessageToolCall(id='chatcmpl-tool-7ffdcb98e59f4134a6171defe7f2e31b', function=Function(arguments='{"query": "Donald Trump latest tariffs policy"}', name='search'), type='function')]

4 產生最終回答

response = client.chat.completions.create(
    model=client.models.list().data[0].id,
    messages=[
        {"role": "system", "content": "記住你的知識截止於 2024/12今天是 2025/4/7"},
        {"role": "user", "content": "台北氣溫如何? 另外,告訴我川普最新關稅政策"},
        {
            "role": "assistant",
            "content": "",
            "tool_calls": [
                {
                    "id": response.choices[0].message.tool_calls[0].id,
                    "type": "function",
                    "function": {
                        "name": response.choices[0].message.tool_calls[0].function.name,
                        "arguments": response.choices[0].message.tool_calls[0].function.arguments
                    }
                },
                {
                    "id": response.choices[0].message.tool_calls[1].id,
                    "type": "function",
                    "function": {
                        "name": response.choices[0].message.tool_calls[1].function.name,
                        "arguments": response.choices[0].message.tool_calls[1].function.arguments
                    }
                }
            ]
        },
        {
            "role": "tool",
            "content": search(**json.loads(response.choices[0].message.tool_calls[0].function.arguments)),
            "tool_call_id": response.choices[0].message.tool_calls[0].id # tool_call_id 必須要帶,才能正確配對 工具 及 tool_call
        },
        {
            "role": "tool",
            "content": get_weather(**json.loads(response.choices[0].message.tool_calls[1].function.arguments)),
            "tool_call_id": response.choices[0].message.tool_calls[1].id # tool_call_id 必須要帶,才能正確配對 工具 及 tool_call
        }
    ],
    max_tokens=1500,
    temperature=0.6,
    top_p=0.95,
    tools=tools,
    tool_choice="auto",
    extra_body={"skip_special_tokens": False}
)

print(response.choices[0].message.content)

📋 最終輸出內容:

以下是您請求的資訊:

**臺北市氣溫**
- 目前的氣溫為 **26°C**(攝氏)
- 天候狀況:晴朗無風

**川普最新關稅政策概述**
1. **對等關稅政策**  
   - 對 18 個經濟體課徵 50% 的對等關稅  
   - 自 4 月 5 日起,所有進口產品全面徵收 10% 基本關稅  

2. **報復型對等關稅**  
   - 日本 24%、歐盟 20%  

3. **對中國的高額關稅**  
   - 增加至 54%(原有關稅 + 新增 34%  

4. **特殊案例**  
   - 加拿大與墨西哥不適用,但其他商品課徵 25%  
   - 汽車與部分商品的免稅即將到期  

5. **對台灣的影響**  
   - 美國計畫對台灣課徵 32% 關稅,但晶片暫無額外課稅  

6. **全球視角**  
   - 歐盟與日本關稅比例相對較高

Citation

@misc{twinkleai2025llama3.2f1,
  title        = {Llama-3.2-3B-F1-Instruct: A Traditional Chinese Instruction-Tuned Language Model for Taiwan},
  author       = {Huang, Liang Hsun and Chen, Min Yi and Lin, Wen Bin and Chuang, Chao Chun and Sung, Dave},
  year         = {2025},
  howpublished = {\url{https://huggingface.co/twinkle-ai/Llama-3.2-3B-F1-Instruct}},
  note         = {Twinkle AI and APMIC. All authors contributed equally.}
}

Acknowledge

  • 特此感謝國家高速網路與計算中心的指導與 APMIC 的算力支援,才得以讓本專案訓利完成。
  • 特此致謝黃啟聖老師、許武龍(哈爸)、臺北市立第一女子高級中學物理科陳姿燁老師、奈視科技 CTO Howard、AIPLUX Technology、郭家嘉老師以及所有在資料集製作過程中提供寶貴協助的夥伴。

Model Card Authors

Twinkle AI

Model Card Contact

Twinkle AI