ERDNBT/
Back to all projects
Research•February 2026

Affect-LLaMA: Multimodal Human Affect-State Recognition via PEFT Foundation Models

Master's dissertation at Institute of Science Tokyo (2026). A trimodal framework adapting LLaMA-3.1-8B via LoRA, achieving #1 Valence CCC (0.6610) and State-of-the-Art Expression F1 (0.4364) on the Aff-Wild2 ABAW Benchmark.

Master Dissertation
Author: Erdenebat BATTSEREN
Institution: Institute of Science Tokyo (formerly Tokyo Institute of Technology), 2026
Repository: github.com/Rdnbt/masterthesis

Human affective behavior is intrinsically multimodal, synthesized across subtle facial micro-expressions, vocal prosody, pitch modulations, and contextual linguistic semantics.

This research investigates whether a Large Language Model (LLM) backbone, adapted via Parameter-Efficient Fine-Tuning (PEFT), can serve as a coherent cross-modal fusion and inference engine for in-the-wild affect recognition. We introduce Affect-LLaMA, a trimodal framework built upon LLaMA-3.1-8B that integrates continuous visual facial streams, acoustic waveforms, and synchronized speech text.

Evaluated on the Aff-Wild2 benchmark from the International Affective Behavior Analysis in-the-wild (ABAW) Challenge, Affect-LLaMA achieved the #1 Valence score (0.6610 CCC) and an overall Valence-Arousal score of 0.6480 CCC, outperforming specialized computer vision ensembles.


Interactive Computational Apparatus

Explore the real-time affective coordinate space, test continuous valence-arousal regression, and inspect cross-modal attention dynamics using the interactive module below:

Affect-LLaMA Apparatus
Latent Trajectory
Tap or click anywhere on the coordinate plane to test model inference across (V, A) space.
AFFECT REGRESSION (V, A)57% INTENSITY
VALENCE (V)
+0.450
Distinctly Pleasant
AROUSAL (A)
+0.350
Moderate Activation
Q1: High Arousal, Positive Valence
Excited / Alert / Elated Zone
FACIAL KINEMATICS (AUs)12-AU (F1: 0.4793)
AU1 (Inner Brow Raiser)65%
AU2 (Outer Brow Raiser)65%
AU4 (Brow Lowerer)49%
AU6 (Cheek Raiser)79%
AU7 (Lid Tightener)28%

System Architecture

The core hypothesis of this work is that pre-trained autoregressive foundation models possess rich semantic manifolds capable of performing cross-modal inference when provided with lightweight projection adapters.

Affect-LLaMA System Architecture
Affect-LLaMA System Architecture

1. Trimodal Feature Extraction Pipeline

  1. Visual Modality (evis\mathbf{e}_{vis}): We freeze CLIP-ViT-Large-Patch14 pre-trained on large-scale image-text pairs. Video frames are sampled and resized to 224×224224 \times 224. The pooled 1024-dimensional visual feature vector is projected to the 4096-dimensional LLaMA hidden dimension through a learnable Multi-Layer Perceptron (MLP) projector Pvis\mathcal{P}_{vis}:

    evis=Pvis(v)=Wv2⋅σ(Wv1⋅v+bv1)+bv2\mathbf{e}_{vis} = \mathcal{P}_{vis}(\mathbf{v}) = \mathbf{W}_{v2} \cdot \sigma(\mathbf{W}_{v1} \cdot \mathbf{v} + \mathbf{b}_{v1}) + \mathbf{b}_{v2}

    where σ\sigma is the GELU activation function.

  2. Acoustic Modality (eaud\mathbf{e}_{aud}): Raw audio is resampled to 16kHz. For each video frame at timestamp tt, a symmetric 3.0-second window [t−1.5s,t+1.5s][t - 1.5s, t + 1.5s] is passed through a frozen HuBERT-Base-LS960 encoder. Global average pooling over the temporal dimension compresses the acoustic state into afeat∈R768\mathbf{a}_{feat} \in \mathbb{R}^{768}, which is mapped to LLaMA space via Paud\mathcal{P}_{aud}:

    eaud=Paud(afeat)=Wa2⋅σ(Wa1⋅afeat+ba1)+ba2\mathbf{e}_{aud} = \mathcal{P}_{aud}(\mathbf{a}_{feat}) = \mathbf{W}_{a2} \cdot \sigma(\mathbf{W}_{a1} \cdot \mathbf{a}_{feat} + \mathbf{b}_{a1}) + \mathbf{b}_{a2}
  3. Linguistic Modality (Etext\mathbf{E}_{text}): Audio tracks are transcribed into text timestamps using OpenAI Whisper. When active speech coincides with timestamp tt, the spoken transcript is incorporated. When no speech is detected, an explicit silence prompt is constructed ("The user is silent. Analyze their face and voice to estimate valence and arousal."), preventing hallucination.

