LLM멀티모달 AI · 1중급

멀티모달 AI란? — 텍스트를 넘어선 AI

LLM멀티모달VisionGPT-4oClaudeGemini

멀티모달이란?

텍스트만 처리하는 것을 넘어 **여러 형태의 데이터(모달리티)**를 동시에 처리합니다.


주요 모달리티별 AI

모달리티주요 모델API
이미지 이해GPT-4o, Claude 3.5, Gemini텍스트 + 이미지 입력
이미지 생성DALL-E 3, Stable Diffusion, Midjourney텍스트 → 이미지
음성 인식Whisper오디오 → 텍스트
텍스트-음성OpenAI TTS, ElevenLabs텍스트 → 오디오
비디오 이해Gemini 1.5, GPT-4o비디오 + 텍스트

Vision LLM 비교

# GPT-4o: 이미지 이해
from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "이 이미지를 설명해주세요."},
            {"type": "image_url", "image_url": {"url": "https://..."}}
        ]
    }]
)

# Claude: 이미지 이해
import anthropic
client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    messages=[{
        "role": "user",
        "content": [
            {"type": "image", "source": {"type": "url", "url": "https://..."}},
            {"type": "text", "text": "이 이미지를 설명해주세요."}
        ]
    }]
)

활용 사례


토큰 비용 고려사항

이미지를 API로 전송할 때 이미지 크기가 토큰 비용에 영향을 줍니다.

# OpenAI 이미지 토큰 계산 (대략적)
def estimate_image_tokens(width: int, height: int) -> int:
    # 저해상도: 85 토큰
    # 고해상도: 타일당 85 토큰 + 기본 85
    tiles_x = (width + 511) // 512
    tiles_y = (height + 511) // 512
    return 85 * tiles_x * tiles_y + 85

# 1024×1024 이미지
tokens = estimate_image_tokens(1024, 1024)
print(f"약 {tokens} 토큰")  # 약 765 토큰

# 비용 절감: 이미지 리사이즈
from PIL import Image

def resize_for_api(image_path: str, max_size: int = 1024) -> Image.Image:
    img = Image.open(image_path)
    img.thumbnail((max_size, max_size))
    return img

정리

항목설명
Vision LLM이미지 + 텍스트 입력 처리
DALL-E / SD텍스트 → 이미지 생성
Whisper음성 → 텍스트 변환
TTS텍스트 → 음성 합성
이미지 토큰크기에 따라 비용 변동

다음 편에서는 이미지 이해 — Vision LLM으로 이미지를 분석하고 구조화된 데이터로 추출하는 방법을 배웁니다.

궁금한 점이 있으신가요?

협업·의뢰는 아래로, 가벼운 소통은 인스타그램 @bluefox._.hi도 환영이에요.