Starlight LQ-FSE Base

LangQuant/LQ-FSE-base의 가중치와 native role 출력을 유지하면서, 모든 처리 문장을 프로젝트 ontology인 EVENT / STATEMENT / DROP으로 투영하는 단일 추론 Pipeline입니다.

이 저장소는 새로운 학습 결과가 아닙니다. KLUE-RoBERTa, Inter-sentence Transformer, Extraction Head, Role Head와 가중치는 원본 그대로이며 다음 기능만 추가합니다.

  • 원문 offset을 보존하는 문장 분리
  • 모든 처리 문장의 score, role logits/probabilities 보존
  • selected=false 문장도 Candidate로 유지
  • matrix predicate 우선 Sentence Projection
  • one-pass token/sentence/document runtime context
  • Stage 04~07 Construction front-end rule/decoder baseline
  • Stage 08~09 Event/Statement candidate construction rule baseline
  • Stage 10~11 Article-local Entity Resolution/Argument Linking rule baseline
  • Stage 12~13 Article-local Event Resolution/Relation Extraction rule baseline
  • Stage 14 identity/reference/coverage validation 및 tensor-free materialization
  • JSON 직렬화 가능한 고정 출력 계약

설치

Python 3.10 이상을 권장합니다.

python -m pip install -r requirements.txt

단일 추론 API

로컬 clone에서 실행:

from transformers import pipeline

extractor = pipeline(
    "starlight-lq-fse",
    model=".",
    trust_remote_code=True,
    device=-1,
)

result = extractor(
    "매출이 전년 대비 30% 증가했다. "
    "회사는 내년에 설비 투자를 확대할 계획이다."
)

for sentence in result["sentences"]:
    print(
        sentence["projected_label"],
        sentence["native_role"],
        sentence["extraction_score"],
        sentence["text"],
    )

Hugging Face Hub에 파일을 push한 뒤에는 model만 변경합니다.

extractor = pipeline(
    "starlight-lq-fse",
    model="sysy9292/starlight-lq-fse-base",
    trust_remote_code=True,
)

CUDA는 device=0, Apple Silicon은 device="mps"로 지정할 수 있습니다. 운영 환경에서는 검증한 repository revision을 고정해서 사용하세요.

Runtime Construction API

기본 extractor(text) JSON은 그대로 유지됩니다. Tensor와 SpanRef가 필요한 후속 Construction은 명시적인 runtime 경로를 사용합니다.

run = extractor.run_with_context(
    "회사는 내일 설비 투자를 확대할 계획이다."
)
frontend = extractor.construct_frontend(run.context)
candidates = extractor.construct_candidates(run.context, frontend)
entity_arguments = extractor.construct_entity_arguments(run.context, candidates)
event_relations = extractor.construct_event_relations(run.context, entity_arguments)
validation = extractor.construct_result(run.context, event_relations)

print(frontend.time_expressions)
print(frontend.logical_spans)
print(frontend.span_projections)
print(candidates.event_candidates)
print(candidates.statement_candidates)
print(candidates.issues)
print(entity_arguments.entity_resolution)
print(entity_arguments.argument_linking)
print(event_relations.event_resolution)
print(event_relations.relation_extraction)
print(validation.status)
print(validation.result)

construct_frontend()DROP이 아닌 sentence만 처리하며 selected는 gate로 사용하지 않습니다. Entity는 학습된 EntityMentionPredictor를 주입한 경우에만 실행됩니다. predictor가 없으면 entity_mentions=None이며, 무작위 초기화 head를 자동으로 사용하지 않습니다.

construct_candidates()는 검증된 front-end identity를 재사용해 EVENT trigger와 Entity/Time 후보 pool, STATEMENT type과 assertor mention 후보를 만듭니다. Trigger나 type을 규칙으로 결정할 수 없으면 불완전 Candidate를 만들지 않고 runtime issues에 남깁니다. 이 API도 Tensor를 외부 JSON에 추가하지 않으며 기본 extractor(text) 계약은 변경하지 않습니다.

construct_entity_arguments()는 Stage 10의 Article-local Entity cluster와 Stage 11의 ACTOR / TARGET / LOCATION / TIME link를 만듭니다. Entity head가 제공되지 않아 entity_mentions=None이면 두 component를 부분 실행하지 않고 ENTITY_MENTIONS_UNAVAILABLE reason으로 함께 skip합니다. predictor가 실행되어 빈 tuple을 반환한 경우에는 정상적인 빈 Resolution으로 구분합니다.

construct_event_relations()는 Stage 11 link를 읽어 같은 현실 Event를 보수적으로 MERGE/KEEP한 뒤, resolved Event 기준 CAUSES / RESPONDS_TO와 Statement 기준 ABOUT 후보를 만듭니다. 명시적 connective/reference evidence가 없는 단순 순서나 공기만으로 relation을 만들지 않습니다. Stage 11이 미실행이면 EVENT_ARGUMENTS_UNAVAILABLE reason으로 Stage 12~13도 함께 skip합니다.

construct_result()는 Article/version/hash, exact offset, local ID reference와 role/relation matrix를 다시 검사합니다. 안전한 결과는 runtime Tensor와 SpanRef 없이 evidence text/offset, lineage, component coverage를 가진 ArticleConstructionResult로 materialize합니다. Truncation이나 미실행 component는 PARTIAL, core identity/reference 파손은 FAILEDresult=None으로 구분합니다. 개발 trace는 include_trace=True일 때만 materialized 형태로 포함됩니다.

