Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Light-MER lime icon Light-MER

Official implementation for the paper:

Do We Really Need Multimodal Emotion Language Models Larger Than 1B Parameters?

🌟 If this project helps or inspires your research, please consider giving us a star! ⭐

arXiv Light-MER PyTorch 2.4+ Python 3.10 Hugging Face checkpoint Blog ζ–°ζ™Ίε…ƒ Apache License 2.0

Light-MER Stage 1 overview: a large model becomes a small but strong student, and a large teacher teaches a small student through SWD-H.

Light-MER codebase for Stage 1 SWD-H distillation and Stage 2 M-GRPO refinement.

Light-MER revisits generative multimodal emotion recognition (MER) from an efficiency perspective. Instead of deploying a large 7B/8B multimodal emotion language model, Light-MER transfers the multimodal emotion reasoning ability of a strong teacher into a sub-1B deployment model.

This repository hosts the Light-MER open-source release, covering Stage 1 SWD-H distillation and Stage 2 M-GRPO refinement in one codebase.

πŸ“° News

  • August 6, 2026: Stage 2 M-GRPO checkpoints released.
  • August 6, 2026: Stage 2 M-GRPO training, inference, evaluation, and agent-skill support released.
  • July 14, 2026: Stage 1 SWD-H student checkpoints and Stage 1 agent skills released.
  • July 14, 2026: README and public config aligned with the Light-MER paper; core model source is included in the release.
  • July 14, 2026: Stage 1 SWD-H training, inference, and evaluation code released.
  • July 10, 2026: πŸŽ‰ Our paper Do We Really Need Multimodal Emotion Language Models Larger Than 1B Parameters? was accepted by the ACM MM 2026 Main Track.

TODO list sorted by priority

  • Release Stage 1 SWD-H training, inference, and evaluation code. (Completed on July 14, 2026)
  • Release Light-MER teacher and Stage 1 SWD-H student checkpoints. (Completed on July 14, 2026)
  • Release Codex and Claude Code Stage 1 deployment skills. (Completed on July 14, 2026)
  • Release Stage 2 M-GRPO refinement code and instructions. (Completed on August 6, 2026)
  • Release Stage 2 M-GRPO checkpoints. (Completed on August 6, 2026)
  • Release online demo.

If you encounter any questions or discover a bug within the paper or code, please do not hesitate to open an issue or submit a pull request.

🚦 Release Status

Component Status Notes
Stage 1 Released SWD-H distillation code for Qwen3-8B teacher to Qwen3-0.6B student
Stage 2 Released M-GRPO training, inference, and evaluation code/instructions
Evaluation Released Stage 1 and Stage 2 inference scripts, label extraction, and Emotion Wheel metrics
Model Checkpoint Released Teacher, Stage 1 SWD-H, and Stage 2 M-GRPO checkpoints released
AI Agent Skills Released Codex and Claude Code helpers with Stage 1/2 train, inference, and evaluation preflight checks

πŸ› οΈ AI Agent Skills

Deployment helpers are included for both Codex and Claude Code. After installation, start the skill with one prompt; if no workflow is specified, it opens a Stage 1/2 menu and automatically checks checkpoints, pretrained models, datasets, configs, and inference outputs before running project scripts.

Codex

Install:

git clone https://github.com/GAIR-Lab/Light-MER.git
mkdir -p ~/.codex/skills
cp -r Light-MER/codex/skills/light-mer ~/.codex/skills/

After installation, open a new Codex session and invoke the installed Light-MER skill. Codex will open a six-option Stage 1/2 menu. The preflight checker runs inside the selected workflow; missing resources are requested together and deployed with symlinks or environment variables.

Claude Code

Install:

git clone https://github.com/GAIR-Lab/Light-MER.git
mkdir -p ~/.claude/skills
cp -r Light-MER/claude-code/skills/light-mer ~/.claude/skills/

After installation, invoke the installed Light-MER skill in Claude Code. Claude Code uses the same six-option Stage 1/2 menu and automatic resource checks.

Status: Released for Stage 1 and Stage 2.

🧠 Method Overview

Light-MER compresses a Qwen3-8B multimodal emotion teacher into a Qwen3-0.6B deployable student. Stage 1 uses SWD-H to align answer-token hidden-state geometry, while Stage 2 follows the M-GRPO refinement track for more concise and emotion-faithful generation.

Light-MER model overview showing SWD-H hidden-state distillation and M-GRPO refinement.

🧩 Model Configuration

Role Language decoder Visual encoder Audio encoder
Teacher Qwen3-8B CLIP-ViT-Large-Patch14 HuBERT-Large
Student Qwen3-0.6B CLIP-ViT-Base-Patch16 HuBERT-Base

