qwen3.5-2b-sst2-lora

LoRA adapter for Qwen/Qwen3.5-2B-Base, fine-tuned on stanfordnlp/sst2 for binary sentiment classification.

The adapter predicts positive or negative.

Model Details

Property Value
Base model Qwen/Qwen3.5-2B-Base
Method LoRA
Dataset stanfordnlp/sst2
Task Sentiment classification
Labels negative, positive
LoRA rank 16
LoRA alpha 32
LoRA dropout 0.05
Target modules all-linear
Adapter size 64.21 MiB

Evaluation

Evaluation scope: full SST-2 validation split.

Metric Base model LoRA
Generation accuracy 3.10% 94.84%
Forced-choice accuracy 51.49% 94.95%
Generation Macro F1 0.0573 0.9484
Forced-choice Macro F1 0.3502 0.9495
Perplexity — 1.0801

Usage

import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

BASE_MODEL_ID = "Qwen/Qwen3.5-2B-Base"
ADAPTER_ID = "artyomboyko/qwen3.5-2b-sst2-lora"

tokenizer = AutoTokenizer.from_pretrained(
    BASE_MODEL_ID
)

base_model = AutoModelForCausalLM.from_pretrained(
    BASE_MODEL_ID,
    dtype="auto",
)

model = PeftModel.from_pretrained(
    base_model,
    ADAPTER_ID,
)

device = torch.device(
    "cuda"
    if torch.cuda.is_available()
    else "cpu"
)

model = model.to(device)
model.eval()

review = "a wonderfully acted and moving story"

prompt = (
    "Classify the sentiment of this movie review as positive or negative.\n"
    f"Review: {review}\n"
    "Sentiment:"
)

inputs = tokenizer(
    prompt,
    return_tensors="pt",
).to(device)

with torch.inference_mode():
    outputs = model.generate(
        **inputs,
        max_new_tokens=4,
        do_sample=False,
        pad_token_id=tokenizer.eos_token_id,
    )

generated = outputs[
    :,
    inputs["input_ids"].shape[1]:,
]

prediction = tokenizer.decode(
    generated[0],
    skip_special_tokens=True,
).strip()

print(prediction)

Limitations

  • Designed for English SST-2 sentiment classification.
  • Requires the documented prompt format and the base model Qwen/Qwen3.5-2B-Base.
Downloads last month
6
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for artyomboyko/qwen3.5-2b-sst2-lora

Adapter
(17)
this model

Dataset used to train artyomboyko/qwen3.5-2b-sst2-lora