2. Input Concatenation & Cross-Modal Self-Attention

The projected acoustic and visual embeddings act as non-verbal soft prefix prompts prepended to the instruction token embeddings:

Xinput=[eaud, evis, Etext]∈R(1+1+L)×4096\mathbf{X}_{input} = \left[ \mathbf{e}_{aud}, \, \mathbf{e}_{vis}, \, \mathbf{E}_{text} \right] \in \mathbb{R}^{(1 + 1 + L) \times 4096}

By passing Xinput\mathbf{X}_{input} directly into LLaMA's decoder layers, the standard self-attention mechanism natively attends across modalities:

Attention(Q,K,V)=softmax(QKTdk)V\text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right)V

Parameter-Efficient Fine-Tuning (PEFT): Adapter vs. LoRA

Full fine-tuning of an 8-billion parameter foundation model is computationally prohibitive and risks catastrophic forgetting of pre-trained linguistic knowledge. In this research, we designed, implemented, and empirically benchmarked both primary PEFT architectures directly within the LLaMA 3.1 8B transformer blocks:

  1. LLaMA-Adapter Modules (Houlsby et al.): Sequential bottleneck sub-networks inserted after attention and feed-forward layers.
  2. LLaMA-LoRA (Hu et al.): Parallel low-rank decomposition matrices bypassing the frozen linear projection weights.

After systematic experimentation, LoRA consistently outperformed Adapters across all evaluation axes: achieving higher Expression Macro F1 (+1.66%), superior Action Unit detection (+1.58%), and higher Valence-Arousal correlation (+0.50% CCC), while requiring 3.1× fewer trainable parameters (0.0153% vs 0.047%) and incurring zero runtime latency overhead via weight folding.

PEFT Architecture Lab: Adapter vs. LoRA

Empirical evaluation of parameter-efficient adaptation strategies on multimodal affect recognition

Structural Topology: Sequential Bottleneck vs. Parallel Rank Decomposition

Both architectures were proposed and evaluated within each of the 32 LLaMA 3.1 8B Transformer layers.

Baseline Topology

LLaMA-Adapter Modules

Sequential Insertion
Input State x ∈ ℝ⁴⁰⁹⁶Multi-Head Self-Attention (Q, K, V, O)❄️ Frozen Pre-trained Transformer Weights⊕🔥 ADAPTER MODULE (Houlsby)Down-Projection: W_down ∈ ℝ⁶⁴ˣ⁴⁰⁹⁶Non-Linearity: GeLU(·)Up-Projection: W_up ∈ ℝ⁴⁰⁹⁶ˣ⁶⁴⊕Feed-Forward Network (SwiGLU MLP)❄️ Frozen Gate, Up, Down Projection Layers⊕Output State h ∈ ℝ⁴⁰⁹⁶
Latency Overhead
+4.2 ms / token
Sequential delay
Trainable Params
~3.8M (0.4211%)
Across 32 layers
EXPR Macro F1
0.3391
Unimodal Visual
AU Macro F1
0.4673
12 Action Units
Proposed Method ★ Best Empirical Performance

LLaMA-LoRA Low-Rank Adaptation

Zero-Latency Bypass
Input Vector x ∈ ℝ⁴⁰⁹⁶W₀ ∈ ℝ⁴⁰⁹⁶ˣ⁴⁰⁹⁶❄️ Frozen PretrainedLLaMA 3.1 8B Backbone(NF4 4-bit Quantized)W₀ · x🔥 LORA BYPASS (Rank r=16)Matrix A ∈ ℝ¹⁶ˣ⁴⁰⁹⁶Gaussian Init: 𝒩(0, σ²)Matrix B ∈ ℝ⁴⁰⁹⁶ˣ¹⁶Zero Init: 0 (Identity at start)Scaling: (α / r) · BA · x⊕h = W₀x + (α/r)(BA)x✓ Weights Fold Directly: W* = W₀ + ΔW (0.0 ms Latency)
Latency Overhead
0.0 ms (Foldable)
Native forward pass
Trainable Params
1,228,830 (0.3656%)
3× more efficient
EXPR Macro F1
0.3557 (+1.66%)
Unimodal Visual
AU Macro F1
0.4831 (+1.58%)
12 Action Units

Mathematical Formulation of Adapter vs. LoRA

For an input hidden state h∈Rd\mathbf{h} \in \mathbb{R}^d, the sequential bottleneck Adapter module computes:

