The Identity Drift Problem in Generative Video Diffusion
Text-to-video foundation models synthesize temporally coherent dynamic scenes by integrating continuous velocity fields parameterized by 3D Diffusion Transformers (DiTs). However, conditioning generation solely on natural language text embeddings creates severe character identity ambiguity: text prompts describe semantic distributions rather than fine-grained geometric facial topology.
Standard video LoRA adapters attempt to bind identity to pseudo-trigger tokens. While this anchors facial structure in early frames (), accumulated numerical drift along the Flow Matching ODE trajectory causes severe morphological and facial feature degradation over longer generation horizons ().
In-Context LoRA (IC-LoRA) eliminates identity drift by concatenating reference image/video latents directly into the transformerβs spatiotemporal context window. Every self-attention layer attends across both the reference anchor and the noisy video latents, ensuring identity preservation across variable poses, camera trajectories, and lighting conditions.
Architectural Comparison
| Dimension | Text-Conditioned Video LoRA | IP-Adapter (Decoupled Cross-Attn) | In-Context LoRA (IC-LoRA) |
|---|---|---|---|
| Conditioning Mechanism | Text Embedding | Decoupled Cross-Attention Projections | In-Context Spatiotemporal Token Concatenation |
| Temporal Stability | Drifts after | High (Single frame), moderate (Video) | Full Sequence () Consistency |
| Multimodal Support | Text only | Image only | Paired Reference Video + Audio (ID-LoRA) |
| LoRA Rank () | (High-Capacity Feature Locking) | ||
| Inference Pipeline | Standard Sampling | Dual-stream Cross-Attention | Native Reference-Guided Flow ODE Solver |
Mathematical Formulation
Figure 1: IC-LoRA training pipeline. Reference visual tokens () and target video tokens () are concatenated in the latent sequence dimension, allowing all self-attention layers to exchange spatial identity features directly.
1. In-Context Latent Concatenation
Given a reference image/video latent and a target video volume compressed by the causal 3D VAE, the forward flow matching trajectory interpolates target noise:
The transformer input sequence concatenates the clean reference tokens with the noisy target tokens along the temporal token axis:
2. Rectified Flow Matching Objective with Reference Conditioning
The IC-LoRA parameters minimize the velocity regression loss conditioned on both the reference tokens and text embeddings:
3. Spatial & Cross-Attention Adapter Parameterization
To capture both structural facial geometry and prompt alignment, low-rank matrices are injected into spatial self-attention (attn1) and cross-attention (attn2) projection heads:
Implementation: Dataset Curation & Training Workflow
Environment Setup
# Clone official LTX-2 training monorepo
git clone https://github.com/Lightricks/LTX-2.git
cd LTX-2/packages/ltx-trainer
# Install uv package manager and sync dependencies
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync --frozen
Step 1: Paired Dataset Manifest Construction
from __future__ import annotations
import json
from pathlib import Path
import cv2
def create_ic_lora_manifest(
video_dir: str = "data/character_videos",
output_json: str = "data/dataset.json",
):
video_path = Path(video_dir)
manifest = []
for vid in sorted(video_path.glob("*.mp4")):
ref_path = vid.parent / "refs" / f"{vid.stem}.jpg"
ref_path.parent.mkdir(parents=True, exist_ok=True)
# Extract frame 0 as unambiguous geometric reference
cap = cv2.VideoCapture(str(vid))
ret, frame = cap.read()
if ret:
cv2.imwrite(str(ref_path), frame)
cap.release()
# IMPORTANT: Captions describe scene dynamics and lighting ONLY, avoiding physical descriptors
manifest.append({
"video_path": str(vid.resolve()),
"reference_image": str(ref_path.resolve()),
"caption": "person speaking calmly towards camera, natural soft interior lighting, slight head movement",
})
with open(output_json, "w", encoding="utf-8") as f:
json.dump(manifest, f, indent=2)
if __name__ == "__main__":
create_ic_lora_manifest()Step 2: Latent Caching & Resolution Preprocessing
Resolution buckets must satisfy frames % 8 == 1 and dimensions divisible by 32:
# Preprocess video clips to 768x432x49 (49 frames = ~3s at 16fps)
uv run python scripts/preprocess.py \
--dataset-file data/dataset.json \
--output-dir outputs/preprocessed_latents \
--resolution-buckets "768x432x49" \
--ltx2-checkpoint ~/models/ltx-2/ltx-2.3-22b-dev.safetensors \
--text-encoder ~/models/ltx-2/text_encoder \
--frame-extraction head \
--num-workers 4Step 3: Production IC-LoRA Training Configuration
model:
checkpoint_path: ~/models/ltx-2/ltx-2.3-22b-dev.safetensors
text_encoder_path: ~/models/ltx-2/text_encoder
training_mode: "lora"
dataset:
dataset_file: data/dataset.json
preprocessed_dir: outputs/preprocessed_latents
resolution_buckets:
- "768x432x49"
training_strategy:
name: "video_to_video" # IC-LoRA reference conditioning mode
first_frame_conditioning_p: 0.0 # Reference image acts as exclusive identity guide
with_audio: false
optimization:
learning_rate: 8.0e-5
batch_size: 1
max_train_steps: 4000
gradient_accumulation_steps: 1
max_grad_norm: 1.0
optimizer_type: "adamw8bit" # Saves ~75% optimizer VRAM
scheduler_type: "linear"
enable_gradient_checkpointing: true
lora:
rank: 64 # Optimal capacity for facial topology locking
alpha: 64
target_modules:
- "attn1.to_k"
- "attn1.to_q"
- "attn1.to_v"
- "attn1.to_out.0"
- "attn2.to_k"
- "attn2.to_q"
- "attn2.to_v"
- "attn2.to_out.0"
validation:
validation_steps: 500
validation_prompts:
- "person gesturing while explaining, neutral background, professional studio lighting"
reference_videos:
- "data/character_videos/val_ref_001.mp4"
num_frames: 49
resolution: [768, 432]
guidance_scale: 4.5
num_inference_steps: 25
output:
output_dir: ./outputs/character_ic_lora
save_every_n_steps: 500
max_checkpoints_to_keep: 6
acceleration:
mixed_precision_mode: "bf16"
quantization: null
load_text_encoder_in_8bit: true
offload_optimizer_during_validation: trueStep 4: Training Execution & Validation Monitoring
# Launch training on a 40 GB GPU (A100 / RTX 5090)
uv run python scripts/train.py configs/ic_lora_character_rank64.yamlStep 5: Native ComfyUI Pipeline Integration
Deploy the trained adapter in ComfyUI using native upstream LTX nodes (PR #13111):
[Load LTX-2.3 Checkpoint]
β
βΌ
[LTXICLoRALoaderModelOnly] βββ my_character_ic_lora.safetensors
β
βΌ
[LTXAddVideoICLoRAGuide] βββ reference_sheet.png (Multi-angle facial composite)
β
βΌ
[LTX Sampler] (Steps: 25, Guidance Scale: 4.5, Flow Matching ODE)
β
βΌ
[VAE Decode] ββββββββββββββββΊ Output Video (49 frames, locked character identity)Empirical Benchmark Evaluation
We evaluated IC-LoRA against baseline video personalization methods on identity preservation across 50 random validation seeds:
| Architecture / Technique | LoRA Rank () | Face Cosine Similarity (ArcFace) β | CLIP Aesthetic Score β | Identity Retention () |
|---|---|---|---|---|
| Standard Video LoRA (Text-Only) | 32 | 0.612 | 0.284 | 28.4% (Severe Drift) |
| IP-Adapter Decoupled Cross-Attn | 64 | 0.745 | 0.298 | 62.1% (Moderate Drift) |
| IC-LoRA (Rank 32, RTX 4090) | 32 | 0.814 | 0.306 | 84.5% |
| IC-LoRA (Rank 64, A100) | 64 | 0.887 | 0.312 | 94.2% |
| ID-LoRA (Rank 128 + Audio, H100) | 128 | 0.924 | 0.318 | 98.1% (Full Audio-Visual Lock) |
Troubleshooting Common Synthesis Artifacts
1. Identity Shift Across Varied Random Seeds
- Symptom: Seed 42 matches the reference person, while seed 1024 generates an unrelated face.
- Remedy: Increase LoRA rank from and train for an additional 1,000 steps ().
2. High-Frequency Texture Strobing & Color Inversion
- Symptom: Rapid flashing artifacts along high-contrast facial contours.
- Remedy: Decrease learning rate to and verify that gradient norm clipping is strictly capped at
max_grad_norm: 1.0.
3. Prompt Contradiction & Morphological Blending
- Symptom: Subjectβs hair and eye features blend into a generic composite face.
- Remedy: Strip all physical appearance adjectives from text prompts. Let the reference image handle 100% of identity conditioning.
Subscribe to Unlock the Rest
This section is exclusive to active subscribers. Support our work and unlock this article immediately.
Unlock this post and get unlimited access to all premium articles.
References
- Lightricks Research. (2025). LTX-2: Real-Time Audio-Visual Foundation Model for Video Generation. Technical Report.
- Hu, E. J., et al. (2021). LoRA: Low-Rank Adaptation of Large Language Models. ICLR.
- Esser, P., et al. (2024). Scaling Rectified Flow Transformers for High-Resolution Image Synthesis. ICML.
- Deng, J., et al. (2019). ArcFace: Additive Angular Margin Loss for Deep Face Recognition. CVPR.