Text Generation
Transformers
Safetensors
English
qwen2
text-generation-inference
Code
Reinforcement learning (RL)
Math
conversational
Instructions to use prithivMLmods/Diophantus-14B-R1-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/Diophantus-14B-R1-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="prithivMLmods/Diophantus-14B-R1-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/Diophantus-14B-R1-Instruct") model = AutoModelForCausalLM.from_pretrained("prithivMLmods/Diophantus-14B-R1-Instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use prithivMLmods/Diophantus-14B-R1-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/Diophantus-14B-R1-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Diophantus-14B-R1-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prithivMLmods/Diophantus-14B-R1-Instruct
- SGLang
How to use prithivMLmods/Diophantus-14B-R1-Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "prithivMLmods/Diophantus-14B-R1-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Diophantus-14B-R1-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "prithivMLmods/Diophantus-14B-R1-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Diophantus-14B-R1-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use prithivMLmods/Diophantus-14B-R1-Instruct with Docker Model Runner:
docker model run hf.co/prithivMLmods/Diophantus-14B-R1-Instruct
| license: apache-2.0 | |
| language: | |
| - en | |
| base_model: | |
| - Qwen/Qwen2.5-14B-Instruct-1M | |
| pipeline_tag: text-generation | |
| library_name: transformers | |
| tags: | |
| - text-generation-inference | |
| - Code | |
| - Reinforcement learning (RL) | |
| - Math | |
|  | |
| # **Diophantus-14B-R1-Instruct** | |
| > **Diophantus-14B-R1-Instruct** is based on the Qwen 2.5 14B modality architecture, designed to optimize performance for mathematical reasoning, general-purpose problem solving, and robust policy optimization using distributed reinforcement learning (RL). This model excels in contextual understanding, logical deduction, multi-step reasoning, and optimization-based tasks. It has been fine-tuned using long chain-of-thought datasets, optimization problem-solving corpora, and structured reasoning datasets to improve comprehension, structured responses, and intelligent decision-making. | |
| ## **Key Improvements** | |
| 1. **Advanced Mathematical and Logical Reasoning**: | |
| Enhanced capabilities for solving complex equations, optimization tasks, symbolic computation, theorem proving, and step-by-step math problem-solving. | |
| 2. **Robust Policy Optimization**: | |
| Fine-tuned for distributed reinforcement learning (RL) tasks, improving decision-making robustness and solution generalization across complex optimization problems. | |
| 3. **General Knowledge and Problem Solving**: | |
| Strong foundation across diverse domains, excelling in answering factual questions and executing structured multi-step reasoning processes. | |
| 4. **Instruction Following and Adaptability**: | |
| Improved performance in understanding complex instructions and adapting to diverse prompts, maintaining coherence across extended conversations. | |
| 5. **Long-Context Understanding**: | |
| Supports up to 128K tokens for input, and can generate up to 8K tokens, ideal for deep, multi-turn dialogues, mathematical derivations, and long-chain logical reasoning. | |
| 6. **Coding and Algorithmic Mastery**: | |
| Excels in code generation, debugging, algorithm design, refactoring, and analysis across multiple programming languages, with a special focus on optimization algorithms. | |
| ## **Quickstart with transformers** | |
| Here's how to load and use the model with the `transformers` library and `apply_chat_template`: | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_name = "prithivMLmods/Diophantus-14B-R1-Instruct" | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_name, | |
| torch_dtype="auto", | |
| device_map="auto" | |
| ) | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| prompt = "Explain the key techniques used in robust policy optimization." | |
| messages = [ | |
| {"role": "system", "content": "You are an expert assistant in optimization, reinforcement learning, and general-purpose reasoning."}, | |
| {"role": "user", "content": prompt} | |
| ] | |
| text = tokenizer.apply_chat_template( | |
| messages, | |
| tokenize=False, | |
| add_generation_prompt=True | |
| ) | |
| model_inputs = tokenizer([text], return_tensors="pt").to(model.device) | |
| generated_ids = model.generate( | |
| **model_inputs, | |
| max_new_tokens=512 | |
| ) | |
| generated_ids = [ | |
| output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids) | |
| ] | |
| response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0] | |
| ``` | |
| ## **Intended Use** | |
| 1. **Optimization Problem Solving**: | |
| Specialized for solving and explaining general optimization problems, including convex, non-convex, and combinatorial optimization. | |
| 2. **Mathematical and Logical Reasoning**: | |
| Excels at solving equations, mathematical proofs, symbolic manipulations, and structured logical reasoning. | |
| 3. **Reinforcement Learning Applications**: | |
| Useful for designing, analyzing, and explaining RL algorithms, particularly robust and distributed RL. | |
| 4. **Educational and Research Assistance**: | |
| Suitable for providing detailed explanations, mathematical derivations, and research-oriented insights for students, educators, and researchers. | |
| 5. **Coding and Algorithm Development**: | |
| Ideal for writing, improving, debugging, and explaining code, with a strong emphasis on optimization algorithms and computational logic. | |
| 6. **Conversational AI and Chatbots**: | |
| Supports intelligent, context-aware dialogue generation for technical domains, education, and professional assistance. | |
| 7. **Long-Form Technical Content Generation**: | |
| Capable of producing extensive, coherent articles, reports, and tutorials, especially for technical and mathematical content. | |
| 8. **Structured Data Processing**: | |
| Analyzes and generates structured outputs such as JSON, tables, and formal proofs, beneficial for data science and automation. | |
| ## **Limitations** | |
| 1. **High Hardware Requirements**: | |
| Requires substantial memory and high-performance GPUs or TPUs due to large parameter size and long-context processing. | |
| 2. **Potential Training Biases**: | |
| May reflect biases present in optimization-specific datasets or mathematical corpora. | |
| 3. **Creative Generation Limitations**: | |
| Less optimized for freeform creative writing or storytelling compared to technical reasoning. | |
| 4. **No Real-Time Awareness**: | |
| Lacks knowledge of real-world events or developments post-training cutoff. | |
| 5. **Error Propagation in Long-Chain Tasks**: | |
| Small early errors in long mathematical or optimization tasks may propagate in extended outputs. | |
| 6. **Prompt Sensitivity**: | |
| The quality of outputs can be sensitive to prompt clarity and structure, especially for complex optimization or technical questions. |