TableScope Structure Extractor 8B

Korean table structure extraction LoRA adapter for Qwen3-VL-8B, trained on 15k synthetic Korean tables with row-strip chunking.

ν•œκ΅­μ–΄ ν…Œμ΄λΈ” μ΄λ―Έμ§€μ—μ„œ **ν…Œμ΄λΈ” ꡬ쑰(TableSchema JSON)**λ₯Ό μžλ™ μΆ”μΆœν•˜λŠ” QLoRA νŒŒμΈνŠœλ‹ μ–΄λŒ‘ν„°μž…λ‹ˆλ‹€.

✨ μ£Όμš” νŠΉμ§•

  • Qwen3-VL-8B 기반 QLoRA (4-bit NF4, r=64, alpha=128)
  • ν•œκ΅­μ–΄ ν…Œμ΄λΈ” νŠΉν™”: 15,000건 ν•œκ΅­μ–΄ ν•©μ„± ν…Œμ΄λΈ” λ°μ΄ν„°λ‘œ ν•™μŠ΅
  • Row-strip Chunking: 4096 토큰 초과 λŒ€ν˜• ν…Œμ΄λΈ”μ„ ν–‰ λ‹¨μœ„ λΆ„ν•  처리
  • Anti-Forgetting 2-Stage ν•™μŠ΅: κΈ°μ‘΄ μ„±λŠ₯ μœ μ§€ν•˜λ©΄μ„œ λŒ€ν˜• ν…Œμ΄λΈ” 처리 λŠ₯λ ₯ μŠ΅λ“

πŸ“Š μ„±λŠ₯

Chunked μΆ”λ‘  λͺ¨λ“œ (1,500건 전체 ν…ŒμŠ€νŠΈμ…‹)

λ³΅μž‘λ„ μˆ˜λŸ‰ TEDS TEDS-S CellAcc ValidRate
Simple 492 0.561 0.832 0.399 93.5%
Medium 505 0.620 0.830 0.437 89.7%
Complex 301 0.370 0.512 0.201 62.8%
Extreme 202 0.108 0.147 0.079 36.6%
전체 1500 0.481 0.675 0.329 78.4%

Standard vs Chunked 비ꡐ

λ³΅μž‘λ„ Standard Chunked κ°œμ„ 
Simple 0.561 0.561 Β±0
Medium 0.611 0.620 +1.4%
Complex 0.282 0.370 +31%
Extreme 0.048 0.108 +125%
전체 0.453 0.481 +6.2%

πŸš€ μ‚¬μš©λ²•

μ„€μΉ˜

pip install transformers peft bitsandbytes qwen-vl-utils

μΆ”λ‘ 

from peft import PeftModel
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info

# 이 λ¦¬ν¬λŠ” LoRA μ–΄λŒ‘ν„°(weight)만 ν¬ν•¨ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.
# base_model(Qwen/Qwen3-VL-8B-Instruct)은 μ•„λž˜ μ½”λ“œμ—μ„œ μžλ™μœΌλ‘œ λ‹€μš΄λ‘œλ“œλ©λ‹ˆλ‹€.

# 베이슀 λͺ¨λΈ λ‘œλ“œ (4-bit μ–‘μžν™”)
from transformers import BitsAndBytesConfig
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype="bfloat16",
)

model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
    "Qwen/Qwen3-VL-8B-Instruct",
    quantization_config=bnb_config,
    device_map="auto",
)

# LoRA μ–΄λŒ‘ν„° λ‘œλ“œ
model = PeftModel.from_pretrained(model, "cywellai/tablescope-structure-extractor-8b")
processor = AutoProcessor.from_pretrained("cywellai/tablescope-structure-extractor-8b")

# μΆ”λ‘ 
messages = [
    {"role": "system", "content": "당신은 ν…Œμ΄λΈ” μ΄λ―Έμ§€μ—μ„œ ꡬ쑰λ₯Ό μΆ”μΆœν•˜λŠ” μ „λ¬Έκ°€μž…λ‹ˆλ‹€. μ£Όμ–΄μ§„ ν…Œμ΄λΈ” 이미지λ₯Ό λΆ„μ„ν•˜μ—¬ TableSchema JSON을 μƒμ„±ν•˜μ„Έμš”."},
    {"role": "user", "content": [
        {"type": "image", "image": "path/to/table.png"},
        {"type": "text", "text": "이 ν…Œμ΄λΈ” μ΄λ―Έμ§€μ˜ ꡬ쑰λ₯Ό JSON으둜 μΆ”μΆœν•˜μ„Έμš”."},
    ]},
]

text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(text=[text], images=image_inputs, videos=video_inputs, return_tensors="pt").to(model.device)

output_ids = model.generate(**inputs, max_new_tokens=4096)
output = processor.batch_decode(output_ids[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0]
print(output)  # TableSchema JSON

πŸ—οΈ 좜λ ₯ ν˜•μ‹ (TableSchema JSON)

{
  "col_headers": [
    {"labels": ["이름", "λ‚˜μ΄", "직급"], "spans": {}}
  ],
  "row_headers": [],
  "data": [
    [{"value": "κΉ€μ² μˆ˜"}, {"value": "35"}, {"value": "λŒ€λ¦¬"}],
    [{"value": "이영희"}, {"value": "42"}, {"value": "κ³Όμž₯"}]
  ],
  "merged_regions": []
}

πŸ”§ ν•™μŠ΅ 상세

Anti-Forgetting 2-Stage ν•™μŠ΅

ν•­λͺ© Stage 1 Stage 2
데이터 full 12,000건 full 70% + chunked 30% (17,142건)
μ‹œμž‘ v0.0.1 adapter μ΄μ–΄ν•™μŠ΅ Stage 1 best adapter
LR 5e-6 3e-6
Epochs 1 2
Best eval_loss 1.0154 1.0070

QLoRA μ„€μ •

ν•­λͺ© κ°’
Quantization NF4 4-bit
LoRA rank 64
LoRA alpha 128
LoRA dropout 0.05
Trainable params 174M / 8.9B (1.95%)

ν•™μŠ΅ 인프라

  • GPU: NVIDIA H200 (143GB VRAM)
  • Framework: transformers + peft + trl (SFTTrainer)
  • 총 ν•™μŠ΅ μ‹œκ°„: Stage 1 (1h 43m) + Stage 2 (5h 13m) = ~7μ‹œκ°„

πŸ“¦ κ΄€λ ¨ λ¦¬μ†ŒμŠ€

  • 베이슀 λͺ¨λΈ: Qwen/Qwen3-VL-8B-Instruct
  • ν”„λ‘œμ νŠΈ: TableScope β€” Korean Table Vision Agent

⚠️ μ œν•œ 사항

  • ν•œκ΅­μ–΄ ν•©μ„± ν…Œμ΄λΈ” λ°μ΄ν„°λ‘œλ§Œ ν•™μŠ΅ β†’ 싀사진/μŠ€μΊ” ν…Œμ΄λΈ”μ€ μ„±λŠ₯ μ €ν•˜ κ°€λŠ₯
  • Complex/Extreme λ³΅μž‘λ„μ—μ„œλŠ” 아직 κ°œμ„  μ—¬μ§€ 있음
  • Row-strip Chunking은 ν–‰ 기반 λΆ„ν• μ΄λ―€λ‘œ 열이 맀우 λ§Žμ€ 경우 ν•œκ³„
Downloads last month
1
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for cywellai/tablescope-structure-extractor-8b

Adapter
(91)
this model

Evaluation results