LLM 기반 상관관계 분석의 Semantic Causality 평가
Semantic Causality Evaluation of Correlation Analysis Utilizing Large Language Models
TL;DR Highlight
LLM 전문가 대역 활용이 상관관계 데이터에서 진짜 인과관계를 자동으로 식별한다.
Who Should Read
데이터 분석 결과에서 의미 있는 상관관계와 우연한 상관관계를 구분하고 싶은 데이터 분석가 또는 ML 엔지니어. 특히 도메인 전문가 없이 미지의 데이터셋을 탐색해야 하는 상황에 유용.
Core Mechanics
- 상관관계(correlation)는 인과관계(causality)가 아닌데, 지금까지는 이걸 구분하려면 도메인 전문가가 직접 봐야 했음
- GPT 계열 LLM을 도메인 전문가 대역으로 써서 각 상관관계가 실제 인과적 의미가 있는지 자동 판별
- 결과를 'Causal heatmap'이라는 시각화 모델로 표현 — 의미 있는 관계는 강조, 우연한 관계는 억제
- 모르는 데이터셋(unknown dataset)에서도 작동 — 전문 지식 없이 탐색적 분석 가능
- 시각적 품질, 인과 판별 품질, 비교 분석 세 가지 축으로 모델 평가 수행
Evidence
- 실험 결과에서 Causal heatmap이 흥미로운 관계를 명확히 부각하고 무관한 관계를 억제하는 효과가 입증됨 (논문 내 실험적 평가 근거)
- LLM이 인과 평가 태스크에서 사용 가능한 수준의 품질을 보임을 비교 분석으로 확인 — 단, 구체적 수치는 abstract에 미포함
- 미지의 데이터셋에서도 접근법의 잠재적 유용성(potential)이 확인됨
How to Apply
- 기존 상관관계 행렬(correlation matrix)을 만든 뒤, 각 (변수 A, 변수 B) 쌍을 LLM에 넘겨 '이 두 변수 간 인과관계가 실제로 존재하는가?'를 물어보는 파이프라인을 추가하면 됨
- LLM 응답을 점수화해서 heatmap에 오버레이 — 인과 가능성 높은 셀만 강조하도록 시각화 레이어를 수정하는 경우에 적용 가능
- 도메인 전문가가 없는 해커톤, PoC, 탐색적 EDA 단계에서 '일단 LLM한테 물어보고 필터링'하는 빠른 스크리닝 도구로 활용
Code Example
import openai
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
def causal_score(var_a: str, var_b: str, context: str = "") -> float:
"""LLM에게 두 변수 간 인과 가능성을 0~1로 평가하도록 요청"""
prompt = f"""두 변수 사이에 실제 인과관계(causality)가 존재할 가능성을 평가하세요.
변수 A: {var_a}
변수 B: {var_b}
{f'컨텍스트: {context}' if context else ''}
0.0(완전히 우연/무관) ~ 1.0(명확한 인과관계) 사이의 숫자 하나만 출력하세요."""
response = openai.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}],
temperature=0
)
try:
return float(response.choices[0].message.content.strip())
except:
return 0.0
def causal_heatmap(df: pd.DataFrame, context: str = ""):
"""상관관계 행렬에 LLM 인과 점수를 곱해 Causal heatmap 생성"""
corr = df.corr()
cols = corr.columns.tolist()
causal_matrix = pd.DataFrame(np.zeros_like(corr.values), index=cols, columns=cols)
for i, a in enumerate(cols):
for j, b in enumerate(cols):
if i < j:
score = causal_score(a, b, context)
causal_matrix.loc[a, b] = score
causal_matrix.loc[b, a] = score
elif i == j:
causal_matrix.loc[a, b] = 1.0
# 상관관계 * 인과 점수 = Causal heatmap
weighted = corr.abs() * causal_matrix
plt.figure(figsize=(10, 8))
sns.heatmap(weighted, annot=True, fmt=".2f", cmap="YlOrRd", vmin=0, vmax=1)
plt.title("Causal Heatmap (correlation × causal score)")
plt.tight_layout()
plt.show()
return weighted
# 사용 예시
# causal_heatmap(df, context="의료 환자 데이터, 변수는 나이/혈압/콜레스테롤 등")Terminology
관련 논문
LLM이 TLA+로 실제 시스템을 제대로 모델링할 수 있을까? — SysMoBench 벤치마크
LLM이 TLA+ 명세를 작성할 때 문법은 잘 통과하지만 실제 시스템과의 동작 일치도(conformance)는 46% 수준에 그친다는 걸 체계적으로 검증한 벤치마크 연구로, AI 기반 형식 검증의 현실적 한계를 보여준다.
Natural Language Autoencoders: Claude의 내부 활성화를 자연어 텍스트로 변환하는 기법
Anthropic이 LLM 내부의 숫자 벡터(활성화값)를 직접 읽을 수 있는 자연어로 변환하는 NLA 기법을 공개했다. AI가 실제로 무슨 생각을 하는지 해석하는 interpretability 연구의 새로운 진전이다.
ProgramBench: LLM이 프로그램을 처음부터 다시 만들 수 있을까?
LLM이 FFmpeg, SQLite, PHP 인터프리터 같은 실제 소프트웨어를 문서만 보고 처음부터 재구현할 수 있는지 측정하는 새 벤치마크로, 최고 모델도 전체 태스크의 3%만 95% 이상 통과하는 수준에 그쳤다.
MOSAIC-Bench:코딩 에이전트의 Compositional Vulnerability 유도 측정
티켓 3장으로 쪼개면 Claude/GPT도 보안 취약점 코드를 53~86% 확률로 그냥 짜준다.
LLM의 거절(Refusal) 동작은 단 하나의 방향(Direction)으로 제어된다
13개의 오픈소스 채팅 모델을 분석했더니, 모델이 유해한 요청을 거절하는 동작이 내부 활성화 공간에서 단 하나의 1차원 벡터 방향으로 인코딩되어 있었다. 이 방향을 제거하면 안전 파인튜닝이 사실상 무력화되므로, 현재 안전 학습 방식이 얼마나 취약한지 보여준다.
LLM의 구조화된 출력(Structured Output)을 테스트하는 새 벤치마크 SOB 공개
스키마 준수 여부만 보던 기존 벤치마크의 한계를 넘어, 실제 값의 정확도까지 7가지 지표로 평가하는 Structured Output Benchmark(SOB)가 공개됐다. 인보이스 파싱, 의료 기록 추출처럼 JSON 출력의 정확성이 중요한 프로덕션 시스템에서 어떤 모델을 써야 할지 판단하는 데 직접적으로 참고할 수 있다.
Original Abstract (Expand)
: It is known that correlation does not imply causality. Some relationships identified in the analysis of data are coincidental or unknown, and some are produced by real-world causality of the situation, which is problematic, since there is a need to differentiate between these two scenarios. Until recently, the proper − semantic − causality of the relationship could have been determined only by human experts from the area of expertise of the studied data. This has changed with the advance of large language models, which are often utilized as surrogates for such human experts, making the process automated and readily available to all data analysts. This motivates the main objective of this work, which is to introduce the design and implementation of a large language model-based semantic causality evaluator based on correlation analysis, together with its visual analysis model called Causal heatmap. After the implementation itself, the model is evaluated from the point of view of the quality of the visual model, from the point of view of the quality of causal evaluation based on large language models, and from the point of view of comparative analysis, while the results reached in the study highlight the usability of large language models in the task and the potential of the proposed approach in the analysis of unknown datasets. The results of the experimental evaluation demonstrate the usefulness of the Causal heatmap method, supported by the evident highlighting of interesting relationships, while suppressing irrelevant ones.