The paper uses face-cropped visual inputs because facial regions carry salient affective cues. The current configs expose the same multimodal data path through face_or_frame: "multiface_audio_face_text".

⚑ Efficiency Snapshot

Light-MER keeps the multimodal emotion reasoning pipeline compact: the Qwen3-0.6B student uses about 11x fewer FLOPs and 2.54 GB peak memory, while preserving the same MER generation interface.

Model Params Peak Mem. FLOPs Direct Descriptive
Teacher 9.00B 20.04 GB 10,902.6G 0.901s 6.138s
SWD‑H Student 854.93M 2.54 GB 988.8G (11.0x) 0.561s 4.621s
M‑GRPO Student 854.93M 2.54 GB 988.8G (11.0x) 0.523s 3.105s

Direct and descriptive columns report latency per sample.

βš™οΈ Installation

Create a conda environment:

conda env create -f environment.yml
conda activate swdh-stage1

or install with pip:

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Hardware requirements depend on the selected pretrained models, number of Stage 2 checkpoints, batch settings, and local software stack. Adjust training and inference parallelism according to your available GPUs and scheduler policy.

πŸ“¦ Dataset

πŸ“ MER-Caption+

Stage 1 distillation and Stage 2 M-GRPO refinement use MER-Caption+ from the MER2025 release:

Expected layout:

dataset/
└── mer2025-dataset/
    β”œβ”€β”€ video/
    β”œβ”€β”€ audio/
    β”œβ”€β”€ openface_face/
    β”œβ”€β”€ subtitle_chieng.csv
    β”œβ”€β”€ track2_train_mercaptionplus.csv
    └── track3_train_mercaptionplus.csv

πŸ§ͺ MER-UniBench

Evaluation follows the MER-UniBench setting, covering basic emotion recognition, sentiment analysis, and open-vocabulary MER.

Expected layout:

dataset/
β”œβ”€β”€ mer2023-dataset-process/
β”œβ”€β”€ mer2024-dataset-process/
β”œβ”€β”€ meld-process/
β”œβ”€β”€ iemocap-process/
β”œβ”€β”€ cmumosi-process/
β”œβ”€β”€ cmumosei-process/
β”œβ”€β”€ sims-process/
β”œβ”€β”€ simsv2-process/
└── ovmerdplus-process/

πŸ€– Model Zoo

🧱 General Checkpoints

Place or symlink pretrained models under models/, or set SWDH_MODEL_ROOT.

Model Type Used for Link
Qwen3-8B LLM Teacher decoder Hugging Face
Qwen3-0.6B LLM Student decoder Hugging Face
Qwen2.5-7B-Instruct LLM Evaluation label extraction Hugging Face
CLIP-ViT-Large-Patch14 Visual Encoder Teacher visual encoder Hugging Face
CLIP-ViT-Base-Patch16 Visual Encoder Student visual encoder Hugging Face
Chinese HuBERT-Large Audio Encoder Teacher audio encoder Hugging Face
Chinese HuBERT-Base Audio Encoder Student audio encoder Hugging Face

Expected layout:

models/
β”œβ”€β”€ Qwen3-8B/
β”œβ”€β”€ Qwen3-0.6B/
β”œβ”€β”€ Qwen2.5-7B-Instruct/
β”œβ”€β”€ clip-vit-large-patch14/
β”œβ”€β”€ clip-vit-base-patch16/
β”œβ”€β”€ chinese-hubert-large/
└── chinese-hubert-base/

🏁 Light-MER Checkpoints

Model Name Description Link
Light-MER Teacher Qwen3-8B teacher checkpoint Hugging Face
Light-MER Stage 1 SWD-H Qwen3-0.6B student after SWD-H distillation Hugging Face
Light-MER Stage 2 M-GRPO Qwen3-0.6B student checkpoints after M-GRPO refinement Hugging Face

πŸš€ Getting Started

πŸŽ“ Stage 1: SWD-H Distillation

1. Train the Qwen3-8B Teacher

Skip this step if you already have a compatible teacher checkpoint.

CONDA_ENV_NAME=swdh-stage1 bash scripts/train_teacher_qwen3_8b.sh

After selecting the teacher checkpoint, copy or symlink it to:

checkpoints/qwen3_8b_teacher.pth

2. Train the Qwen3-0.6B SWD-H Student

CONDA_ENV_NAME=swdh-stage1 \
TEACHER_CKPT=checkpoints/qwen3_8b_teacher.pth \
bash scripts/train_stage1_swdh.sh

3. Run Stage 1 Inference

CKPT_ROOT=output/stage1_swdh_qwen3_8b_to_qwen3_0_6b/<run_dir> \
REPEAT=1 \
BASE_ROOT=output_stage1_swdh_qwen3_8b_to_qwen3_0_6b/repeat1/results \
TEST_EPOCH=60 \
bash scripts/inference_stage1_swdh.sh

