Skip to main content
You can also check this cookbook in colab here
CAMEL HomepageJoin Discord
⭐ Star us on GitHub, join our Discord, or follow us on X
This notebook provides a comprehensive guide on configuring and utilizing CAMEL’s data distillation pipeline to generate high-quality mathematical reasoning datasets featuring detailed thought processes (Long Chain-of-Thought data). In this notebook, you’ll explore:
  • CAMEL: A powerful multi-agent framework that enables synthetic data generation and multi-agent role-playing scenarios, enabling advanced AI-driven applications.
  • Data distillation pipeline: A systematic approach for extracting and refining high-quality reasoning datasets with detailed thought processes from models like DeepSeek R1.
  • Hugging Face Integration: A streamlined process for uploading and sharing distilled datasets on the Hugging Face platform.
Through the use of our synthetic data generation pipeline, CAEML-AI has crafted three comprehensive datasets that are now available to enhance your mathematical reasoning and problem-solving skills. These datasets are hosted on Hugging Face for easy access:
  • πŸ“š AMC AIME STaR Dataset A dataset of 4K advanced mathematical problems and solutions, distilled with improvement history showing how the solution was iteratively refined. πŸ”— Explore the Dataset
  • πŸ“š AMC AIME Distilled Dataset A dataset of 4K advanced mathematical problems and solutions, distilled with clear step-by-step solutions. πŸ”— Explore the Dataset
  • πŸ“š GSM8K Distilled Dataset A dataset of 7K high quality linguistically diverse grade school math word problems and solutions, distilled with clear step-by-step solutions. πŸ”— Explore the Dataset
Perfect for those eager to explore AI-driven problem-solving or dive deep into mathematical reasoning! πŸš€βœ¨ di v2.png

πŸ“¦ Installation

Firstly, we need to install the camel-ai package for datagen pipeline

πŸ”‘ Setting Up API Keys

Let’s set the FIREWORKS_API_KEY or DEEPSEEK_API_KEY that will be used to distill the maths reasoning data with thought process. ⭐ NOTE: You could also use other model provider like Together AI, SilionFlow
Alternatively, if running on Colab, you could save your API keys and tokens as Colab Secrets, and use them across notebooks. To do so, comment out the above manual API key prompt code block(s), and uncomment the following codeblock. ⚠️ Don’t forget granting access to the API key you would be using to the current notebook.

πŸ“₯ Download Dataset from Hugging Face and Convert to the Desired Format

Now, lets start to prepare the original maths data from Hugging Face ,which mainly have two important key: questions and answers. We will use GSM8K as example. After we download these datasets, we will convert these datasets to the desired format which suitable to be used in CAMEL’s data distillation pipeline.
Cool! Now you have already got some desired format example data,lets move to start to distill some maths reasoning data with thought process.

πŸš€ Begin Distilling Mathematical Reasoning Data with Thought Process (Long CoT Data).

Import required libraries:
Next, let’s set up the reasoning model and evaluate model. Since the DeepSeek’s API service is currently unstable, we will also set DeepSeek R1 served by Fireworks. CAMEL’s model manager to automatically switch models based on the success of the request.
Now we can start to execute CAMEL’s STaRPipeline, pay attention to the parameters setting like problems_path, output_path, max_iterations, rationalization. Some code is commented out since it’s optional.
Let’s take a look at generated reasoning data!

πŸ“€ Upload the Data to Hugging Face

After we’ve distilled the desired data, let’s upload it to Hugging Face and share it with more people! Define the dataset upload pipeline, including steps like creating records, generating a dataset card, and other necessary tasks.

πŸ”‘ Config Access Token of Hugging Face and Upload the Data

You can go to here to get API Key from Hugging Face, also make sure you have opened the write access to repository. Screenshot 2025-02-01 at 07.06.07.png Then create a New Dataset in Hugging Face: Screenshot 2025-02-01 at 07.17.57.png

πŸ“Š Final Uploaded Data Preview

Screenshot 2025-02-02 at 12.46.48.png

🌟 Highlights

  • High-Quality Synthetic Data Generation: CAMEL’s pipeline distills mathematical reasoning datasets with detailed step-by-step solutions, ideal for synthetic data generation.
  • Public Datasets: Includes the AMC AIME STaR, AMC AIME Distilled, and GSM8K Distilled Datasets, providing diverse problems and reasoning solutions across various math topics.
  • Hugging Face Integration: Easily share and access datasets on Hugging Face for collaborative research and development.
  • Customizable & Scalable: Supports parallel processing, customizable agents, and reward models for efficient, large-scale data generation.
That’s everything: Got questions about 🐫 CAMEL-AI? Join us on Discord! Whether you want to share feedback, explore the latest in multi-agent systems, get support, or connect with others on exciting projects, we’d love to have you in the community! 🀝 Check out some of our other work:
  1. 🐫 Creating Your First CAMEL Agent free Colab
  2. Graph RAG Cookbook free Colab
  3. πŸ§‘β€βš–οΈ Create A Hackathon Judge Committee with Workforce free Colab
  4. πŸ”₯ 3 ways to ingest data from websites with Firecrawl & CAMEL free Colab
  5. πŸ¦₯ Agentic SFT Data Generation with CAMEL and Mistral Models, Fine-Tuned with Unsloth free Colab
Thanks from everyone at 🐫 CAMEL-AI
CAMEL HomepageJoin Discord
⭐ Star us on GitHub, join our Discord, or follow us on X