LQ-FSE-base: Korean Financial Sentence Extractor
๊ธ์ต ๋ฆฌํฌํธ, ๊ธ์ต ๊ด๋ จ ๋ด์ค์์ ๋ํ๋ฌธ์ฅ์ ์ถ์ถํ๊ณ ์ญํ (outlook, event, financial, risk)์ ๋ถ๋ฅํ๋ ๋ชจ๋ธ์
๋๋ค.
Model Description
- Base Model: klue/roberta-base
- Architecture: Sentence Encoder (RoBERTa) + Inter-sentence Transformer (2 layers) + Dual Classifiers
- Task: Extractive Summarization + Role Classification (Multi-task)
- Language: Korean
- Domain: Financial Reports (์ฆ๊ถ ๋ฆฌํฌํธ), Financial News (๊ธ์ต ๋ด์ค)
Input Constraints
| Parameter |
Value |
Description |
| Max sentence length |
128 tokens |
๋ฌธ์ฅ๋น ์ต๋ ํ ํฐ ์ (์ด๊ณผ ์ truncation) |
| Max sentences per document |
30 |
๋ฌธ์๋น ์ต๋ ๋ฌธ์ฅ ์ (์ด๊ณผ ์ ์ 30๊ฐ๋ง ์ฌ์ฉ) |
| Input format |
Plain text |
๋ฌธ์ฅ ๋ถํธ(.!?) ๊ธฐ์ค์ผ๋ก ์๋ ๋ถ๋ฆฌ |
- ์
๋ ฅ: ํ๊ตญ์ด ๊ธ์ต ํ
์คํธ (์ฆ๊ถ ๋ฆฌํฌํธ, ๊ธ์ต ๋ด์ค ๋ฑ)
- ์ถ๋ ฅ: ๊ฐ ๋ฌธ์ฅ๋ณ ๋ํ๋ฌธ์ฅ ์ ์ (0~1) + ์ญํ ๋ถ๋ฅ (outlook/event/financial/risk)
Performance
| Metric |
Score |
| Extraction F1 |
0.705 |
| Role Accuracy |
0.851 |
Role Labels
| Label |
Description |
outlook |
์ ๋ง/์์ธก ๋ฌธ์ฅ |
event |
์ด๋ฒคํธ/์ฌ๊ฑด ๋ฌธ์ฅ |
financial |
์ฌ๋ฌด/์ค์ ๋ฌธ์ฅ |
risk |
๋ฆฌ์คํฌ ์์ธ ๋ฌธ์ฅ |
Usage
import re
import torch
from transformers import AutoConfig, AutoModel, AutoTokenizer
repo_id = "LangQuant/LQ-FSE-base"
config = AutoConfig.from_pretrained(repo_id, trust_remote_code=True)
model = AutoModel.from_pretrained(repo_id, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model.eval()
text = (
"์ผ์ฑ์ ์์ 2024๋
4๋ถ๊ธฐ ์ค์ ์ด ์์ฅ ์์์ ์ํํ๋ค. "
"๋ฉ๋ชจ๋ฆฌ ๋ฐ๋์ฒด ๊ฐ๊ฒฉ ์์น์ผ๋ก ์์
์ด์ต์ด ์ ๋ถ๊ธฐ ๋๋น 30% ์ฆ๊ฐํ๋ค. "
"HBM3E ์์ฐ์ด ๋ณธ๊ฒฉํ๋๋ฉด์ AI ๋ฐ๋์ฒด ์์ฅ ์ ์ ์จ์ด ํ๋๋ ์ ๋ง์ด๋ค."
)
sentences = [s.strip() for s in re.split(r'(?<=[.!?])\s+', text.strip()) if s.strip()]
max_len, max_sent = config.max_length, config.max_sentences
padded = sentences[:max_sent]
num_real = len(padded)
while len(padded) < max_sent:
padded.append("")
ids_list, mask_list = [], []
for s in padded:
if s:
enc = tokenizer(s, max_length=max_len, padding="max_length", truncation=True, return_tensors="pt")
else:
enc = {"input_ids": torch.zeros(1, max_len, dtype=torch.long),
"attention_mask": torch.zeros(1, max_len, dtype=torch.long)}
ids_list.append(enc["input_ids"])
mask_list.append(enc["attention_mask"])
input_ids = torch.cat(ids_list).unsqueeze(0)
attention_mask = torch.cat(mask_list).unsqueeze(0)
doc_mask = torch.zeros(1, max_sent)
doc_mask[0, :num_real] = 1
with torch.no_grad():
scores, role_logits = model(input_ids, attention_mask, doc_mask)
role_labels = config.role_labels
for i, sent in enumerate(sentences):
score = scores[0, i].item()
role = role_labels[role_logits[0, i].argmax().item()]
marker = "*" if score >= 0.5 else " "
print(f" {marker} [{score:.4f}] [{role:10s}] {sent}")
Input Example
์ผ์ฑ์ ์์ 2024๋
4๋ถ๊ธฐ ์ค์ ์ด ์์ฅ ์์์ ์ํํ๋ค. ๋ฉ๋ชจ๋ฆฌ ๋ฐ๋์ฒด ๊ฐ๊ฒฉ ์์น์ผ๋ก ์์
์ด์ต์ด ์ ๋ถ๊ธฐ ๋๋น 30% ์ฆ๊ฐํ๋ค. HBM3E ์์ฐ์ด ๋ณธ๊ฒฉํ๋๋ฉด์ AI ๋ฐ๋์ฒด ์์ฅ ์ ์ ์จ์ด ํ๋๋ ์ ๋ง์ด๋ค.
Output Example
* [0.8732] [financial ] ์ผ์ฑ์ ์์ 2024๋
4๋ถ๊ธฐ ์ค์ ์ด ์์ฅ ์์์ ์ํํ๋ค.
* [0.7145] [financial ] ๋ฉ๋ชจ๋ฆฌ ๋ฐ๋์ฒด ๊ฐ๊ฒฉ ์์น์ผ๋ก ์์
์ด์ต์ด ์ ๋ถ๊ธฐ ๋๋น 30% ์ฆ๊ฐํ๋ค.
* [0.9021] [outlook ] HBM3E ์์ฐ์ด ๋ณธ๊ฒฉํ๋๋ฉด์ AI ๋ฐ๋์ฒด ์์ฅ ์ ์ ์จ์ด ํ๋๋ ์ ๋ง์ด๋ค.
* ํ์: ๋ํ๋ฌธ์ฅ์ผ๋ก ์ ์ ๋จ (score โฅ 0.5)
[score]: ๋ํ๋ฌธ์ฅ ํ๋ฅ (0~1, ๋์์๋ก ํต์ฌ ๋ฌธ์ฅ)
[role]: ๋ฌธ์ฅ ์ญํ ๋ถ๋ฅ (outlook / event / financial / risk)
Disclaimer (๋ฉด์ฑ
์กฐํญ)
- ๋ณธ ๋ชจ๋ธ์ ์ฐ๊ตฌ ๋ฐ ์ ๋ณด ์ ๊ณต ๋ชฉ์ ์ผ๋ก๋ง ์ ๊ณต๋ฉ๋๋ค.
- ๋ณธ ๋ชจ๋ธ์ ์ถ๋ ฅ์ ํฌ์ ์กฐ์ธ, ๊ธ์ต ์๋ฌธ, ๋งค๋งค ์ถ์ฒ์ด ์๋๋๋ค.
- ๋ชจ๋ธ์ ์์ธก ๊ฒฐ๊ณผ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ ํฌ์ ํ๋จ์ ๋ํด LangQuant ๋ฐ ๊ฐ๋ฐ์๋ ์ด๋ ํ ๋ฒ์ ์ฑ
์๋ ์ง์ง ์์ต๋๋ค.
- ๋ชจ๋ธ์ ์ ํ์ฑ, ์์ ์ฑ, ์ ์์ฑ์ ๋ํด ๋ณด์ฆํ์ง ์์ผ๋ฉฐ, ์ค์ ํฌ์ ์์ฌ๊ฒฐ์ ์ ๋ฐ๋์ ์ ๋ฌธ๊ฐ์ ์กฐ์ธ์ ๊ตฌํ์๊ธฐ ๋ฐ๋๋๋ค.
- ๊ธ์ต ์์ฅ์ ๋ณธ์ง์ ์ผ๋ก ๋ถํ์คํ๋ฉฐ, ๊ณผ๊ฑฐ ๋ฐ์ดํฐ๋ก ํ์ต๋ ๋ชจ๋ธ์ด ๋ฏธ๋ ์ฑ๊ณผ๋ฅผ ๋ณด์ฅํ์ง ์์ต๋๋ค.
Usage Restrictions (์ฌ์ฉ ์ ํ)
- ๊ธ์ง ์ฌํญ:
- ๋ณธ ๋ชจ๋ธ์ ์ด์ฉํ ์์ธ ์กฐ์ข
, ํ์ ์ ๋ณด ์์ฑ ๋ฑ ๋ถ๋ฒ์ ๋ชฉ์ ์ ์ฌ์ฉ
- ์๋ํ๋ ํฌ์ ๋งค๋งค ์์คํ
์ ๋จ๋
์์ฌ๊ฒฐ์ ์๋จ์ผ๋ก ์ฌ์ฉ
- ๋ชจ๋ธ ์ถ๋ ฅ์ ์ ๋ฌธ ๊ธ์ต ์๋ฌธ์ธ ๊ฒ์ฒ๋ผ ์ 3์์๊ฒ ์ ๊ณตํ๋ ํ์
- ํ์ฉ ์ฌํญ:
- ํ์ ์ฐ๊ตฌ ๋ฐ ๊ต์ก ๋ชฉ์ ์ ์ฌ์ฉ
- ๊ธ์ต ํ
์คํธ ๋ถ์ ํ์ดํ๋ผ์ธ์ ๋ณด์กฐ ๋๊ตฌ๋ก ํ์ฉ
- ์ฌ๋ด ๋ฆฌ์์น/๋ถ์ ์
๋ฌด์ ์ฐธ๊ณ ์๋ฃ๋ก ํ์ฉ
- ์์
์ ์ฌ์ฉ ์ LangQuant์ ์ฌ์ ๋ฌธ์๋ฅผ ๊ถ์ฅํฉ๋๋ค.
Contributors