---
id: wiki-2026-0508-dynamic-creative-optimization
title: Dynamic Creative Optimization (DCO)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [DCO, dynamic ad, programmatic creative, ad personalization, creative AI]
duplicate_of: none
source_trust_level: A
confidence_score: 0.94
verification_status: applied
tags: [advertising, ad-tech, dco, personalization, generative-ai, mab, optimization]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: Python / TypeScript
  framework: AWS / GCP / DSP
---

# Dynamic Creative Optimization (DCO)

## 매 한 줄
> **"매 ad creative 의 user / context 의 real-time 의 assemble"**. 매 static ad → 매 millions of variant. 매 element-level (image + headline + CTA + offer). 매 modern: 매 LLM + diffusion 의 generate, 매 RL bandit 의 select.

## 매 핵심

### 매 motivation
- **Static ad**: 매 single creative.
- **DCO**: 매 user 의 context 의 best variant.
- **Result**: 매 CTR 30-200% ↑ (typical).

### 매 element
- **Hero image / video**: 매 product, lifestyle.
- **Headline**: 매 hook.
- **Body**: 매 detail.
- **CTA**: "Buy", "Learn", "Sign Up".
- **Offer**: 매 discount, urgency.
- **Logo / brand color**.

### 매 method
- **Rules-based**: 매 segment → variant.
- **MAB / contextual bandit**: 매 explore-exploit.
- **RL**: 매 long-term reward.
- **Generative**: 매 LLM headline + diffusion image.
- **Predictive CTR**: 매 model 의 score.

### 매 modern AI
- **Generative DCO**: 매 millions of unique creative.
- **Persona-based**: 매 LLM 의 segment 의 voice.
- **A/B at scale**: 매 thousands variant.
- **Brand safety**: 매 LLM filter.

### 매 응용
1. **E-commerce**: 매 product feed-driven.
2. **Travel**: 매 destination + season.
3. **Finance**: 매 demographic.
4. **Gaming**: 매 acquired-similar.
5. **B2B SaaS**: 매 industry.

## 💻 패턴

### Element-level template
```typescript
interface CreativeTemplate {
  layout: 'hero' | 'carousel' | 'video';
  slots: {
    image: string;       // 매 URL
    headline: string;
    cta: string;
    body: string;
    logo: string;
  };
  brand_color: string;
}

function assemble(user: User, context: Context): CreativeTemplate {
  return {
    layout: pickLayout(user, context),
    slots: {
      image: pickImage(user.interests, context.season),
      headline: pickHeadline(user.intent, context.event),
      cta: pickCTA(user.funnel_stage),
      body: pickBody(user.lang),
      logo: BRAND_LOGO,
    },
    brand_color: BRAND_COLOR,
  };
}
```

### Contextual bandit (LinUCB)
```python
import numpy as np

class LinUCB:
    def __init__(self, n_arms, n_features, alpha=1.0):
        self.alpha = alpha
        self.A = [np.eye(n_features) for _ in range(n_arms)]
        self.b = [np.zeros(n_features) for _ in range(n_arms)]
    
    def select(self, context):
        scores = []
        for a in range(len(self.A)):
            theta = np.linalg.solve(self.A[a], self.b[a])
            ucb = theta @ context + self.alpha * np.sqrt(
                context @ np.linalg.solve(self.A[a], context)
            )
            scores.append(ucb)
        return int(np.argmax(scores))
    
    def update(self, arm, context, reward):
        self.A[arm] += np.outer(context, context)
        self.b[arm] += reward * context

# 매 each "arm" = 매 creative variant
```

### Generative ad (LLM headline)
```python
def generate_headlines(product, user_segment, n=10):
    prompt = f"""Generate {n} ad headlines for "{product}" targeting {user_segment}.
Tone: persuasive, concise (≤7 words). One per line."""
    return llm.generate(prompt).split('\n')

# 매 brand safety filter
def is_safe(headline):
    return classifier.predict(headline)['toxic'] < 0.1
```

### Diffusion image (variant)
```python
import torch
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained('stabilityai/sdxl-turbo').to('cuda')

def generate_hero(product, lifestyle, brand_style):
    prompt = f"{product} in {lifestyle}, {brand_style}, professional photography"
    return pipe(prompt, num_inference_steps=4).images[0]
```