출력 계약

계약 버전은 starlight-lq-fse-output-v1입니다. 정식 JSON Schema는 output_schema.json에 있습니다.

{
  "schema_version": "starlight-lq-fse-output-v1",
  "role_labels": ["outlook", "event", "financial", "risk"],
  "selection": {"threshold": 0.5, "top_k": 3},
  "document": {
    "input_sentence_count": 2,
    "consumed_sentence_count": 2,
    "max_sentences": 30,
    "max_sentence_tokens": 128,
    "truncated": false,
    "coverage_ratio": 1.0
  },
  "sentences": [
    {
      "index": 0,
      "text": "매출이 전년 대비 30% 증가했다.",
      "start": 0,
      "end": 19,
      "native_role": "financial",
      "native_role_probability": 0.88,
      "role_logits": [0.1, 0.2, 3.2, -0.1],
      "role_probabilities": [0.04, 0.05, 0.88, 0.03],
      "extraction_score": 0.21,
      "selected": false,
      "projected_label": "EVENT",
      "reason_codes": ["EVENT_FACTUAL_CHANGE"],
      "tokenization": {
        "token_count": 12,
        "original_token_count": 12,
        "max_tokens": 128,
        "truncated": false
      }
    }
  ]
}

role_logitsrole_probabilities의 배열 순서는 top-level role_labels와 같습니다. extraction_scoreselected는 대표성 metadata이며 Projection의 DROP 조건으로 사용하지 않습니다.

Projection 정책

정책 ID는 lq-fse-sentence-projection-v0.1입니다.

  1. 기자명/이메일, copyright/UI noise는 DROP
  2. 겉문장 술어가 전망·양태·계획·평가·주장·권고이면 STATEMENT
  3. 겉문장 술어가 발생·변화·결정·현재 상태이면 EVENT
  4. 명확하지 않으면 native eventEVENT, outlookSTATEMENT
  5. 근거가 부족한 financial/riskDROP

Projection은 projection.py에 독립되어 있으며 모델의 native output을 덮어쓰지 않습니다.

POC v0.3 결과

29개 기사, Gold EVENT 123개, STATEMENT 118개 기준 저장 결과입니다.

Baseline Event F1 Statement F1 Macro F1 Coverage Count MAE Candidates
selected only 0.290 0.258 0.274 0.266 6.207 77
all sentences 0.601 0.446 0.523 0.896 3.586 408
all + projection 0.645 0.509 0.577 0.896 3.103 408

자세한 provenance와 수치는 benchmarks/poc-v0.3-summary.json에 있습니다.

제한사항

  • 문서당 최대 30문장, 문장당 최대 128 tokens만 처리합니다.
  • 30문장을 넘는 문서는 앞부분만 처리하며 document.truncated=true로 표시합니다.
  • Projection은 한국어 표면형 규칙 기반 baseline입니다.
  • 기본 JSON 출력은 sentence-level입니다. Runtime에는 Entity BIO decoder가 있지만 학습된 Entity head/checkpoint는 아직 포함하지 않습니다.
  • Time normalization과 Logical Span은 명시적으로 지원한 한국어 rule subset입니다.
  • Event trigger, Statement type과 assertor attribution은 한국어 표면형 rule baseline입니다. Entity head가 없으면 assertor는 None과 명시적 reason으로 남습니다.
  • Entity Resolution과 Argument Linking도 제한된 alias/title 및 predicate/particle rule baseline입니다. 학습된 Entity head가 없으면 Stage 10~11 runtime은 skip됩니다.
  • Event Resolution과 Relation Extraction은 same-trigger+structured argument 및 명시적 connective/reference에 한정된 보수적 rule baseline입니다. Stage 12~13 학습 head는 포함하지 않습니다.
  • financial/risk의 간접 인용문과 복합 술어는 오분류될 수 있습니다.

Article Construction 학습 구조

article_construction_config.json과 세 Python module은 frozen sentence encoder 위에 Pooling·Position·Document Context·Global Fusion 및 Token/Candidate/Pair Head를 조립하는 Phase 10 구조 계약을 제공합니다. 현재 배포 model.safetensors에는 이 새 Head의 학습된 weight가 없으며 기존 public runtime만 재현합니다. 초기화 Head를 예측으로 사용해서는 안 되고, 사람이 승인한 통합 checkpoint가 별도로 배포되기 전까지 이 구조는 학습과 structural smoke 용도입니다.

검사

가벼운 계약·규칙 테스트:

python -m unittest tests.test_projection tests.test_sentence_splitter tests.test_output_contract -v

실제 model.safetensors까지 로드하는 전체 검사:

python -m unittest discover -s tests -v

출처 및 라이선스

원본 모델과 가중치의 출처, snapshot, SHA-256 및 변경 범위는 NOTICE.md에 기록합니다. 원본 모델 카드는 MIT로 표시되어 있습니다. 배포 전 조직의 라이선스 정책과 원본 모델 카드의 disclaimer/usage restrictions도 함께 검토하세요.

Downloads last month
10
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for sysy9292/starlight-lq-fse-base

Finetuned
(1)
this model