LWM (Large World Model) is a general-purpose large-context multimodal autoregressive model aimed at improving AI's understanding of world knowledge by jointly modeling text and video. The project is open-sourced on GitHub and includes code, models, and paper links.
Purpose: LWM is mainly used to process long-sequence multimodal data, including understanding and generation of language, images, and video. It can perform high-accuracy fact retrieval across a 1M-token context, answer questions about YouTube videos longer than 1 hour, converse with images, and generate video and images from text.
Main capabilities:
- Supports models with context lengths from 32K, 128K, 256K to 1M tokens.
- Provides pure language models (LWM-Text, LWM-Text-Chat) and video-language models (LWM, LWM-Chat).
- Vision-language models are provided only in the Jax version, while pure language models are provided in both PyTorch and Jax versions.
- Uses RingAttention technology to achieve efficient training on long sequences, supporting techniques such as masked sequence packing and loss weighting.
- Highly optimized on TPU (using Jax's Pallas), and based on XLA on GPU but with a lower degree of optimization.
Usage:
- The codebase supports Ubuntu and has not been tested on Windows or macOS. TPU is recommended for training and inference, and GPU can also be used.
- After installing dependencies, training, evaluation, and sampling tasks can be executed by running the provided bash scripts, for example: bash scripts/run_train_text.sh (language model training), bash scripts/run_train_vision_text.sh (vision-language model training), bash scripts/run_eval_needle.sh (single-needle evaluation), bash scripts/run_sample_image.sh (image sampling), bash scripts/run_sample_video.sh (video sampling), bash scripts/run_vision_chat.sh (image/video understanding).
- The mesh_dim parameter can be used to control the degree of data parallelism, fully sharded data parallelism, tensor parallelism, and sequence parallelism, for example mesh_dim='1,64,4,1'.
- For PyTorch models, only inference for text and text chat models is supported, and they can be loaded as Hugging Face LlamaForCausalLM models, and run python scripts/sample_pyt.py for sampling.
- When Needle Haystack data needs to be generated, run python scripts/create_needle_data.py.
Applicable scenarios:
- Long document understanding and retrieval (text exceeding 1M tokens).
- Long video question answering (such as YouTube videos longer than 1 hour).
- Image conversation and understanding.
- Text-to-image/video generation.
- Multimodal long-sequence research.
Limitations:
- The codebase is supported only on Ubuntu and has not been tested on Windows or macOS.
- Vision-language models are provided only in the Jax version, and PyTorch supports only text model inference.
- TPU is recommended for training and inference, and the degree of optimization on GPU is lower.
- The models use the Llama-2 license, and the code uses the Apache 2.0 license.
- Specific performance metrics, charging information, prices, etc. are not provided in the materials.