Adapter(h)=Wup⋅ϕ(Wdown⋅h)+h\text{Adapter}(\mathbf{h}) = \mathbf{W}_{up} \cdot \phi(\mathbf{W}_{down} \cdot \mathbf{h}) + \mathbf{h}

In contrast, LoRA keeps pre-trained weight matrices W0∈Rd×k\mathbf{W}_0 \in \mathbb{R}^{d \times k} strictly frozen and injects trainable rank decomposition matrices B∈Rd×r\mathbf{B} \in \mathbb{R}^{d \times r} and A∈Rr×k\mathbf{A} \in \mathbb{R}^{r \times k} in parallel, where rank r≪min⁡(d,k)r \ll \min(d, k):

h=W0x+ΔWx=W0x+αr(BA)x\mathbf{h} = \mathbf{W}_0 \mathbf{x} + \Delta \mathbf{W}\mathbf{x} = \mathbf{W}_0 \mathbf{x} + \frac{\alpha}{r} (\mathbf{B}\mathbf{A})\mathbf{x}

We applied LoRA adapters with rank r=16r=16 and scaling factor α=16\alpha=16 across all linear layers (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj).

======================================================================
Trainable Parameters : 1,228,830
Total Parameters     : 8,031,490,078
Trainable Percentage : 0.0153%
Quantization Format  : NormalFloat 4-bit (NF4 via BitsAndBytes)
Compute Precision    : bfloat16
Acceleration Library : Unsloth + PyTorch
======================================================================

By updating only 0.0153% of parameters, the entire trimodal architecture trains in under 15 GB of VRAM, fitting comfortably on a single NVIDIA A100 or RTX 3090 GPU, while delivering higher F1 and CCC scores than sequential adapter modules.


Mathematical Training Objectives

The framework is trained jointly across three distinct affective tasks:

1. Continuous Valence-Arousal Hybrid Loss

Valence (pleasantness) and Arousal (intensity) are continuous values in [−1.0,+1.0][-1.0, +1.0]. We combine Mean Squared Error (MSE) with the Concordance Correlation Coefficient (CCC) loss:

LVA=0.5⋅LMSE+0.5⋅LCCC\mathcal{L}_{VA} = 0.5 \cdot \mathcal{L}_{MSE} + 0.5 \cdot \mathcal{L}_{CCC} LCCC=1−2ρσyσy^σy2+σy^2+(μy−μy^)2\mathcal{L}_{CCC} = 1 - \frac{2 \rho \sigma_{y} \sigma_{\hat{y}}}{\sigma_{y}^2 + \sigma_{\hat{y}}^2 + (\mu_{y} - \mu_{\hat{y}})^2}

Where μ\mu and σ\sigma denote means and standard deviations over the batch, and ρ\rho is the Pearson correlation coefficient. The CCC metric penalizes shifts in scale and location, ensuring accurate dynamic trajectory tracking.

2. 8-Class Categorical Expression Loss

For discrete emotion recognition (Neutral, Anger, Disgust, Fear, Happiness, Sadness, Surprise, Other), we optimize class-weighted Cross-Entropy to handle dataset imbalance:

LEXPR=−1N∑i=1N∑c=18wc yi,clog⁡(y^i,c)\mathcal{L}_{EXPR} = - \frac{1}{N} \sum_{i=1}^{N} \sum_{c=1}^{8} w_c \, y_{i,c} \log(\hat{y}_{i,c})

3. Multi-Label Action Unit (AU) Detection

For detecting 12 concurrent Facial Action Units (AU1, AU2, AU4, AU6, AU7, AU10, AU12, AU15, AU25, AU26), we use positive-weighted Binary Cross-Entropy with Logits:

LAU=−112N∑j=112∑i=1N[wpos,jyi,jlog⁡(σ(xi,j))+(1−yi,j)log⁡(1−σ(xi,j))]\mathcal{L}_{AU} = - \frac{1}{12 N} \sum_{j=1}^{12} \sum_{i=1}^{N} \left[ w_{pos, j} y_{i,j} \log(\sigma(x_{i,j})) + (1 - y_{i,j}) \log(1 - \sigma(x_{i,j})) \right]

Benchmark Results on Aff-Wild2

Aff-Wild2 Circumplex Distribution Heatmap
Aff-Wild2 Circumplex Distribution Heatmap

Continuous Valence & Arousal (VA) Estimation

Comparison against the top-performing international teams from the ABAW Challenge Leaderboard:

RankTeam / SystemTotal CCCValence CCCArousal CCC
1stAffect-LLaMA (Ours)0.64800.66100.6350
2ndSituTech0.64140.61930.6634
3rdNetease Fuxi0.63720.64860.6258
4thCBCR0.59130.55260.6299
5thCtyunAI0.56660.50080.6325
6thHFUT-MAC0.53420.52340.5451
7thHSE-NN-SberAI0.50480.48180.5279
—ABAW Baseline0.20100.21100.1910

