
Visual Language Models (VLM) 에 관한 최신 연구들이 (24.12 기준) Accuracy 측면에서는 상당한 성과를 보였지만
VLM의 Pre-Training / Fine-Tuning / Inference 측면에서 Efficiency를 증진하고자 하는 연구는 활발히 진행되지 않았다.
이에, LLaVA-OneVision-7B과 같은 SOTA 모델을 Scratch부터 Pre-Training 한다면,
Counsumer Level의 저렴한 GPU로는 up to 400 GPU days가 소요되고 (해당 논문 언급)
Compute Intensive
7B VLM Fully-Fine-Tuning 진행 시, "NVIDIA Jetson AGX Orin Developer Kit" 과 같은
Consumer Lvel GPU의 가용 메모리 64GB 이상을 요구하고
Memory Intensive
Laptob, Robot 과 같은 Edge Application에서, 이미 학습된 모델을 가지고
Inference를 진행함에 있어서도, 메모리, 디스크 등의 자원에 따른 제약이 큰 상황이다.
Resourece Constrained
따라서, 해당 논문은, VILA Architecture에 기반하여

"VILA Archictecture" (논문 출처: https://arxiv.org/abs/2312.07533)
Input (Image / Video) 의
2가지 Resolution을 "Scailing up"함으로써,
Visual Input으로부터 시각적 디테일 더욱 보존하면서도,
뒤따른, "Compression" 을 통해, Information Loss를 최소화하며 Visual Token의 수를 압축함으로써,
LLM Decoder가 처리해야 하는 Visual Token의 수를 최적화하였다.
저자들은 해당 "Scale-Then-Compress" 접근법을 통해,
NVILA 파이프라인이
2가지를 적은 연산량과 메모리로 처리할 수 있게 됨에 따라,
Accuracy, Efficiency의 Balancing을 달성하였다고 얘기한다.
또한, Efficiency를 더욱 증진하고자
3가지로 구성된, Entire Life-Cycle에서,
그간 LLM에서 활발히 적용되어오던,
기법 등을 적극적으로 적용하였다.
이에


NVILA-8B,
상대적으로 적은 Paramter를 가지고, 다수의 Visual-Reasoning Benchmark에서,
LLaMA 3.2, LLaVA-1.5, LLaVA-OV 등을 포함한 Open-Source Model 중 SOTA 달성.
NVILA-15B, LLaMA 3.2, GPT-4o, Gemini 1.5 Pro 등의 Proprietary Models와 비교하였을 때,
Competitive or Even-Better
특히, High Resolution Capability에 따라, 8B 모델 또한 OCR Benchmark에서 매우 우수한 성능
(TextVQA, ChartQA, DocVQA, InfoVQA)


유사한 크기의 Open-Source Models (LLaVA-NeXT-Video, Qwen2-VL) 와 견주었을 때
SOTA across all benchmarks
8B Paramater만을 사용하긴 했으나, GPT-4o와 견주었을 때는, 다소 부족.
-> 동영상에서 추출된 각 이미지 프레임에, Discrete Time Token을 추가함으로써,
-> 동영상 내에서, 각 이미지의 시간 정보를 확인할 수 있게함에 따라,
-> 동영상 내에서, 특정한 장면이 나오는 시점을 추출할 수 있음
NVILA's Long-Temporal-Resolution 에 따른 이점

"Temporal Reasoning of LITA" (논문 출처: https://arxiv.org/abs/2403.19046)
-> Robotic Agent'S LiDAR Sensor, Camera를 통해 인지된 Visual Observation과 사용자의 Language Instruction에 기반
-> Real-World의 특정 환경의 특정 시점에서의 Action Sequence를 정해나감.
NVILA's High-Spatial-Resolution, Long-Temporal-Resolution 에 따른 이점
Inference Efficiency에 따른 이점 (RTX-4090 GPU 상에서 NVILA-8B Model 구동)

-> Image Segmentation, Classification 같이, Specific Medical Tasks에 특화된 Domain-Expert Models를 NVILA와 결합한 NVILA-M3 Framework
-> Medical Benchmark SOTA 달성 (9%성능 증진)
-> General VLM의 경우, Tumor Segmentation, Tumor Classification, Detail Identification 등의 작업에 뒤떨어짐.
-> But, Task-Specific-Expert-Model's Outcomes를 VLM의 Input으로 넣어주는 파이프라인을 설게함으로써,
-> Generalized LLM capabilty와 Specialized domain expertise를 적절히 융합.
-> Healthcare와 같이, Precision, Specificity가 중요한 분야에서의, VLM's Potential 증명

이와 관련된 코드와 모델은 모두 공개된 상태이다.
Code: https://github.com/NVlabs/VILA
Models: https://huggingface.co/collections/Efficient-Large-Model/nvila-674f8163543890b35a91b428

"Multi-Image-Reasoning of NVILA" (논문 출처: https://arxiv.org/abs/2412.04468)

"OCR of NVILA" (논문 출처: https://arxiv.org/abs/2412.04468)

"Visual-Reasoning of NVILA" (논문 출처: https://arxiv.org/abs/2412.04468)

"Video-Reasoning of NVILA (1)" (논문 출처: https://arxiv.org/abs/2412.04468)

"Video-Reasoning of NVILA (2)" (논문 출처: https://arxiv.org/abs/2412.04468)

"NVILA Architecture" (논문 출처: https://arxiv.org/abs/2412.04468)
NVILA Architecture는 VILA Architecture 에 기반하여 설계됨에 따라, 일반적인 VLM의 구조를 가진다.
Visual Encoder:
Image, Video 등의 Visual Input으로부터 시각적 특징 추출
NVILA Vision Encoder: SigLIP
SigLIP (논문: https://arxiv.org/abs/2303.15343) :
-- Sigmoid loss function 기반 Languange Image Pretraining Model
-- CLIP Image Encoder와 같이, Vision Transformer 아키텍처 기반
-- CLIP과의 차이점: Loss function으로 Softmax 대신 Sigmoid 함수 활용
Vision -> Language Projector:
Visual Embedding을 Text (Multi-Modal) Embedding으로 변환
NVILA Projector: Two-Layer MLP
Two-Layer MLP:
First Introduced in LLaVA-1.5 (논문: https://arxiv.org/abs/2310.03744)
Simple but Effective compared to Highly Learanble Projectors like "Q-Former" introduced in BLIP2.
Token Processor (i.e, LLM Language Decoder)
Aligned Multi-Modal Embedding (Visual, Textual)을 입력으로 받아서
Output Language Tokens (i.e, Text Response) 생성
NVILA Token Processor: Qwen2
Qwen2 (논문: https://arxiv.org/pdf/2407.10671)
Limited Spatial Resolution
Input Image's (Size, Aspect-Ratio) 와 관계 없이,
모든 Image를 448×448로 Resizing
Limited Temporal Resolution
Only Samples up to 14 frames
이에, High Resolution Image와 Longer Video 를 처리하는데 있어, Information Loss 발생
-> Text-Heavy benchmark, Long-Video benchmark 등에서의 성능이 뒤떨어짐
이에, Input (Image / Video) 로부터 Detail과 Context를 더욱 보존하고자
Scale-then-Compress:
First, "Scale" up the spatial/temporal resolution -> For Accuracy
Second, "Compress" the visual token -> For Efficiency
해당 전략은
1. Image input에 대해서는, Spatial "Scale then compress"
2. Video input에 대해서는, Temporal "Scale then compress"
2가지로서 적용됨.
Image로부터 Detailed Feature를 추출하기 위해, 가장 직관적으로는
단순히 Vision Encoder (i.e, ViT based SigLIP image Encoder)가 획일적으로 High-Resolution Input을 받게끔
아키텍처를 수정한 이후, 896×896 등의 High Resolution Image에 대해서 Pre-Training을 적용할 수 있지만,
이는 Extensive Detail을 요구하지 않는 Smaller Image까지 High Resolution으로 처리한다는 'Inefficiency' 존재!
따라서, NVILA는 Multi-Scale High-Resolution Feature 를 추출하고자 " Method" 적용
-- Vision Encoder (SigLIP) pre-trained at **
-- Input Image with arbitrary size**
1. Resize the image into multiple scales (e.g., , ,),
2. For each scale, Split the image into tiles of
3. Visual Encoder (SigLIP) individually processes Each tile.
4. The feature maps of each tile from the same scale image are stitched back together
5. Feature maps from different scales are interpolated into the same size
6. Concatenated on the channel dimension
Dynamic
의 경우, Input Image의 Original Aspect Ratio와 관계 없이, 모두 Square로 Resizing함에 따라
"Tall-and-Narrow", "Short-and-Wide" 등의 이미지에 대해서는 정보의 왜곡 발생.
따라서, Dynamic 의 경우, Original Aspect Ratio를 최대한 유지하면서, 의 Tiles로 divisible한 Image Size 로 Resizing!
(e.g, Original Aspect Ratio가 3:2라면, "1344 x 896" 등의 Rectangle High-Resolution-Images로 Resizing)--> Arbitrary sized Image에 대해서, 정보 손실을 최소화하며 Spatial "Scale-then-Compress" 적용
--> Text-Heavy VLM Benchmark에서 30%의 Accuracy Improvement
High Resolution Spatial Token으로 Scaling만을 적용할 경우, Accuracy는 상승하지만,
Self-Attention 과정에서 Computational Cost가 Quadratic하게 증가하기에,
Efficiency를 위해 핵심 토큰만을 남김으로써, Information-Density를 높이는 "Compressing" 필요!Original VILA의 경우, 2×2 spatial-to-channel (STC) reshape 적용 (,,) -> (, , )
However, More Aggressive Resolution Reduction (i.e, 3x3 STC)을 적용할 경우, MLP Projector에 대한 학습이 어려워짐
--> 이에 Visual-Encoder(SigLIP)와 MLP-Projector에 대한 Joint-Pre-Training 추가
--> Visual Token에 대한 Aggressive Resolution Reduction이 가능해짐
--> 2.4× speedup in both Training and Inference
--> Efficiency Improvement
물론, Simple STC 외에도, Learanable한 Token Resampler (i.e, Perceiver Resampler from MINICPM-V) 존재.
But, Optimization Problem으로 인해, 성능이 좋지 않고, 늘어난 연산량으로 인해 Efficiency 또한 좋지 않음.
Simple But Powerful STC Compression!
(MLP Projector, Tile Division 과 같은 맥락)
--> Effectiveness of "Scale-then-Compress" on Image Understanding
LongVILA (논문: https://arxiv.org/abs/2408.10188)의 Method를 따라
단순히, 각 Input Video로부터 획일적으로 더 많은 Frame을 Sampling하는 방식8 Frames -> 32 Frames
Input Video로부터 더 많은 Frame을 추출한 이후,
NVILA 모델을 이에 맞게 Supervised-Fine-Tuning함에 따라, Long Video의 Context를 더욱 잘 반영Video-MME Benchmark에서 5% 이상의 Accuracy Improvment
Intrinsic Temporal-Continuity of Video
--> Temporal Averageing 을 취함.
- Partition the frames into groups
- Temporally pool the visual tokens within each group
--> Reduce Temporal Redundancy (Since consecutive frames often contain similar information)
--> Retain important spatio-temporal information
Empiraclly, compressing the visual tokens by 4 x, leads to an acceptable accuracy drop (Hyperparamter)
Further Scaling
-- Number of Frames (i.e, to 256)
-- Compression Ratio (i.e, to 8 x)
leads to a SOTA on certain Video Benchmarks (compared to 7B Models)--> Effectiveness of "Scale-then-Compress" on Video Understanding
기존 대부분의 VLM 연구에서는, High Quality SFT Dataset을 Large Scale로 활용하나
1. 모든 SFT Data가 모델의 학습에 효과적으로 기여하지는 않고
2. Dataset의 Scale이 커질수록, redundancy 또한 커질 수 있음따라서, NVILA는 Dataset에 대해서도 "Scale-then-Compress" 전략을 취함
First, Increase SFT Dataset mixture
Second, Compress the dataset
이때, Scaled 100M Mixture dataset에 대해서, Pruning을 적용함에 있어
Knowledge distillation을 기반으로, 각 Training-Data에 점수를 부여하고,
높은 점수의 Training Data만을 Sampling하는 Delta-Loss Pruning 적용.
Delta-Loss
Motivation: Filter out examples that are either too easy or too hard
: Pruned Dataset
: subset of SFT dataset
: Large Model's output probability on answer tokens
: Small Model's output probability on answer tokens
의 경우,
- Large Model과 Small Model이 모두 Correctly 혹은 모두 Wronly 응답할 경우,
Close to 0- Small Model은 Correctly 응답, but Large Model은 Wrongly 응답할 경우,
Becomes Negative- Large Model은 Correctly 응답, but Small Model은 Wrongly 응답할 경우,
Becomes Positive
--> 각 Training-Subset에 대해, Top-K-Sampling을 통해 값이 큰 K개를 Pruning
--> Large Model은 성공하지만, Small Model은 실패하는 데이터셋을 위주로 Pruning
--> Large Model이 Capable한 Training-set에 대해, Smaller Model도 Capable하게 만들어줌--> Knowledge Distiallation from Large to Small
Cluster Pruning: SigLIP Visual Embedding에 따라 K-means clustering 적용, 각 Centroid에서 Evenly Pruning
Random Pruning: Simple Random-Sampling--> DeltaLoss consistently outperforms the other pruning methods
--> 50% DeltaLoss Pruning 적용 시, Speed up 2X, competetive accuraacy
--> Effective Balancing between "Efficiency VS Accuracy"
NVILA와 같은 VLM의 경우, Multi-Modal-Input을 처리함에 따라,
-- 수만 개의 Token을 요구하는 Video Input
-- 수백 개의 Token을 요구하는 Image Input
-- 훨씬 적은 Token을 요구하는 Text Input
3가지 서로 다른 Modality를 같은 Model로 처리하는데,
이 경우, Fewer Tokens을 요구하는 Workload가 작은 Modality의 Input Batch에 대해서는,
GPU Utilization이 작기에, Batch Size를 늘리는 것이 Efficiency의 증진으로 쉽게 이어짐.
--> Quantization을 통해 각 Sample을 처리하는데 드는 Computation, Memory 부담을 줄임으로써
--> Batch Size를 늘리는 것이 Efficiency를 효과적으로 증가시킬 것
But, 기존 LLM 연구에서는, Weights, Gradients, Momentum Parameter 등에도
FP8, FP16과 같은 Quantization을 활발히 적용하였으나,
VLM에서는 Quantization이 적극적으로 활용되고 있지 않았음이에 NVILA는 Weights, Activations 등에도 FP8 Quantization을 적극적으로 적용하여, Batch Size를 늘림
--> 2X Speed Up in training!
With the curated configuration setup (with lots of Hyper-Parameter Tuning)
NVILA can be quickly fine-tuned to various downstream tasks under 24 GB memory
with on-par performance.
Visual Encoder (ViT based SigLIP) : W8A8 quantization (W: Weight, A: Activation)
Language Decoder (Qwen2) : W4A16 quantization
--> Reduce Time-To-First-Token (TTFT)
--> Minimizing Accuracy Compromise
- 128 NVIDIA H100 GPUs
- 2048 global batch size
- AdamW with no weight decay
- cosine learning rate decay, a linear warmup for the first 3%
- initial learning rate varies across stages
- Gradient checkpointing to reduce memory usage
- FlashAttention-2 to accelerate training
- On-the-fly sequence packing to fuse samples with different lengths -> 30% speedup
10M Mixture dataset에 대해서, Delta-Loss Pruning 적용 --> 5M subset
- NVILA-8B,
상대적으로 적은 Paramter를 가지고, 다수의 Visual-Reasoning Benchmark에서,
LLaMA 3.2, LLaVA-1.5, LLaVA-OV 등을 포함한 Open-Source Model 중 SOTA 달성.- NVILA-15B,
LLaMA 3.2, GPT-4o, Gemini 1.5 Pro 등의 Proprietary Models와 비교하였을 때,
Competitive or Even-Better
- 유사한 크기의 Open-Source Models (LLaVA-NeXT-Video, Qwen2-VL) 와 견주었을 때
SOTA across all benchmarks- 8B Paramater만을 사용하긴 했으나, GPT-4o와 견주었을 때는, 다소 부족.
NVILA's Superior Inference Efficiency Over Qwen2-VL
NVILA
- A family of Open-Source VLMs
- Resource Efficient
- Matches or Exceeds current leading VLMs
- Optimal Balance between "Efficiency VS Accuracy"
- "Scale-then-Compress"
- Dataset
- Delta-Loss-Pruning (Knowledge Distillation)- Architecture
- Spatially for High-Resolution-Images
- Temporally for Long-Videos- Further enhance Efficiency across entire lifecycle
- Pre-Training (FP8 Quantization -> Batch Size ⬆ -> Pre-Training Speed ⬆)
- Fine-Tuning (PEFT such as LoRA, QLoRA -> Fine-Tuning Speed ⬆, Memory Requirement ⬇)
- Inference (Visual Encoder: W8A8 quantization, Language Decoder: W4A16 quantization -> TTFT ⬇)
- Potential Downstream Taks
- Video Understanding -> Temporal Localization
- Multi-Image Understanding -> Robotic navigation
- Efficient Fine-Tuning -> Specific domains (e.g, Medical imaging)