This runs one task for one model/config, one repeat, and one epoch. To run a local serial epoch loop, set TEST_EPOCHS=5-60 and SKIP_EPOCH=5 explicitly.

4. Evaluate Stage 1

bash scripts/eval_stage1_swdh.sh \
  --base-root output_stage1_swdh_qwen3_8b_to_qwen3_0_6b/repeat1/results

🧭 Stage 2: M-GRPO Refinement

1. Train the Stage 2 M-GRPO Student

Train Stage 2 from the Stage 1 SWD-H checkpoint:

STAGE1_CKPT=checkpoints/stage1-swdh-qwen3-0.6b/checkpoint_000025_loss_1.549.pth \
OUTPUT_DIR=output/stage2_mgrpo_qwen3_0_6b \
CONDA_ENV_NAME=swdh-stage1 \
bash scripts/train_stage2_mgrpo.sh

To skip training, download or symlink the released checkpoints into:

checkpoints/stage2-mgrpo-qwen3-0.6b/

2. Run Stage 2 Inference

STAGE2_CKPT_ROOT=checkpoints/stage2-mgrpo-qwen3-0.6b \
START_STEP=50 \
END_STEP=5000 \
STAGE2_RESULT_ROOT=output_stage2_mgrpo/results \
RUN_TAG=stage2_mgrpo_qwen3_0_6b \
TEMPERATURE=0.9 \
TOP_P=0.9 \
MERGE_LORA=1 \
bash scripts/inference_stage2_mgrpo.sh

You can also try TEMPERATURE=0.3 for lower-temperature inference.

3. Evaluate Stage 2

bash scripts/eval_stage2_mgrpo.sh \
  --base-root output_stage2_mgrpo/results \
  --run-tag stage2_mgrpo_qwen3_0_6b

The Stage 2 wrapper follows the original evaluation flow: it first creates any missing Qwen label-extraction caches, then summarizes the Emotion Wheel metrics for all nine MER-UniBench datasets.

Security: evaluate only NPZ files generated locally by this repository or obtained from a trusted source. The original result format contains Python objects and therefore requires NumPy pickle loading.

🏁 Expected Results

Light-MER results on MER-UniBench benchmarks

Inference and Qwen label extraction can be stochastic. Small differences of about Β±0.3% are normal when rerunning the pipeline.

πŸ› οΈ Path Overrides

You can override default roots without editing source files:

export SWDH_MODEL_ROOT=/path/to/models
export SWDH_DATASET_ROOT=/path/to/dataset
export SWDH_EMOTION_WHEEL_ROOT=/path/to/emotion_wheel
export SWDH_RESULT_ROOT=/path/to/results
export LIGHT_MER_ROOT=/path/to/Light-MER
export STAGE1_CKPT=/path/to/checkpoint_000025_loss_1.549.pth
export STAGE2_CKPT_ROOT=/path/to/stage2-mgrpo-qwen3-0.6b
export STAGE2_RESULT_ROOT=/path/to/stage2/results
export LIGHT_MER_EVAL_SEED=42

You can override YAML values directly:

python -u train.py \
  --cfg-path train_configs/stage1_swdh_qwen3_8b_to_qwen3_0_6b.yaml \
  --options model.teacher.ckpt=/path/to/qwen3_8b_teacher.pth

πŸ“š Citation

If you find Light-MER useful, please cite our arXiv preprint: arXiv:2607.12787.

@misc{zheng2026lightmer,
  title = {Do We Really Need Multimodal Emotion Language Models Larger Than 1B Parameters?},
  author = {Zheng, Kaiwen and Fu, Junchen and Deng, Wenhao and Han, Hu and Jose, Joemon M. and Ge, Xuri},
  year = {2026},
  eprint = {2607.12787},
  archivePrefix = {arXiv},
  primaryClass = {cs.AI},
  url = {https://arxiv.org/abs/2607.12787},
  note = {Accepted by ACM MM 2026}
}

πŸ“„ License

This project is released under the Apache License 2.0. Please also follow the licenses and usage terms of the external datasets, pretrained models, and checkpoints used with this codebase.

πŸ™ Acknowledgement

  • Built on AffectGPT-style multimodal instruction tuning: AffectGPT.
  • Developed with PyTorch and Hugging Face Transformers.
  • Uses vLLM for evaluation-time label extraction and efficient LLM inference.
  • Uses CLIP visual encoders and HuBERT audio encoders for multimodal feature extraction.
  • Reuses ideas and open-source components from BLIP/LAVIS and ImageBind.

About

Light-MER for efficient multimodal emotion recognition with sub-1B MLLMs.

Topics

Resources

Stars

26 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages