CoolFace
Modelpublic

xl-zhao/PromptCoT-Problem-Generation-Model

sourceHugging Facemitupdated 2y agoView on Hugging Face
1likes11downloads
README.md123 linesDownload Raw Back to root
1---2license: mit3datasets:4- xl-zhao/PromptCoT-Problem-Generation-Dataset5language:6- en7base_model:8- meta-llama/Llama-3.1-8B9---10# **PromptCoT: Synthesizing Olympiad-Level Problems for Mathematical Reasoning in Large Language Modelsg**  11 12[![ArXiv](https://img.shields.io/badge/arXiv-2503.02324-red)](http://arxiv.org/abs/2503.02324)  13[![GitHub](https://img.shields.io/badge/GitHub-PromptCoT-blue)](https://github.com/zhaoxlpku/PromptCoT)  14 15---16 17## ๐Ÿš€ **Overview**  18The **PromptCoT Problem Generation Model** is a lightweight yet powerful model for synthesizing high-quality Olympiad-level mathematical problems. It enables the scalable construction of problem sets to facilitate post-training tasks such as **Supervised Fine-Tuning (SFT) and Reinforcement Learning (RL)**. By systematically modeling expert problem design, PromptCoT helps generate logically consistent and intellectually demanding problems at scale.19 20For more details, refer to our **paper on ArXiv**: [๐Ÿ”— PromptCoT: Synthesizing Olympiad-Level Problems for Mathematical Reasoning in Large Language Models](http://arxiv.org/abs/2503.02324).  21 22---23 24## ๐Ÿ”ฅ **Quick Start: Using the Model**  25 26### **1๏ธโƒฃ Install Dependencies**  27```bash28pip install transformers vllm torch accelerate29```30 31### **2๏ธโƒฃ Load the Model with Hugging Face Transformers**  32You can use the model for **direct inference** using Hugging Faceโ€™s `generate` API:  33```python34from transformers import AutoModelForCausalLM, AutoTokenizer35 36model_name = "xl-zhao/PromptCoT-Problem-Generation-Model"37tokenizer = AutoTokenizer.from_pretrained(model_name)38model = AutoModelForCausalLM.from_pretrained(model_name).to("cuda")39 40foundational_concepts = [41    "Ability to apply quantitative reasoning and estimation techniques to solve problems, including making approximations and using logical deductions to arrive at a solution.",42    "Ability to solve equations involving complex numbers, including finding conditions under which two complex numbers are equal, particularly in the context of their magnitudes and arguments.",43    "Fractional arithmetic: Performing calculations with fractions to determine the final probability.",44    "Interpreting and solving problems involving nested operations or functions.",45    "Using logical reasoning to connect given data points and derive conclusions."46]47 48difficulty_level = "HMMT-Feb"49 50prompt = (51    "Given foundational concepts and difficulty level, identify connections and develop a question "52    "that integrates these concepts with appropriate complexity.\n\n"53    "Foundational Concepts:\n"54    + "\n".join(f"{i+1}. {concept}" for i, concept in enumerate(foundational_concepts))55    + f"\n\nDifficulty Level: {difficulty_level}"56)57 58inputs = tokenizer(prompt, return_tensors="pt").to("cuda")59 60with torch.no_grad():61    output = model.generate(**inputs, max_length=4096, temperature=0.6)62 63generated_problem = tokenizer.decode(output[0], skip_special_tokens=True)64print(generated_problem)65```66 67---68 69## โšก **Using vLLM for Fast Inference**  70For optimized inference, use `vLLM`:  71```python72from vllm import LLM, SamplingParams73 74model_name = "xl-zhao/PromptCoT-Problem-Generation-Model"75llm = LLM(model=model_name, tensor_parallel_size=1)76 77foundational_concepts = [78    "Ability to apply quantitative reasoning and estimation techniques to solve problems, including making approximations and using logical deductions to arrive at a solution.",79    "Ability to solve equations involving complex numbers, including finding conditions under which two complex numbers are equal, particularly in the context of their magnitudes and arguments.",80    "Fractional arithmetic: Performing calculations with fractions to determine the final probability.",81    "Interpreting and solving problems involving nested operations or functions.",82    "Using logical reasoning to connect given data points and derive conclusions."83]84 85difficulty_level = "HMMT-Feb"86 87prompt = (88    "Given foundational concepts and difficulty level, identify connections and develop a question "89    "that integrates these concepts with appropriate complexity.\n\n"90    "Foundational Concepts:\n"91    + "\n".join(f"{i+1}. {concept}" for i, concept in enumerate(foundational_concepts))92    + f"\n\nDifficulty Level: {difficulty_level}"93)94 95sampling_params = SamplingParams(temperature=0.6, max_tokens=4096)96outputs = llm.generate([prompt], sampling_params)97 98print(outputs[0].outputs[0].text)99```100 101---102 103## ๐Ÿ”— **Full Usage & Advanced Options**  104For advanced usage, including **batch inference and rejection sampling for filtering high-quality problems**, refer to the **full repository on GitHub**:  105๐Ÿ”น [GitHub: PromptCoT](https://github.com/zhaoxlpku/PromptCoT)  106 107---108 109## ๐Ÿ“œ **Citation**  110If you use **PromptCoT**, please consider citing:  111```112@article{zhao2025promptcot,113  author    = {Zhao, Xueliang and Wu, Wei and Guan, Jian and Kong, Lingpeng},114  title     = {PromptCoT: Synthesizing Olympiad-Level Problems for Mathematical Reasoning in Large Language Models},115  year      = {2025},116  journal   = {arXiv preprint arXiv:2503.02324},117  url       = {http://arxiv.org/abs/2503.02324}118}119```120 121 122 123