Qwen is the large language model and large multimodal model series of the Qwen Team, Alibaba Group. Both language models and multimodal models are pretrained on large-scale multilingual and multimodal data and post-trained on quality data for aligning to human preferences. Qwen is capable of natural language understanding, text generation, vision understanding, audio understanding, tool use, role play, playing as AI agent, etc.
Unlike Qwen2-Math series which only supports using Chain-of-Thught (CoT) to solve English math problems, Qwen2.5-Math series is expanded to support using both CoT and Tool-integrated Reasoning (TIR) to solve math problems in both Chinese and English. The Qwen2.5-Math series models have achieved significant performance improvements compared to the Qwen2-Math series models on the Chinese and English mathematics benchmarks with CoT.
While CoT plays a vital role in enhancing the reasoning capabilities of LLMs, it faces challenges in achieving computational accuracy and handling complex mathematical or algorithmic reasoning tasks, such as finding the roots of a quadratic equation or computing the eigenvalues of a matrix. TIR can further improve the model's proficiency in precise computation, symbolic manipulation, and algorithmic manipulation.
pip install -U -q keras-hub
pip install -U -q keras
Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instructions on installing them in another environment see the Keras Getting Started page.
Presets
The following model checkpoints are provided by the Keras team. Full code examples for each are available below.
Preset name
Parameters
Description
qwen2.5_math_1.5b_en
1.5B
28-layer Qwen model with 1.5 billion parameters.
qwen2.5_math_instruct_1.5b_en
1.5B
28-layer Qwen model with 1.5 billion parameters. Instruction tuned.
qwen2.5_math_7b_en
7B
28-layer Qwen model with 7 billion parameters.
qwen2.5_math_instruct_7b_en
7B
28-layer Qwen model with 7 billion parameters. Instruction tuned.
Example Usage
Python
12import keras
3import keras_hub
4import numpy as np
56# Use generate() to do code generation.
7qwen_lm = keras_hub.models.QwenCausalLM.from_preset("qwen2.5_math_7b_en")
8qwen_lm.generate(" Find the value of x that satisfies the equation 4x+5 = 6x+7.", max_length=300)
910
Example Usage with Hugging Face URI
Python
12import keras
3import keras_hub
4import numpy as np
56# Use generate() to do code generation.
7qwen_lm = keras_hub.models.QwenCausalLM.from_preset("hf://keras/qwen2.5_math_7b_en")
8qwen_lm.generate(" Find the value of x that satisfies the equation 4x+5 = 6x+7.", max_length=300)
910