### CTR predictor (Wide & Deep)
```python
class WideDeepCTR(nn.Module):
    def __init__(self, n_cat, embed_dim=8, hidden=64):
        super().__init__()
        self.embeds = nn.ModuleList([nn.Embedding(c, embed_dim) for c in n_cat])
        self.deep = nn.Sequential(
            nn.Linear(len(n_cat) * embed_dim, hidden),
            nn.ReLU(),
            nn.Linear(hidden, 1),
        )
        self.wide = nn.Linear(sum(n_cat), 1)
    
    def forward(self, sparse_feats, deep_idx):
        deep = torch.cat([e(deep_idx[:, i]) for i, e in enumerate(self.embeds)], dim=1)
        return torch.sigmoid(self.wide(sparse_feats) + self.deep(deep))
```

### Multi-armed Thompson Sampling
```python
class ThompsonDCO:
    def __init__(self, n_arms):
        self.alpha = np.ones(n_arms)
        self.beta = np.ones(n_arms)
    
    def select(self):
        samples = np.random.beta(self.alpha, self.beta)
        return int(np.argmax(samples))
    
    def update(self, arm, click):
        if click: self.alpha[arm] += 1
        else: self.beta[arm] += 1
```

### Real-time decisioning (DSP integration)
```typescript
// OpenRTB bid request
async function decideAd(bidReq: BidRequest): Promise<AdResponse> {
  const userVec = await fetchUserEmbed(bidReq.user.id);
  const ctxVec = encodeContext(bidReq.imp[0]);
  const variantId = bandit.select(concat(userVec, ctxVec));
  const creative = assemble(variantId);
  return {
    bid: predictedCTR * cpc * 1000,  // 매 CPM
    creative,
  };
}
```

### Brand safety guard
```python
def brand_safe(creative, context):
    """매 placement adjacency check."""
    if context.publisher_category in BLOCKED_CATEGORIES:
        return False
    if classifier.predict(creative.headline)['toxic'] > 0.05:
        return False
    if has_competitor_logo(creative.image):
        return False
    return True
```

### Frequency cap
```python
class FreqCap:
    def __init__(self, redis, limit_per_day=5):
        self.redis = redis
        self.limit = limit_per_day
    
    def can_show(self, user_id, campaign_id):
        key = f'fc:{user_id}:{campaign_id}:{today()}'
        count = int(self.redis.get(key) or 0)
        return count < self.limit
    
    def record(self, user_id, campaign_id):
        key = f'fc:{user_id}:{campaign_id}:{today()}'
        self.redis.incr(key)
        self.redis.expire(key, 86400)
```

### Eval metric
```python
def evaluate(impressions):
    return {
        'CTR': sum(i.click for i in impressions) / len(impressions),
        'CVR': sum(i.convert for i in impressions if i.click) / max(1, sum(i.click for i in impressions)),
        'CPA': sum(i.spend for i in impressions) / max(1, sum(i.convert for i in impressions)),
        'ROAS': sum(i.revenue for i in impressions) / sum(i.spend for i in impressions),
    }
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| Few variants | A/B test |
| Many segments | Rules + bandit |
| Many variants | Contextual bandit |
| Long-term reward | RL |
| Need fresh creative | Generative + brand-safe |
| High-stakes | CTR predictor + rules |

**기본값**: 매 element-level template + 매 contextual bandit + 매 generative refresh + 매 brand safety + 매 freq cap.

## 🔗 Graph
- 부모: [[Personalization]]
- 응용: [[Multi-Armed-Bandit]]
- Adjacent: [[Recommender-Systems]] · [[Diffusion-Models]]

## 🤖 LLM 활용
**언제**: 매 ad campaign. 매 personalization. 매 generative creative.
**언제 X**: 매 brand-safety-strict (LLM 의 risk).

## ❌ 안티패턴
- **No frequency cap**: 매 user fatigue.
- **Pure generative no filter**: 매 brand safety 의 violate.
- **Static creative**: 매 fatigue 의 quickly.
- **Bandit without features**: 매 personalization X.
- **No measurement loop**: 매 optimization 의 stale.

## 🧪 검증 / 중복
- Verified (Google Ads DCO, Meta Advantage+, AdTech industry).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-04-20 | Auto-reinforced |
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — DCO element + 매 LinUCB / Thompson / generative / CTR / brand-safety code |