Affect-LLaMA achieved the highest Valence CCC (0.6610) in the competition, confirming that the LLM's deep contextual understanding provides critical disambiguation when judging facial sentiment.

Valence-Arousal Training Progression across Epochs
Valence-Arousal Training Progression across Epochs


Expression Classification (EXPR)

Evaluated on the 8-class categorical emotion task:

Team / SystemMacro F1Accuracy
Affect-LLaMA (Ours)0.436455.44%
Netease Fuxi Virtual Human (ABAW Winner)0.4121—
SituTech0.4072—
CtyunAI0.3532—
HFUT-MAC0.3337—
ABAW Baseline0.2050—

Affect-LLaMA outperforms the 2023 ABAW Challenge winner by +2.43% F1, demonstrating that a single foundation model architecture outperforms complex multi-stage ensemble pipelines.


Action Unit (AU) Detection

Evaluating multi-label occurrence across 12 distinct facial muscle movements:

Team / SystemMacro F1
Netease Fuxi Virtual Human0.5549
SituTech0.5422
USTC-IAT-United0.5144
Affect-LLaMA (Ours)0.4793
HFUT-MAC0.4752
SCLAB CNU0.4563
ABAW Baseline0.3650

Action Unit Precision-Recall Curves
Action Unit Precision-Recall Curves

Action Unit Training Progress
Action Unit Training Progress

The integration of textual tokens particularly benefited speech-correlated Action Units, such as AU25 (Lips Part) and AU26 (Jaw Drop), confirming cross-modal reinforcement.


Ablation Study: Unimodal vs. Trimodal Fusion

To quantify the exact performance gain contributed by multimodal fusion, we compared unimodal baselines against our full trimodal model:

TaskMetricVisual Only (LoRA)Trimodal (LoRA)Relative Gain
Valence-ArousalAvg. CCC0.38260.6480+69.4%
ExpressionMacro F10.35570.4364+22.7%
AU DetectionMacro F10.48310.4793Comparable

The dramatic +69.4% increase in continuous Valence-Arousal correlation demonstrates that human emotional dynamics cannot be fully resolved from visual pixels alone; vocal timbre and verbal context provide crucial complementary signals.


Qualitative Analyses & Time-Series Tracking

Continuous Frame-by-Frame Tracking

We tested continuous temporal tracking across challenging validation clips featuring extreme lighting, occlusion, and head pose variations:

Continuous Valence-Arousal Tracking on Video 259
Continuous Valence-Arousal Tracking on Video 259

Figure: Continuous frame-by-frame estimation on Video 259. Top curve shows Valence, bottom curve shows Arousal. The model achieves 0.73 Valence CCC and 0.63 Arousal CCC, maintaining tight concordance with ground-truth human annotations.

Continuous Valence-Arousal Tracking on Video 186
Continuous Valence-Arousal Tracking on Video 186

Figure: Video 186 tracking under rapid affective transitions and mild facial expressions.


Latent Manifold Structure (t-SNE)

To visualize how the 8B foundation model organizes multimodal affective representations, we projected high-dimensional embeddings into a 2D plane via t-SNE:

t-SNE Latent Feature Space Clustering
t-SNE Latent Feature Space Clustering

  • Sadness & Disgust: Form tightly bounded, well-separated manifolds, indicating robust multimodal acoustic-visual signatures.
  • Happiness & Surprise: Prominent distinct clusters in high-arousal territory.
  • Neutral: Sits centrally at the manifold centroid, reflecting natural affective equilibrium.

Expression Confusion Matrix
Expression Confusion Matrix


Key Conclusions

  1. Parameter Efficiency: LoRA low-rank adaptation (r=16r=16) is sufficient to repurpose a frozen 8B LLM into a multi-task continuous affective regression engine without catastrophic forgetting.
  2. Complementary Modalities: Audio provides crucial disambiguation for arousal intensity, while speech semantics anchor valence estimation during subtle or ambiguous facial expressions.
  3. Temporal Stability: Foundation models trained with CCC correlation loss exhibit smooth temporal tracking across video time series, resisting frame-level flicker and occlusion artifacts.

Citation

@mastersthesis{erdenebat2026affectllama,
  title  = {Affect-LLaMA: Multimodal Human Affect-state Recognition utilizing PEFT Methods},
  author = {Erdenebat Battseren},
  school = {Institute of Science Tokyo},
  year   = {2026},
  url    = {https://github.com/Rdnbt/masterthesis}
}