Fine-Tuning Small Language Models for Realistic Movie Dialogue Generation

Friday 28 March 2025


A team of researchers has made significant strides in fine-tuning a small language model, Qwen 2.5 3B, to generate realistic and engaging movie dialogue. By leveraging the Cornell Movie-Dialog Corpus, a curated dataset of movie conversations, they were able to fine-tune the model using several techniques, including quantization, low-rank adaptation, flash attention, and gradient accumulation.


The researchers’ approach was to start with the 0.5B model and gradually scale up to the 1.5B and 3B versions as computational resources improved. This allowed them to balance preserving context with remaining computationally efficient on available hardware. They also used packing to concatenate short sequences together, preventing wasted GPU resources.


To further fine-tune the model, they employed a technique called direct preference optimization (DPO), which allows language models to be tuned directly on preference data without creating an intermediate reward model. This approach proved effective in reducing low-quality responses while maintaining high-quality ones.


The researchers also developed a web interface for interacting with the model, allowing users to input prompts and receive responses. The interface uses a containerized FastAPI API that performs inference when provided with a prompt, and a Vue-based web UI that enables users to modify key inference parameters like temperature and top-K filtering.


To evaluate the model’s performance, the researchers used a combination of automated evaluation metrics, such as G-Eval, and human evaluation. The results showed consistent improvements across all metrics between the base model and the fine-tuned models, with the DPO model performing particularly well in terms of coherence and consistency.


One of the key challenges facing the team was scaling the model to larger datasets and more powerful hardware. They were able to overcome this by using a combination of GPU optimizations, including quantization and low-rank adaptation, which allowed them to train larger models without significantly increasing computational costs.


The researchers also acknowledged that there are still areas for improvement, such as incorporating more recent movie data and exploring alternative hyperparameter tuning methods. However, their work demonstrates the potential for small language models like Qwen 2.5 to generate high-quality dialogue in a cinematic context.


Overall, this research showcases the capabilities of small language models in generating realistic and engaging movie dialogue, and highlights the importance of fine-tuning these models on large datasets and leveraging advanced techniques like DPO and GPU optimizations.


Cite this article: “Fine-Tuning Small Language Models for Realistic Movie Dialogue Generation”, The Science Archive, 2025.


Language Model, Qwen 2.5, Movie Dialogue, Fine-Tuning, Cornell Movie-Dialog Corpus, Quantization, Low-Rank Adaptation, Flash Attention, Gradient Accumulation, Direct Preference Optimization, Gpu Optimizations.


Reference: Kartik Gupta, “Fine-Tuning Qwen 2.5 3B for Realistic Movie Dialogue Generation” (2025).


Leave a Reply