Qwen3-8B-Korean-Sentiment

Overview

This repository contains a fine-tuned model for Korean Sentiment Analysis (ํ•œ๊ตญ์–ด ๊ฐ์ • ๋ถ„์„) using a Large Language Model (LLM), specifically designed for YouTube comments in Korean. The model classifies sentiments into Positive(๊ธ์ •), Negative(๋ถ€์ •), and Neutral(์ค‘๋ฆฝ) categories, and is fine-tuned to detect not only direct emotions but also subtle features like irony (๋ฐ˜์–ด๋ฒ•) and sarcasm (ํ’์ž) common in Korean-language content.

Sentiment Classification:

  • Positive (๊ธ์ •)
  • Negative (๋ถ€์ •)
  • Neutral (์ค‘๋ฆฝ)

Quickstart

To quickly get started with the fine-tuned model, use the following Python code:

from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
import torch

# Load the model and tokenizer
model = AutoPeftModelForCausalLM.from_pretrained(
    "LLM-SocialMedia/Qwen3-8B-Korean-Sentiment",
    # if GPU memory is insufficient
    device_map="auto",
    offload_folder="/offload", 
    offload_state_dict=True,
    torch_dtype=torch.bfloat16
)
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B")

model.eval()

# Sample comment
comment = "์ด๊ฑฐ ๋„ˆ๋ฌด ์ข‹์•„์š”!"

# Format the prompt
messages = [
    {
        "role": "user",
        "content": (
            "์•„๋ž˜๋Š” ํ•œ๊ตญ์–ด ์œ ํŠœ๋ธŒ ๋Œ“๊ธ€์˜ ๊ฐ์ • ๋ถ„๋ฅ˜ ์ž‘์—…์ž…๋‹ˆ๋‹ค.\n\n"
            f"๋Œ“๊ธ€: {comment}\n\n"
            "๋‹ค์Œ ๋‹จ๊ณ„๋ณ„๋กœ ๊ผผ๊ผผํžˆ ์ƒ๊ฐํ•˜๊ณ  ๋ถ„์„ํ•ด ์ฃผ์„ธ์š”:\n"
            "step_0. ๋Œ“๊ธ€์—์„œ ์‚ฌ์šฉ๋œ ์ฃผ์š” ๋‹จ์–ด์™€ ํ‘œํ˜„์˜ ๊ฐ์ •์  ์˜๋ฏธ ๋ถ„์„ (์˜ˆ: ๊ธ์ •์ , ๋ถ€์ •์ , ์ค‘๋ฆฝ์ , ํ˜น์€ ์• ๋งคํ•˜๊ฑฐ๋‚˜ ์€์–ด/๋ฐ˜์–ด์ )\n"
            "step_1. ์ด๋ชจํ‹ฐ์ฝ˜, ์ด๋ชจ์ง€, ๋ฐˆ, ์ธํ„ฐ๋„ท ์€์–ด์˜ ์ˆจ๊ฒจ์ง„ ์˜๋ฏธ ๋ถ„์„\n"
            "step_2. ๋Œ“๊ธ€์˜ ๋งฅ๋ฝ๊ณผ ์˜๋„ ๋ถ„์„ (์˜ˆ: ์ง„์‹ฌ, ํ’์ž, ๋†๋‹ด, ๋น„๊ผผ)\n"
            "step_3. ๋Œ“๊ธ€์„ ๊ฐ์ •์„ ๋ถ„๋ฅ˜ ํ•˜์„ธ์š”\n"
            "step_4. ์ตœ์ข… ๊ฐ์ • ๋ถ„๋ฅ˜: '๊ธ์ •', '์ค‘๋ฆฝ', '๋ถ€์ •' ์ค‘ ํ•˜๋‚˜\n\n"
            "๋งˆ์ง€๋ง‰์œผ๋กœ ์•„๋ž˜ ๋‘ ๊ฐ€์ง€๋ฅผ ๋ช…ํ™•ํžˆ ์ž‘์„ฑํ•˜์„ธ์š”:\n"
            "1. ๋ถ„๋ฅ˜ ๊ทผ๊ฑฐ: ๊ฐ ๋‹จ๊ณ„ ๋ถ„์„์„ ์ข…ํ•ฉํ•œ ๊ฐ์ • ๋ถ„๋ฅ˜ ์ด์œ \n"
            "2. ๊ฐ์ • ๋ถ„๋ฅ˜ ๊ฒฐ๊ณผ: '๊ธ์ •', '์ค‘๋ฆฝ', '๋ถ€์ •' ์ค‘ ํ•˜๋‚˜๋กœ ์ถœ๋ ฅ\n\n"
            "์ถœ๋ ฅ ์˜ˆ์‹œ:\n"
            "๋ถ„๋ฅ˜ ๊ทผ๊ฑฐ: ์ด ๋Œ“๊ธ€์€ ๋†๋‹ด๊ณผ ๋น„๊ผผ์„ ์„ž์—ˆ์ง€๋งŒ ์ตœ์ข…์ ์œผ๋กœ ์œ ํŠœ๋ฒ„๋ฅผ ๊ธ์ •์ ์œผ๋กœ ํ‰๊ฐ€ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.\n"
            "๊ฐ์ • ๋ถ„๋ฅ˜ ๊ฒฐ๊ณผ: ๊ธ์ •"
        )
    }
]

prompt = tokenizer.apply_chat_template(
        messages,
        tokenize=False,
        add_generation_prompt=True
    )

# Tokenize the input
inputs = tokenizer(prompt, return_tensors="pt")

# Generate prediction
outputs = model.generate(input_ids=inputs["input_ids"].to("cuda"), max_new_tokens=512)

# Decode and print the output
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])

Train/Test Details

  • Training Dataset: Fine-tuned on 3,857 labeled YouTube comments for sentiment classification.
  • Testing Dataset: Evaluated on 1,130 labeled YouTube comments to assess the model's performance.

Results

The fine-tuned model's performance on the sentiment classification task is summarized below:

Metric Positive (๊ธ์ •) Neutral (์ค‘๋ฆฝ) Negative (๋ถ€์ •)
Precision 0.8981 0.3787 0.4971
Recall 0.7362 0.2880 0.7413
F1-Score 0.8092 0.3272 0.5951
Support 527 309 344

Accuracy: 62.03% (Based on 1180 samples)

You can find detailed results here.

Contact

For any inquiries or feedback, feel free to contact the team:

Team:

  • Hanjun Jung
  • Jinsoo Kim
  • Junhyeok Choi
  • Suil Lee
  • Seongjae Kang
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support