Getting Started with OpenAI o1 Reasoning Models
Learn how to use the OpenAI o1-preview & o1-mini for decision-making, coding, and building an end-to-end machine learning project from scratch.
Image by Author
While anticipating GPT-5, OpenAI has released an advanced language model that thinks critically before responding, demonstrating intelligence similar to a PhD student. This improved model is a big step forward, providing useful solutions instead of missing instructions or hallucinating.
In this blog, we will learn about OpenAI's o1 reasoning model and what makes it special and noteworthy. Then, we will use ChatGPT to access both the `o1-preview` and `o1-mini` models to solve complex financial problems and build a Julia-based web scraper. Finally, we will work on building an end-to-end machine learning project from data ingestion to model deployment, all using the OpenAI o1-preview model.
Our Top 3 Partner Recommendations
1. Best VPN for Engineers - 3 Months Free - Stay secure online with a free trial
2. Best Project Management Tool for Tech Teams - Boost team efficiency today
4. Best Password Management for Tech Teams - zero-trust and zero-knowledge security
What are OpenAI o1 Reasoning Models?
OpenAI's o1 Reasoning models are designed to think through problems like humans, taking the time to carefully consider them before responding. The o1 models has demonstrated performance comparable to that of PhD students in challenging tasks in physics, chemistry, and biology. Additionally, it has excelled in mathematics and coding, achieving an 83% success rate in an International Mathematics Olympiad qualifier and ranking in the 89th percentile in Codeforces competitions.
Currently, the reasoning model is available in two variants o1-preview and o1-mini. The o1-preview is a reasoning model built to solve difficult problems across various domains, and o1-mini, a faster and more cost-effective reasoning model particularly proficient in coding, mathematics, and science.
These models can be accessed through a ChatGPT Pro subscription and You.com. These are also available through APIs for tier 5 organizations on the OpenAI platform.
Using OpenAI o1 Models in ChatGPT
Every user with a ChatGPT Plus subscription can access the o1 model by changing the language model from the top left drop-down menu.
In this section, we will first try the advanced version of the reasoning model called "o1-preview" to develop a financial plan. Then we will use the faster and smaller version of the model called "o1-mini" to create our own web scraper in the Julia language.
OpenAI o1-preview
Let's use an o1-preview model to help me become a millionaire from a $20,000 savings account. I have also requested that it provide the calculations and step-by-step explanation for determining the time it will take for me to reach a million dollars.
Select “o1-preview” by clicking on the model "drop-down" menu and then typing the following prompt into the message input box.
Prompt: “I have $20,000 in my savings account, where I receive a 4% profit per year and payments twice a year. Can you please tell me how long it will take for me to become a millionaire? Also, can you please explain the math step by step as if you were explaining it to an uneducated person?”
The o1-preview model performed a detailed analysis using mathematical formulas and calculations and provided us with a summary of the results. This type of response is not generated by GPT-4o or any other language model in the market. It is thorough and follows the prompts in the letter.
At step 9, it has provided us with the result that it will take me 98 years to become a millionaire if I solely depend on the savings account.
Result:
Step 9: Interpreting the Result
- Time Required: Approximately 98.73 years.
So, it will take you about 98 years and 9 months for your $20,000 to grow into $1,000,000 at a 4% annual interest rate compounded twice a year.
To view how the o1-preview was thinking to resolve this issue, click the drop-down button on the response.
In our case, clicking "Thought for 22 seconds" shows all the steps the language model takes to generate a response.
GPT-4o Vs o1-preview
Let’s compare it with the GPT-4o model by providing the same prompt.
The GPT-4o model was quite slow in producing the result. In terms of speed, it was almost as slow as o1-preview. There is a huge difference in the strategy of how each model approaches the problem. The o1-preview displayed more details and mathematical formulas and explained it as if it was explaining it to a student, whereas GPT-4o ignored the last part of the prompt and just started working on the solution instead of explaining each step.
OpenAI o1-mini
The o1-mini is fast and can be used for coding problems and simple math problems. We have tasked the o1-mini model with creating a web scraper using Julia and providing it with additional instructions to follow.
Prompt: “Build a web scraper from scratch using the Julia language.
Please make sure you have added docstrings and comments, created multiple files, used inheritance, created unit testing files, and provided documentation on how to use it.”
It took almost 15 seconds for it to generate the response and the thinking period was 2 seconds compared to 22 seconds of the o1-preview model.
I have created a proper project with source files, a unit test file, a readme, and a `project.toml` file. I am impressed with how these models are getting better. I will definitely use it for my coding projects and also to create a structure for my tutorials.
GPT-4o Vs o1-mini
GPT-4o was disappointing. It missed many of the instructions from the prompt and started working on the generic project. The README file has just one heading; all the other files have issues. The usage guide was incomplete. In short, it was a bad attempt. I will code and create documentation myself if I have to use GPT4o for the coding projects.
Building a Machine Learning Project with OpenAI o1-preview Model
This is my favorite part, where I will ask an o1-preview model to build an end-to-end machine learning project for me. The GPT-4o and Claude 3.5 models have failed miserably, as they struggle with the project that has too many instructions and is complex.
In this example, we asked it to create a Reddit moderation application using Python. We provided it with additional instructions, from data ingestion to suggesting free deployment of the inference API.
Prompt: “Create a Python "Reddit Moderation Application" that takes Reddit posts and predicts whether they are harmful to the community.
Please ensure that the following steps are included in the projects:
- Collect the data from the subreddit r/learnmachinelearning using web scraping.
- Process the dataset using Scikit-learn.
- Train the machine learning model on the test dataset from Reddit.
- Save the model and perform model evaluation.
- Create a FastAPI application for model inference.
- Add Jinja templates for creating the user interface.
- Provide instructions for deploying the app to the cloud for free.”
As we can see, it is making a decision on where to scrape the website or use the Reddit data ingestion tool. Just like a human, it contemplates whether the tool is feasible for the project.
We have received all the code files and instructions on how to assemble them for processing, training, and building the API. It even provided us with instructions on how to deploy the application for free using the Railway app.
Before I try the code myself, let's ask ChatGPT to test it for us.
We received a message saying that it cannot execute the code.
I think, for now, the o1 models are in beta. Over time, OpenAI will introduce a Python interpreter capable of using CSV files, images, audio data, and more. Right now, it is just a text generation model that can think like a scholar or a professional.
Final Thoughts
The o1 reasoning models has proven to be a game-changer in the world of artificial intelligence. Besides ChatGPT, I have been using the o1-preview model on You.com and it's been smooth. I love it. The model is fast and provides a detailed map of how you can resolve complex problems or build your own data science project.
Screenshot from You.com
The demand for prompt engineers will rise again as we now only need to focus on instruction, and the o1 model will help us resolve any issues in the workspace.
In this blog, we have explored the unique features of the o1 models and highlighted its advantages over previous versions like GPT-4o. This evolution clearly points towards a future where AI-powered solutions are more intuitive and impactful.
Abid Ali Awan (@1abidaliawan) is a certified data scientist professional who loves building machine learning models. Currently, he is focusing on content creation and writing technical blogs on machine learning and data science technologies. Abid holds a Master's degree in technology management and a bachelor's degree in telecommunication engineering. His vision is to build an AI product using a graph neural network for students struggling with mental illness.