/ Модель

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

Контекст
128 000 токенов
Параметры
1,5 млрд
Лицензия
Своя лицензия
Архитектура
lfm2 · dense
Базовая модель
LFM2.5-1.2B-Instruct
Библиотека
transformers
Опубликована
12 окт 2026

SweMedMCQ-LFM2.5-1.2B-Trace-SV-RW

Генерация текстаТекст → текст3 профессии
35скачиваний за 30 дней1лайквеса обновлены12 окт 2026

Описание модели

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

Дообученная модель LFM2 для ответов на медицинские вопросы с вариантами выбора на английском и шведском языках.

SweMedMCQ-LFM2.5-1.2B-Trace-SV-RW — языковая модель для ответов на медицинские вопросы с выбором одного варианта, разработанная на базе LiquidAI/LFM2.5-1.2B-Instruct как одна из 14 моделей для исследования и бенчмарка SweMedMCQ. Это плотная модель семейства LFM2 с 1,5 млрд параметров, обученная полным дообучением на примерах с цепочками рассуждений, переписанными на шведском языке. Она принимает текст вопроса и вариантов ответа, а генерирует объяснение и индекс выбранного ответа; поддерживает английский и шведский языки. Базовая модель имеет контекст до 128 000 токенов.

Модель предназначена для решения экзаменационных медицинских вопросов с вариантами ответа на английском и шведском языках. В SweMedMCQ на 9 733 тестовых вопросах точность составила 44,0% на английском и 44,3% на шведском при генерации с рассуждением; при прямом ответе — 43,8% и 43,9% соответственно. Это исследовательская модель с результатами значительно ниже крупных моделей: её объяснения могут быть ошибочны даже при верном ответе. Обучающие и тестовые шведские тексты переведены машинным способом с английского. Модель не является медицинским устройством и не предназначена для диагностики, лечения или клинических решений. Лицензия указана как other.

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

  • ответы на экзаменационные медицинские вопросы с вариантами выбора
  • выбор правильного варианта в англоязычном медицинском тесте
  • выбор правильного варианта в шведском медицинском тесте
  • генерация объяснения к ответу на медицинский вопрос

Ограничения

Модель обучена и оценивалась только на экзаменационных вопросах с вариантами ответа; её точность существенно ниже, чем у крупных моделей, а объяснения могут быть ошибочными даже при правильном ответе. Она не предназначена для диагностики, лечения или клинических решений; шведские тексты машинно переведены с английского и могут содержать ошибки.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus

Бенчмарки пользователейпока нет

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

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

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

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

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

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

    Модели ответят на каждую задачу, судья оценит ответы по шкале 0–100.

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

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

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

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

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

Открыть на Hugging Face

SweMedMCQ-LFM2.5-1.2B-Trace-SV-RW

LFM2.5-1.2B fine-tuned for English and Swedish medical multiple-choice questions, trained on reasoning-trace data in Swedish (rewritten reasoning). It is one of the 14 student models released with the paper "Benchmarking and Adapting LLMs for English–Swedish Medical Question Answering" and the SweMedMCQ benchmark (code and data in the repository linked from the paper).

Training

  • Base model: LiquidAI/LFM2.5-1.2B-Instruct.
  • Data: 549,124 Swedish examples whose reasoning was rewritten into Swedish, from the training splits of the ten MedicalAgentsBench datasets. The Swedish training questions were translated from English with GPT-OSS-120B. No test item was used for training or model selection.
  • Supervision: Reasoning-trace supervision: responses of two open teacher models to the training questions, kept only when the answer is correct and the explanation is not empty (length outliers removed). GPT-OSS-120B answered each question three times (greedy and twice at temperature 0.7) and its reasoning is kept as a <think>…</think> block before the JSON answer; Qwen3.6-35B-A3B answered twice (greedy and at temperature 0.7) and only its explanation and answer are kept. A question can therefore have up to five training examples. In this Swedish set, GPT-OSS-120B rewrote each reasoning block into Swedish, keeping every medical step and adding no new facts (in the plain Swedish set the reasoning stays in English, as the teacher wrote it).
  • Training language: Swedish, reasoning rewritten into Swedish.
  • Settings: full fine-tuning (embeddings trained), two epochs, effective batch 128 (32 per GPU on 4 GPUs), learning rate 5e-5 with cosine schedule and 5% warm-up, weight decay 0.01, gradient clipping 1.0, bfloat16, padding-free packing, sequences up to the full model context, loss on the response tokens, seed 13.
  • Checkpoint: best validation loss, step 8,400 of 8,580, validation loss 0.4448 (evaluated every 200 steps).

Prompt format

{question} is the question text and {options} the options, one per paragraph, as A) …, B) … (letters in order, separated by a blank line). The prompt is sent as a single user message, with no system prompt. The model answers with {"explanation": "...", "answer_index": "<letter>"}, after a <think>…</think> reasoning block.

You are a highly knowledgeable and careful medical expert.

Your task is to analyze the following multiple-choice medical question and determine the single best answer based on established medical knowledge and reasoning.

Follow these steps carefully:
1. Read the question and all available answer options.
2. Identify key clinical findings, pathophysiology, or reasoning relevant to the question.
3. Select the single best answer from the listed options.
4. Provide a concise, evidence-based explanation for your choice.

---

Return your final output **only** in valid JSON format that matches this schema:

{
  "explanation": "A brief medical reasoning explaining why this option is correct and others are not.",
  "answer_index": "The letter corresponding to the correct answer option (e.g., 'A', 'B', 'C', etc.)."
}

---

## Input

**Question:**
{question}

**Options:**

{options}

---
Du är en mycket kunnig och noggrann medicinsk expert.

Din uppgift är att analysera följande flervalsfråga och avgöra vilket alternativ som är det enda bästa svaret baserat på etablerad medicinsk kunskap och resonemang.

Följ dessa steg noggrant:
1. Läs frågan och alla tillgängliga svarsalternativ.
2. Identifiera viktiga kliniska fynd, patofysiologi eller relevant medicinskt resonemang.
3. Välj det enda bästa svaret bland de angivna alternativen.
4. Ge en kortfattad, evidensbaserad förklaring till ditt val.

---

Returnera ditt slutliga svar **endast** i giltigt JSON-format som följer detta schema:

{
  "explanation": "En kort medicinsk motivering som förklarar varför detta alternativ är korrekt och varför de andra inte är det.",
  "answer_index": "Bokstaven som motsvarar det korrekta svarsalternativet (t.ex. 'A', 'B', 'C' osv.)."
}

---

## Indata

**Fråga:**
{question}

**Alternativ:**

{options}

---

The chat template in this folder is the one used at evaluation. It opens the reasoning block after the assistant turn (<think>\n); with enable_thinking=False it writes an empty block (<think>\n\n</think>\n\n) for a direct answer.

Tokenizer. tokenizer.json is the base model's. chat_template.jinja and tokenizer_config.json are the ones this model was evaluated with: the LFM2.5 template with an enable_thinking switch that opens the <think> block. The folder therefore reproduces the evaluation prompts without extra files.

Usage with vLLM

Greedy decoding, as in the evaluation. The two prompts above are in prompts.json in this repository (sv and en); fill them with str.format. Swedish options are listed in label order; English options in their original order.

import json
import re

from huggingface_hub import hf_hub_download
from vllm import LLM, SamplingParams
from vllm.sampling_params import StructuredOutputsParams


def answer_letter(text):
    """Answer letter in the JSON after the reasoning, or None if the model wrote none."""
    match = re.search(r'"answer_index"\s*:\s*"\s*([A-Z])', text.split("</think>")[-1])
    return match.group(1) if match else None


MODEL = "Anonymiserad/SweMedMCQ-LFM2.5-1.2B-Trace-SV-RW"
PROMPTS = json.load(open(hf_hub_download(MODEL, "prompts.json"), encoding="utf-8"))
llm = LLM(MODEL, max_model_len=12288)
tok = llm.get_tokenizer()

question = "Vilket band av elektromagnetiska vågor används i en termografikamera?"
options = {"A": "röntgenstrålning", "B": "mikrovågor", "C": "ultraviolett strålning", "D": "infraröd strålning"}
opts = "\n\n".join(f"{k}) {v}" for k, v in sorted(options.items()))
user = PROMPTS["sv"].format(question=question, options=opts)
messages = [{"role": "user", "content": user}]
# reasoning: template opens "<think>\n"
prompt = tok.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
# direct answer: empty thinking block, then JSON
direct = tok.apply_chat_template(messages, add_generation_prompt=True, tokenize=False,
                                 enable_thinking=False)

schema = {"type": "object", "properties": {"explanation": {"type": "string"}, "answer_index": {"type": "string"}}, "required": ["explanation", "answer_index"], "additionalProperties": False}
# Reasoning: greedy decoding; the JSON answer follows "</think>".
text = llm.generate([prompt], SamplingParams(temperature=0.0, max_tokens=10240))[0].outputs[0].text
print(answer_letter(text))

# Direct answer: JSON-schema decoding right after the empty thinking block.
params = SamplingParams(temperature=0.0, max_tokens=10240,
                        structured_outputs=StructuredOutputsParams(json=schema))
print(json.loads(llm.generate([direct], params)[0].outputs[0].text)["answer_index"])

del llm  # shut the engine down, so the script exits

In the paper's evaluation the JSON after </think> was also produced with schema-constrained decoding (a reasoning parser that switches the constraint on once the block is closed; see the evaluation code in the repository). With unconstrained decoding as above, the model sometimes writes no valid answer (answer_letter returns None); the paper counts such answers as wrong.

Serving with vLLM

Start an OpenAI-compatible server:

vllm serve Anonymiserad/SweMedMCQ-LFM2.5-1.2B-Trace-SV-RW --max-model-len 12288

and send the same prompt (here messages as in the example above). The server rejects requests whose prompt + max_tokens exceed the context, so ask for at most 10,240 new tokens:

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
# The chat template opens the reasoning block; the answer JSON follows "</think>".
r = client.chat.completions.create(model=MODEL, messages=messages, temperature=0.0, max_tokens=10240)
print(answer_letter(r.choices[0].message.content))

Results

Accuracy (%) on the 9,733 core items of the SweMedMCQ test set (English source and Swedish benchmark text, greedy decoding):

DecodingEnglishSwedishGap (EN − SV)
reasoning44.044.3-0.3
direct answer43.843.9-0.1

The base LFM2.5-1.2B reaches 37.2% in English and 23.5% in Swedish with the same prompt.

Limitations

  • Research model. It is not a medical device and must not be used for diagnosis, treatment, or any clinical decision.
  • Trained and evaluated on exam-style multiple-choice questions only; accuracy is far below that of large models, and explanations can be wrong even when the answer is right.
  • Swedish training and test text is machine-translated from English and may contain translation errors.

Licence

LFM Open License v1.0, inherited from the base model (see LICENSE). This model is a fine-tuned derivative of LFM2.5-1.2B-Instruct; all weight files were changed by fine-tuning.

Citation

@misc{anonymous2026swemedmcq,
  title  = {Benchmarking and Adapting {LLMs} for {English}--{Swedish} Medical Question Answering},
  author = {Anonymous},
  year   = {2026},
  note   = {Under review}
}

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
Lfm2ForCausalLM
Ревизия весов
114b38c

0 моделей