<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zhangjunlin on Medium]]></title>
        <description><![CDATA[Stories by Zhangjunlin on Medium]]></description>
        <link>https://medium.com/@zhangjunlin2015?source=rss-c53ce4c021e1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_GiFRqnwhFXRL9o_S-3s_w.jpeg</url>
            <title>Stories by Zhangjunlin on Medium</title>
            <link>https://medium.com/@zhangjunlin2015?source=rss-c53ce4c021e1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:06:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zhangjunlin2015/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Does Grok 3 imply that the law of large models, which states that more power leads to miracles…]]></title>
            <link>https://medium.com/@zhangjunlin2015/does-grok-3-imply-that-the-law-of-large-models-which-states-that-more-power-leads-to-miracles-953f9855f78f?source=rss-c53ce4c021e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/953f9855f78f</guid>
            <category><![CDATA[grok-3]]></category>
            <category><![CDATA[deepseek]]></category>
            <category><![CDATA[grok]]></category>
            <category><![CDATA[xai]]></category>
            <dc:creator><![CDATA[Zhangjunlin]]></dc:creator>
            <pubDate>Wed, 19 Feb 2025 11:47:07 GMT</pubDate>
            <atom:updated>2025-02-19T11:47:07.665Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Does Grok 3 imply that the law of large models, which states that more power leads to miracles, still holds?</strong></h3><p>The media’s stance changes too rapidly, leaving people dazzled and confused. In the morning, they were praising Deepseek for its low cost and high cost-effectiveness, claiming that the pre-training Scaling Law was dead, and that there was no need for too many machines or GPU cards. They emphasized cost-effectiveness over everything else, even suggesting that NVIDIA’s market was doomed. However, by noon, with the release of Grok 3, which reportedly used 100,000 NVIDIA H100 cards and outperformed both OpenAI’s o3 mini and Deepseek R1, the narrative shifted again. Suddenly, the Scaling Law was deemed still valid, and the need for a large number of GPU cards was reaffirmed. This led to a resurgence in NVIDIA’s stock prices, and the belief that more power is still the key to achieving miracles.</p><p>These two viewpoints are clearly contradictory; one must be true, and the other false. So, what is the real truth? Let’s delve into it.</p><h3><strong>I. Is the Pre-training Stage Scaling Law Still Valid?</strong></h3><ul><li><strong>Is the Pre-training Stage Scaling Law still valid?</strong> <strong><em>Of course, it is</em></strong>. The so-called “Scaling Law hitting a wall” is generally due to a lack of sufficient data. Without a large influx of new data, the trend of the Pre-training Stage Scaling Law may slow down, but it does not come to a halt. The Pre-training Stage Scaling Law has not reached its ceiling. According to the Chinchilla Scaling Law, even without new data, it does not mean that model performance cannot be improved. Simply increasing the base model size will still enhance performance, although the trade-off between computational power spent and performance gained becomes highly inefficient. This is why people have shifted their focus to RL (Reinforcement Learning) Scaling Law and Test Time Scaling Law. With the same amount of computational power, the intelligence of large models is more significantly improved in these later stages, making them more cost-effective.</li><li><strong>Ranking Scaling methods by cost-effectiveness:</strong> If we rank the methods that can improve model performance by cost-effectiveness, the order would be: Test Time Scaling Law &gt; RL Scaling Law &gt; Pre-training Stage Scaling Law (when data is insufficient and only model size can be increased). Naturally, people prioritize the most cost-effective methods. Just like shopping, no one would choose a less cost-effective option when a more cost-effective one is available.</li><li><strong>What if RL and Test Time Scaling Laws reach their ceilings?</strong> If one day RL Scaling Law and Test Time Scaling Law hit their ceilings and no new, more cost-effective Scaling Laws are found, it does not mean that model performance cannot be improved. People can still revert to the Pre-training Stage Scaling Law. Even without new data, simply increasing the model size will still lead to performance gains. However, this would be the last resort, only adopted when no more cost-effective methods are available. As long as there are more efficient ways, this path will not be chosen.</li><li><strong>A question about GPU resources:</strong> Some may ask, does this mean that hoarding so many GPUs is actually useless for training the best models? According to the above theory, indeed, it may not be necessary. For example, Deepseek could train the best model with just 2,000 cards. However, having more cards has one significant advantage: it can greatly compress the time cycle for experimenting with new ideas and training large model bases. Suppose you need to explore different algorithms, parameters, or data ratios for various experiments. If you have 10 new ideas, with only 2,000 cards, it might take 5 days to draw conclusions. But with tens of thousands of cards, you could get results in just 1 day. Therefore, having more cards is extremely helpful for improving exploration efficiency. More cards lead to more innovation, which is definitely true.</li></ul><h3><strong>II. Grok 3 Base Model (Comparable to Deepseek V3, not R1, which is a reasoning model)</strong></h3><ul><li><strong>Why does Grok 3, as a general base model, only evaluate its performance on math, science, and code datasets?</strong> It is not compared with general capabilities such as the commonly used MMLU metrics. This is an unconventional comparison model. It is inferred that Grok 3’s general capabilities may not have significantly improved compared to OpenAI and Deepseek’s models, which is why it is not included in the comparison?</li><li><strong>Improving math, science, and code capabilities of the base model:</strong> <strong>If we want to enhance the base model’s capabilities in math, science, and code, both in terms of methodology and cost, it is not difficult. The current standard approach is similar to Deepseek V3, which distills long COT (Chain of Thought) data from Deepseek R1. This involves introducing deep thinking process data into the Post-Training stage of the base model or even into the pre-training stage (this is the so-called “large model’s left foot (Deepseek base) stepping on the right foot (Deepseek R1) to elevate itself” model). This can significantly improve the base model’s capabilities in math and code-related areas. This is also the “chain of thought reasoning and self-correction mechanism” that Grok 3 claims to have. The evaluation metrics will look better, and the amount of distilled data will not be too large (a few hundred billion bytes should be enough), with low cost and low computational requirements.</strong></li><li><strong>OpenAI’s upcoming non-logical reasoning model GPT 4.5:</strong> It is likely to follow a similar approach, distilling COT data from the o3 model and using deep thinking data to enhance the intelligence of the GPT 4.5 base model. This “left foot stepping on right foot” method will be the main way to improve base model capabilities in the future.</li><li><strong>Grok 3’s computational power consumption:</strong> Grok 3’s computational power consumption is ten times that of Grok 2. According to the Chinchilla Scaling Law, the best practice would be to increase Grok 3’s training data volume by three times compared to Grok 2, while also increasing the model size by three times. However, the current trend is to reduce model size and increase data volume (the “small model, large data” model). Although this does not meet the optimal training principle, the smaller model size makes it more suitable for online inference services, reducing service costs.</li><li><strong>If Grok 3’s tenfold increase in computational power is true:</strong> There are two possibilities. One is a significant increase in data volume, which can only be achieved by adding a large amount of multimodal data. For example, the data volume could increase from 10T to 30T. Currently, the maximum data volume used by text models is between 18T and 20T. To increase it significantly, multimodal data must be added. However, adding multimodal data does not significantly enhance the intelligence of large models, so this increment should not be too large. If this is the case, Grok 3’s model size would increase by about three times. The second possibility is that the training data volume does not increase much compared to 20T. In this case, it can be inferred that Grok 3’s model size is much larger than Grok 2’s, at least four to five times larger (if the new data is not significant, the only way to consume the additional computational power is to increase the model size). In either case, Grok 3’s model size is definitely much larger than Grok 2’s. Grok 2 itself is not small (the evaluation effect of Grok 2 on its release page exceeds Llama 3.1 405B, so neither the data nor the model size is small. If it is a Dense model, 70B is the minimum estimate). Therefore, Grok 3’s size is likely to be very large (probably between 200B and 500B).</li><li><strong>Grok 3’s approach:</strong> It is clear that Grok 3 is still adopting the “traditional” method of increasing the base model size to enhance the base model’s capabilities, as analyzed in the “Scaling Law” section above. This method is highly inefficient in terms of cost-effectiveness. A more fashionable approach would be to focus training efforts on RL Scaling, which is much more cost-effective. But why would they choose this seemingly unprofitable approach? A possible explanation will be provided later.</li></ul><h3><strong>III. Grok 3 Logical Reasoning Version (Deep Thinking Version, Comparable to Deepseek R1)</strong></h3><ul><li><strong>Grok 3’s deep thinking version:</strong> Without discussing the experience, just looking at the evaluation metrics, it has reached or exceeded o3 mini. It is indeed one of the best-performing models, if not the best.</li><li>Why would Grok 3 still opt for the approach of scaling up model size during the pre-training phase, despite knowing that it is cost-inefficient? The likely underlying reason (though this is inferred without concrete evidence) is that the effectiveness of RL Scaling in the Post-Training phase may be positively correlated with the size of the base model. In other words, given the same computational resources allocated to the RL phase, a larger base model size would yield better scaling effects during RL. Only in this way does it make sense to push for a larger model size during the pre-training phase. We can hypothesize that Grok 3’s choice of this seemingly computationally intensive and cost-inefficient approach is aimed at significantly enhancing the capabilities of the deep-thinking version by enlarging the base model.</li><li>It appears that Deepseek R1 has received widespread acclaim for its excellent performance and open-source nature. However, when people attempt to deploy it in practice, they find that the large base model size leads to high deployment difficulty and significant resource consumption, which is not user-friendly for downstream applications. So, why would Deepseek insist on promoting such a large base model that is clearly not ideal for downstream applications? (Although smaller distilled models seem to have good metrics, their actual application performance appears to be significantly worse.) Could it be because a smaller base model size would compromise the effectiveness of the deep-thinking model?</li><li>If the above hypothesis holds true, it implies that <strong>among the three Scaling Laws (Pre-train, RL, and Test Time), in terms of cost-effectiveness for enhancing the intelligence of large models, the order from highest to lowest is: Test Time &gt; RL &gt; Pre-Train, which was a previous conclusion. However, if the hypothesis is valid, it suggests that the ceiling of Test Time Scaling is the lowest, as it depends on the scaling capability of the RL phase. The ceiling of the RL phase is the second lowest, as it relies on the scaling of the Pre-Train phase.</strong> If this is the case, then when the ceilings of RL and Test Time are reached, we could initiate another round of scaling up the base model size. This would raise the ceiling of the RL phase, allowing us to further scale RL and Test Time, thereby achieving even more intelligent large models. If this holds true, does it mean that the solution for AGI is already complete? In other words, we may not need new Scaling Laws?</li><li>The above reasoning is based on the premise that Grok 3’s decision to scale up the model size at such a high computational cost is the result of careful consideration or small-scale experiments, rather than simply being influenced by the old notion that higher computational power during pre-training always leads to better results. If this premise does not hold, then the above reasoning is invalid. In any case, the responsibility lies with Musk. Over.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=953f9855f78f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The S-Curve of Intelligent Growth: Looking at the Future of Scaling Law through Deepseek R1]]></title>
            <link>https://medium.com/@zhangjunlin2015/the-s-curve-of-intelligent-growth-looking-at-the-future-of-scaling-law-through-deepseek-r1-e40a9ed53656?source=rss-c53ce4c021e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e40a9ed53656</guid>
            <category><![CDATA[deepseek-r1]]></category>
            <category><![CDATA[openai-o1]]></category>
            <category><![CDATA[deepseek]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Zhangjunlin]]></dc:creator>
            <pubDate>Thu, 13 Feb 2025 04:05:21 GMT</pubDate>
            <atom:updated>2025-02-13T04:05:21.559Z</atom:updated>
            <content:encoded><![CDATA[<p>Scaling Law has been, is now, and will continue to be the primary driving force behind the rapid development of large models in the future. I generally use it to make an overall judgment on whether to be pessimistic or optimistic about the future development of large models. <strong>As long as the current Scaling Law still holds, there is actually no reason to be pessimistic about the future development of large models. If one insists on being pessimistic, the probability of being proven wrong is quite high. So, when is the right time to be truly pessimistic about the future development of large models? If one finds that the Scaling Law no longer works, then the probability of being correct in betting against it will be much higher.</strong></p><p>The recent meteoric rise of Deepseek R1 is largely due to its reproduction and open-sourcing of the specific practices of Scaling Law in the two stages of large model post-training and inference, with outstanding model performance. Regarding Scaling Law, I have always had several questions. For example, can the Scaling Law curve grow indefinitely? Another example is, we currently have three types of Scaling Laws (Pre-train, RL, and Test Time). What would the combined Scaling Law look like? There are many such questions.</p><p>In the following part of this article, I plan to use the S-Curve of intelligent growth to explain some of the phenomena we are currently seeing in Scaling Law. In fact, the idea that intelligent development should follow an S-Curve is not new. The biggest opponent of LLMs, Lecun, and the second biggest opponent, Marcus, repeatedly mentioned this view on Twitter last year, using it as an important basis to deny the future development of LLMs. I personally agree that the S-Curve can be used to describe the development of AI intelligence. However, unfortunately, there has been no further in-depth discussion on this topic. Therefore, I plan to connect it with Scaling Law, hoping to have more in-depth thoughts on this subject. Many of these are my own inferences, so please refer to them with caution and consider them as a thought experiment.</p><h3><strong>The S-Curve of AI Intelligence</strong></h3><h4>There is no perpetual growth in the world, only S-Curve growth</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XsIzv09RDJaumFNKbU8RIg.png" /></figure><p>There is no such thing in the world that can grow infinitely (I’m talking to you, Scaling Law). This is essentially a rule. Even when we look at the universe, the largest possible speed cannot exceed the speed of light. No matter how vast the universe is, it still has a boundary, right? So, I think it is highly likely that what appears to be infinite growth is simply because we are looking at it over too short a time frame. The S-shaped growth curve (the nonlinear curve depicted by the Sigmoid function) is probably a more accurate description of growth. I would guess that the trend of AI intelligence growth is probably similar.</p><p>As time progresses (refer to the graph above), in the early stages, AI-related technologies are in the exploration phase, characterized by high uncertainty and slow progress. After a significant technological breakthrough, the technology enters the breakthrough phase, where AI intelligence exhibits exponential growth (the rapid growth stage of the Sigmoid function). Subsequently, it enters the technology maturity phase, where AI intelligence reaches a plateau, with slow or even no growth.</p><p>Suppose we are currently in the rapid growth phase. When we make judgments about the future at this moment, we see a steep curve of intelligence growth and tend to extrapolate this high-speed growth, thinking that AI intelligence will continue to grow exponentially forever, just as it is now. However, the reality is that if we add a short-term future time increment, Δshort-time, AI intelligence does indeed appear to be growing rapidly. But if we extend the time horizon and add Δlong-time, we will see a different picture. The Sigmoid intelligence growth curve enters a plateau phase, meaning that AI intelligence growth will not continue indefinitely. Eventually, it will reach its peak. Of course, this does not mean that AI intelligence will not exceed the average human level, or even reach the super-human level of SGI. These two things are not contradictory.</p><h4>The superposition of S-shaped intelligence curves remains an S-shaped curve</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-p7kYElEa5T0lSnHRuREQ.png" /></figure><p>The Sigmoid function (refer to the formula on the left) has a very interesting property: if we add multiple S-shaped functions together, the resulting curve remains an S-shaped curve, although its range is widened. Referring to the graph above, three Sigmoid functions with different K values (the K value determines the steepness of the rapid growth phase of the Sigmoid function; the smaller the K, the more gradual the slope, and the larger the K, the steeper it is — please remember this point, as we will use it later) are added together, and the resulting curve is still an S-shaped curve. However, its maximum height is extended from 1 to 3 (each Sigmoid function has a range of [0,1], so three of them stacked together give 3 * [0,1] = [0,3]).</p><p>Despite the fact that everyone has been talking about the Scaling Law of large models in the past two years, it is clear that the overall understanding of it is still relatively superficial (including in many academic papers). When you listen to some of the big names in the field, you will find that their views are very casual and clearly not deeply thought out, and some even contain obvious errors (if we take the Chinchilla Scaling Law as the standard answer).</p><p>I have always tried to think about the reasons behind this phenomenon and believe that the key secrets of the Scaling Law in large models may be hidden in the superposition of S-shaped curves like the one shown above (this is my personal view without empirical evidence, so please consider it with caution). Referring to the graph of the superposition of S-shaped curves above, I would like to pose two questions for you to think about:</p><p><strong>Question 1:</strong> Can you use this knowledge to explain why the Scaling Law in the Pre-Training phase exhibits the phenomena we currently observe?</p><p><strong>Question 2:</strong> Can you use this knowledge to explain the relationship between the Scaling Law in the Pre-Training phase, the RL Scaling Law, and the Test Time Scaling Law?</p><p>We will explore these two questions below. However, I think many intelligent readers may already have an idea of what I am getting at. Trust me, the second question might be easier to think about, but the first one is actually not so straightforward.</p><h3><strong>Deriving the Future of Scaling Law from the S-Curve</strong></h3><h4>Three Types of Scaling Law</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qUb9ZL4yk60HvrJcVUHIEA.png" /></figure><p>We know that large models mainly have three phases: pre-training, post-training, and online inference. Before September 2024, there was only one Scaling Law in the field of large models, which was the Scaling Law in the pre-training phase. The previously much-discussed “Scaling Law hitting a wall” referred to this phase. After the release of OpenAI’s o1, the other two phases were no longer alone and each gained their own identity, developing their respective Scaling Laws: the Reinforcement Learning Scaling Law (RL Scaling Law) for the post-training phase and the Inference Scaling Law (also known as Test Time Scaling Law) for the online inference phase.</p><p>The core idea of the Scaling Laws in these three phases is the same: that is, in this phase, if computational power is increased, the performance of the large model will continue to improve. Of course, the reason why the Scaling Law in each phase in the graph above is shown as an S-curve is because I drew it that way. My assumption, as stated at the beginning of this article, is that there is no such thing as infinite growth. Therefore, the Scaling Law curve also takes on the shape of an S-curve. Many people might disagree with this, thinking that the Scaling Law will continue to grow exponentially? This is a non-consensus view, and we will set it aside for now.</p><p>This is the current situation.</p><h4>Explaining the Scaling Law in the Pre-Training Phase with the S-Growth Curve</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s3ajAFH31NDJ1-l-QXhnGw.png" /></figure><p>I believe that the superposition of S-shaped growth curves can roughly explain the various phenomena we currently observe in the Scaling Law of the pre-training phase. Personally, I am accustomed to categorizing the intelligence of large models into three broad types: linguistic intelligence, world knowledge intelligence, and logical reasoning intelligence. During the pre-training phase, the ease with which large models learn these three types of intelligence is as follows: linguistic intelligence is the easiest to learn and is learned the best; next is world knowledge, and the most difficult is logical reasoning intelligence. From the perspective of the base model, the overall capability in this area is relatively weak (the above phenomena are supported by a large amount of empirical evidence and can be considered factual).</p><p>How can the superposition of S-shaped curves explain this phenomenon in the pre-training phase of large models? Referring to the graph above, I think it is possible to consider that language, world knowledge, and logical reasoning, as basic capabilities, each have a corresponding Sigmoid function. As computational power increases (by increasing model size and data volume), the capabilities in these areas continue to grow. Moreover, the Sigmoid functions of these three basic capabilities each correspond to different K values. The smaller the K value, the more gradual the slope, which means the greater the learning difficulty. This is because a gradual slope indicates that a significant increase in computational power or data results in only a small improvement in capability. Clearly, the K value corresponding to linguistic ability is the largest, making it the easiest to learn. Next is world knowledge, and the smallest K value is for logical reasoning ability.</p><p>The overall intelligence level Scaling Law curve of large models is the superposition of these three S-shaped curves. As we mentioned earlier, the resulting curve after superposition is still S-shaped, which corresponds to the Next Token Prediction Loss curve tested by the Scaling Law (the smaller the Loss, the better; however, when used as a measure of intelligence, it is reversed, so the larger the better).</p><p>So, a new question arises: Why is linguistic ability the easiest for large models to learn, while logical reasoning ability is the most difficult? After some thought, I have come up with the following possible reasons or conjectures:</p><p><strong>“Capability Density” Hypothesis</strong>: <em>The primary factor determining the size of the K value corresponding to a particular capability’s Sigmoid function depends on the proportion of data in the training set that reflects this capability, which can be called “capability density,” that is:</em></p><p>Capability density of Capability A = Total amount of data in the training set that reflects Capability A / Total amount of training data</p><p>For example, in the case of linguistic ability, any piece of text contains a large number of linguistic elements (such as syntax, semantics, etc.). Therefore, the “capability density” of linguistic ability in the training data is the highest, resulting in a larger K value for the corresponding Sigmoid function. This means that the capability growth curve is steeper, indicating that a small amount of computational power or data can significantly improve the language ability of large models. However, as data increases, the corresponding intelligence curve will also quickly reach a plateau and flatten out. Conversely, data that reflects logical reasoning ability generally includes code, mathematics, science problems, etc. Clearly, the natural distribution of such data is inherently small, so the K value corresponding to the Sigmoid function of logical reasoning ability is very small, leading to high learning difficulty. Even with a large increase in overall data, the improvement in performance is not significant.</p><p>If we summarize the progress of advanced large models in the past two years, in addition to continuously increasing model size and total data volume, I believe that the two most critical methods for rapidly improving the intelligence of large models from a data perspective are as follows:</p><p><strong>Key Method 1</strong>: <em>Significantly increase the proportion of data that enhances logical reasoning ability, such as code and mathematics, in the total data volume. Since this type of data is naturally scarce, it can be considered a more valuable data resource.</em></p><p><strong>Key Method 2</strong>: <em>The more valuable the data resource, the greater the proportion of such data should be placed in the final stage of pre-training. For example, the so-called “annealing” stage, which is commonly used at the end of pre-training, actually involves placing a large proportion of logical reasoning data in the last stage to adjust model parameters.</em></p><p>Are other specific technical means important? For example, whether it is Mixture of Experts (MoE) or Dense, or other technologies? Personally, I don’t think they are too important. Many of the truly effective technologies proposed in the past two years have significantly helped reduce the cost of training and online inference for large models. However, they may not have a significant impact on improving model intelligence. The two data-related factors mentioned above are likely to be more helpful.</p><p>Let me give an example. For instance, the Multi-Token Prediction proposed by Deepseek V3 is a pure algorithmic improvement. The V3 paper also provides experimental data to prove that it has a positive effect on the performance of large models. It seems that model quality is improved through algorithm optimization, right? However, if you carefully analyze the experimental data, the conclusion is probably as follows (this is my own analysis and inference, not guaranteed to be accurate): As the model size increases, the benefits brought by Multi-Token Prediction decrease. If the scale reaches the final version of V3 at 671B, its benefits will likely disappear. What is its real role? If used in conjunction with “speculative decoding” during online inference, it can increase the online inference speed by about 1.83 times. In other words, the main function of Multi-Token Prediction is actually to improve online inference speed. However, if you only read the paper without careful analysis, it is easy to misinterpret it as a method to enhance the intelligence of large models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PwyhEqIBpQyq1WKWTy_r1A.png" /></figure><p>Back to the topic. From the perspective of the superposition of S-shaped curves, how can we explain the roles of the two key practices mentioned above? Let’s start with the first key practice: increasing the proportion of data such as code and math problems. What is this equivalent to? It is equivalent to increasing the capability density of logical reasoning ability, that is, increasing the K value of the corresponding Sigmoid function. This, in turn, changes the steepness of the slope of the Sigmoid function for logical reasoning ability (refer to the New Logic curve in the graph above). In other words, under the same computational power conditions, this method can quickly enhance the logical reasoning ability of large models, leading to a rapid increase in the overall intelligence of the models.</p><p>(Someone might ask: If you increase the proportion of logic problems, wouldn’t the proportion of language and world knowledge data decrease, thereby reducing the capabilities in these two areas? I think that if a fair comparative experiment were conducted, this phenomenon might be observed. However, logical reasoning ability is more important for enhancing the intelligence of large models, so this trade-off is worthwhile.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pVt7eBh9jTMdVx0FEn4T7w.png" /></figure><p>Now let’s look at the second key method. The reason why placing a considerable proportion of valuable data (related to logical reasoning) in the later stages of training can quickly enhance the intelligence of large models is also related to increasing the “capability density” of logical reasoning. This is equivalent to temporarily increasing the K value of the Sigmoid function corresponding to logical reasoning ability to a very high level in the later stages of training. Refer to the sudden increase in the shaded part of the green curve in the graph above (during the annealing phase, most of the data are related to logical reasoning, which means that within this training period, the proportion of logical reasoning data increases dramatically, the capability density rises sharply, and the corresponding K value of the Sigmoid function is significantly increased).</p><h4>Intelligent Superposition of the Three-Phase Scaling Laws</h4><p>How can we use the principle of superposition of S-shaped intelligent growth curves to explain the current Scaling Law of large models? This seems relatively intuitive (refer to the graph above). Initially, we only had the Scaling Law for the pre-training phase, which was generally believed to have flattened out (the green curve, corresponding to a relatively low K value of the Sigmoid function). However, models like O1/R1 have initiated new types of Scaling Laws for the RL and Test Time phases. Clearly, the K values of the Sigmoid functions corresponding to these two phases’ Scaling Laws should be relatively high, as only a small increase in computational power can lead to a dramatic increase in the intelligence level of large models, indicating that their slopes are quite steep (I believe the slope for the RL phase should be steeper than that for the Test Time phase).</p><p>Strictly speaking, the RL and Test Time Scaling Laws should not be equivalent to the pre-training phase Scaling Law. They primarily enhance logical reasoning capabilities. Therefore, the RL Scaling Law essentially adds a new S-shaped curve after the S-shaped curve of logical reasoning ability, which is one of the components of the original pre-training phase Scaling Law. Then, a new S-shaped curve for logical reasoning ability in the Test Time phase is added, similar to a relay race.</p><p>Regardless, if we superimpose the three S-shaped curves, we obtain a large model with higher intelligence and its corresponding Scaling Law, which also takes on an S-curve shape.</p><p>One point I personally believe in is that both RL and Test Time Scaling Laws should also be S-shaped, meaning they will eventually reach a peak, or in other words, hit a wall sooner or later. Perhaps the most worthy question for discussion at this stage is: when or under what conditions will they hit a wall? If they do hit a wall, is there a new Scaling Law that can take over? If so, then a new S-shaped curve can be added to the graph, which would further enhance the overall intelligence of large models (<strong>a Moore’s Law for large models?:</strong> <em>through technological innovation, continuously generate new S-shaped sub-curves of Scaling Laws and superimpose them onto the existing curves, thereby creating an S-shaped curve that gives the illusion of the overall performance of large models still being in an exponential growth channel)</em>. Moreover, the most critical question might be: if so, then what would this new Scaling Law be? This could be the most valuable question at the current stage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e40a9ed53656" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is MCTS Tree Search an Effective Method to Replicate OpenAI O1/O3?]]></title>
            <link>https://medium.com/@zhangjunlin2015/is-mcts-tree-search-an-effective-method-to-replicate-openai-o1-o3-32ae6325ca72?source=rss-c53ce4c021e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/32ae6325ca72</guid>
            <category><![CDATA[deepseek-r1]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[openai-o1]]></category>
            <category><![CDATA[openai-o3]]></category>
            <dc:creator><![CDATA[Zhangjunlin]]></dc:creator>
            <pubDate>Thu, 23 Jan 2025 12:49:24 GMT</pubDate>
            <atom:updated>2025-01-23T12:49:24.865Z</atom:updated>
            <content:encoded><![CDATA[<p>DeepSeek R1 and Kimi K1.5 both released technical reports on the same day, introducing their RL+LLM approach. The methods are simple and effective, and the reports are highly informative. Both models have achieved performance comparable to OpenAI O1. The next step is to surpass O3, which seems only a matter of time given the demonstrated potential.</p><p>The methods used in R1 and K1.5 are similar and do not adopt the MCST+PRM technical route. After the release of these reports, some have concluded that MCST is infeasible. However, this conclusion seems hasty and premature. Just as there are multiple paths to the summit of Mount Everest, the success of one approach does not necessarily invalidate others.</p><p>Considering the current research progress, Microsoft’s rStar-Math is another noteworthy technical solution, adopting the MCTS+PRM route. It has shown promise in applying tree search to develop models similar to O1. A comprehensive analysis of R1, K1.5, and rStar-Math could yield interesting insights. For example, what special connections exist between R1, K1.5, and MCST methods? I believe there are close associations among the three. This article will introduce their main ideas and interconnections.</p><p>Here are some <strong>key points</strong>:</p><ol><li>Kimi K1.5’s approach is a special case of DeepSeek R1, and based on this, we can derive more general methods.</li><li>From K1.5 and R1, we can infer that there are many problems where the reasoning trajectories (COT data) provided by models contain intermediate errors, but this does not significantly affect the training of powerful O1-like models.</li><li>Further inference: Large models are better suited than humans for learning complex reasoning processes. For large models, it is about establishing transfer connections between high-probability logical segments, like playing a relay game, while human brains are not good at learning long chains of knowledge.</li><li>The methods used by DeepSeek R1 and Kimi K1.5 are special cases of MCST methods. If these methods are effective, it should be possible to derive more general effective versions of MCST tree search.</li><li>All You Need is High Quality Logic Trajectory Data.</li><li>Thanks to the many versions of R1 models open-sourced by DeepSeek, we can quickly replicate models with stronger logical reasoning capabilities at a low cost.</li></ol><h3>The Approaches and Connections of Kimi K1.5 and DeepSeek R1</h3><p>If you have read the technical reports of both, you will find that their approaches are very similar. K1.5 can essentially be seen as a special case of R1. Reading these reports also raised some questions for me, and in the process of explaining these questions to myself, I derived some interesting inferences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBWzAFkevJ8ChqwcpLPtJQ.png" /><figcaption><strong>The Two-Stage Process of Kimi K1.5</strong></figcaption></figure><p>After selecting a base model, Kimi K1.5 operates in two stages. In the first stage, a batch of &lt;question, answer&gt; data is collected. A more capable model is used to generate the reasoning trajectories (COT data) corresponding to the questions (representing the model’s deep thinking process) and the answers derived by the model. By comparing the model-generated answers with the standard answers, incorrect intermediate reasoning processes can be filtered out. Only the reasoning trajectories (COT) where the model’s answers match the standard answers are retained. Additionally, some rule-based judgments or manual calibration are applied to minimize errors in the intermediate reasoning steps. This process generates a batch of reasoning trajectory (COT) data, forming training data in the format of &lt;question, reasoning trajectory COT, answer&gt;. These data are then used to fine-tune the model’s parameters through SFT (Supervised Fine-Tuning).</p><p>The primary objectives of this stage are twofold: first, to enable the large model to develop initial deep thinking capabilities, and second, to ensure that the output format meets the desired structure. By fine-tuning the model’s parameters, these capabilities are internalized within the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jj-YftghpLyuSvCTE39a8A.png" /><figcaption><strong>The RL Stage Strategy of K1.5 and R1</strong></figcaption></figure><p>The second stage employs reinforcement learning (RL) to further optimize the model’s complex logical reasoning capabilities (the RL stages of R1 and K1.5 are very similar, so they are discussed together here). This process is essentially similar to traditional RLHF (Reinforcement Learning from Human Feedback), except that the RM (Reward Model) that is difficult to debug has been removed from the RL strategy. Specifically (refer to the figure above), based on the model after SFT (Supervised Fine-Tuning), Model-SFT, we now have a question and its corresponding standard answer data &lt;question, standard answer&gt;. At this point, Model-SFT generates K complete reasoning trajectories (COT) and their corresponding answers. The ORM (Outcome Reward Model) provides a reward based on whether the answer generated by a reasoning trajectory matches the standard answer: a high positive reward for a match and a low negative reward for a mismatch (as shown on the left side of the figure).</p><p>For the same question, there are K reasoning trajectories, K answers, and K rewards of varying magnitudes. We can consider that the reasoning trajectories with high rewards are of high quality. Therefore, we aim to adjust the model’s parameters based on the current data so that the model will tend to output high-reward reasoning trajectories (COT) in the future, rather than those with low rewards. This is the goal that reinforcement learning aims to achieve. The specific RL strategies of DeepSeek R1 and Kimi K1.5 are shown on the right side of the figure above. The core idea of both is highly consistent: for a single question generating K reasoning trajectories, the average reward of the K trajectories is used as a benchmark. The model is encouraged to generate trajectories with rewards above the average and discouraged from generating those below the average. By adjusting the model’s parameters through this strategy, we can achieve the goal of RL, enabling Model-SFT to produce higher-quality reasoning trajectories (COT).</p><p>For those familiar with the post-training of large models, it is clear that Kimi K1.5’s approach is essentially the same as the standard post-training process. The main difference lies in the fact that, traditionally, the SFT stage of large models uses human-written standard answers, whereas here, model-generated and manually calibrated reasoning trajectories (COT) and answers are used instead. The RLHF stage, however, remains largely consistent.</p><h4><strong>The Approach of DeepSeek R1</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aSO8ws0REF5FKYXdZw17kA.png" /><figcaption><strong>The Two-Stage Process of DeepSeek R1</strong></figcaption></figure><p>The training process of DeepSeek R1 appears slightly more complex at first glance. However, upon careful analysis, you will find that Kimi K1.5 can actually be regarded as a special case of DeepSeek R1. As shown in the figure above, the training of DeepSeek R1 can be divided into two major stages. The first stage (Phase 1) is essentially the same as the approach described for Kimi K1.5, so I will not repeat it here. The base model used here is DeepSeek V3 Base, which is the pre-trained version. The difference lies in what follows. For Kimi, completing Phase 1 marks the final model. However, for DeepSeek R1, Phase 1 is merely an auxiliary process. The model stabilized after Phase 1’s RL training, Model RL-1, is primarily used to generate higher-quality reasoning trajectory (COT) data than that produced in the first SFT stage. Once the new data is generated, Model RL-1 is discarded. We keep the newly generated data but not the old model.</p><p>Next, the new COT data generated by Model RL-1 is combined with the data from DeepSeek V3’s Post-training phase (non-logical reasoning data). This combination is used to prevent the model from experiencing catastrophic forgetting after adjusting its parameters with logical reasoning data, which could degrade its performance on other non-logical reasoning tasks. This is a standard practice. This combined dataset enters the second stage (Phase 2), which follows the same process as Phase 1, also consisting of SFT and RL stages. The main difference is that the dataset used in the SFT stage is changed, and that is all.</p><p>However, there is one important point to note here, which I believe is a crucial technique worth paying attention to in the process of training logical reasoning models: The base model for Phase 2 is the originally selected DeepSeek V3 Base, not the enhanced Model RL-1 from Phase 1. This is very important and makes sense logically. We can assume that the logical trajectory COT data used in the SFT stage of Phase 1 is not of high enough quality. Although it is enhanced by RL, it is still inferior to the logical reasoning data generated by Model RL-1. Therefore, we can consider Model RL-1 as a model contaminated by low-quality data. Instead of using it, it is better to directly adjust the parameters on the clean Base model with higher-quality data, which should yield better results. Microsoft’s rStar-Math model, which is based on the MSCT idea, also repeatedly employs this technique, conducting four iterations. In each iteration, better training data is generated, but the base model for the policy strategy remains the original clean Base model. This demonstrates that this technique is an important skill for training logical reasoning models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lUU8wXy_9QLpruRWM1FGkA.png" /><figcaption><strong>DeepSeek R1 Zero Training Process</strong></figcaption></figure><p>After discussing R1, let’s turn to R1 Zero. Comparing the training process diagram of R1 Zero with that of Kimi K1.5, it can be seen that the RL steps of R1 Zero are identical to those of R1. The main difference is that R1 Zero does not use pre-collected reasoning trajectory (COT) data to initialize the model through SFT. However, R1 Zero does not perform RL out of thin air. Instead, it replaces the SFT stage with prompt engineering. When the base model is sufficiently powerful, writing a prompt template to initiate a deep thinking mode and output results in the desired format is definitely achievable by such a capable base model. A similar idea can be found in the replica model of OpenAI’s O1, Thinking Claude[^cu93a9b1huiht4h6ih2g^], which was launched at the time of O1’s release. It uses a prompt template on the Claude 3.5 base to make Claude appear to generate reasoning trajectories (COT) and answers like O1. If we add an RL stage to adjust the model’s parameters to Thinking Claude, we would obtain R1 Zero.</p><h4><strong>A More General Method Derived from R1 and K1.5</strong></h4><p>As mentioned earlier, we can regard K1.5 as a special case of R1. By examining the relationship between the two, we can further generalize the two-stage approach of R1 into a more universal multi-stage training method for O1-like models. Referring to the R1 training process diagram mentioned above, where R1 only performs one Phrase 1, we could repeat the Phrase 1 stage multiple times and use R1’s Phrase 2 in the last stage. This would create a more general multi-stage approach. For example, we could design a four-stage process. The first stage would be similar to R1’s Phrase 1, resulting in Model RL-1. We would then use this model to generate higher-quality reasoning trajectory (COT) data. Next, we would perform SFT on a clean base model with this data to start Phrase 2, resulting in Model RL-2. Model RL-2 would then generate even higher-quality reasoning trajectory (COT) data. This process could be repeated several times, with the last stage adopting R1’s Phrase 2 strategy and supplementing the standard Post-Training phase data to prevent catastrophic forgetting of general capabilities.</p><p>Moreover, in subsequent stages, we could gradually increase the proportion of difficult problems, adopting a curriculum learning approach: starting with simple problems and progressively increasing the difficulty. This idea has been mentioned and experimentally validated in both K1.5 and rStar-Math, making it an important technique. Although R1 did not explicitly mention it, I suspect it also follows this idea. In R1 Zero, as the training progresses in the RL stage, the number of output tokens gradually increases, which suggests that the proportion of difficult problems also increases in later training stages.</p><h4><strong>Questions and Inferences Derived from the Training Methods of R1 and K1.5</strong></h4><p>When creating reasoning trajectory (COT) training data, I previously believed that for complex problems, the reasoning trajectory (COT) should have as few intermediate step errors as possible. Ideally, we should obtain training data where every reasoning step in the COT is completely correct, and the final answer is also correct. Only such high-quality data, I thought, could train a logical reasoning model capable of solving difficult problems. However, based on the practices of DeepSeek R1 and Kimi K1.5, I have inferred that the correctness of intermediate steps in reasoning trajectories (COT) may not be as crucial as I initially thought. Training data with a significant number of intermediate errors can still produce powerful reasoning models. After synthesizing information from several papers and reaching this conclusion, I initially found it hard to believe, but it seems to be the case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*1lTk9MwEq290EJ_OQtndmA.png" /><figcaption>from: The Lessons of Developing Process Reward Models in Mathematical Reasoning</figcaption></figure><p>My questions about R1 stem from the following: Whether it is R1 or K1.5, when creating SFT data and generating reasoning trajectory (COT) data in the RL stage, the process involves the model generating complete reasoning trajectories (COT) and then comparing the final answers generated by the model with the standard answers. Data is filtered based on whether the two match, discarding data where the model’s answer does not align with the standard answer, or assigning a low reward in such cases.</p><p>However, it is evident that many intermediate steps in the generated reasoning trajectories (COT) are incorrect. Evidence comes from Alibaba’s paper on improvements to Process Reward Models (PRM) (Reference: <em>The Lessons of Developing Process Reward Models in Mathematical Reasoning</em>). The figure above illustrates this point: Qwen2.5 Math provides reasoning trajectories (COT) and corresponding answers for problems. Upon manual inspection, it was found that a significant amount of data has correct final answers but contains erroneous intermediate steps in the reasoning trajectories (COT). For example, in the Omni-MATH dataset shown above, 43% of the data has incorrect intermediate steps in the reasoning trajectories (COT) but yields correct final answers. Moreover, it is clear that the more difficult the problem set, the higher the proportion of reasoning trajectories (COT) with erroneous intermediate steps.</p><p>This implies that in the process of generating training data for R1 and K1.5, despite filtering based on comparison with standard answers, a considerable proportion of the reasoning trajectories (COT) still contain intermediate errors. The more difficult the problems, the higher the proportion of erroneous data (K1.5 mentioned some methods to control this issue, such as removing multiple-choice questions, which are prone to having correct answers but incorrect reasoning processes. However, this is not applicable here, for example, Omni-MATH has numerical answers, not multiple-choice types, and the problem remains severe). Yet, R1’s approach is clearly effective. Therefore, combining these observations, I arrive at the inference mentioned earlier: There are many problems where the reasoning trajectories (COT) provided by the model contain erroneous intermediate steps, but this does not significantly impact the training of powerful O1-like models.</p><p>If we delve deeper into this, more interesting inferences can be drawn. For example, let’s consider an extreme scenario: if all intermediate steps in the reasoning trajectories (COT) provided by the model are incorrect, it is undoubtedly unlikely to train a good O1-like model using such data. Combining this with the first inference — that it is acceptable for reasoning trajectories to contain intermediate errors — the likely truth is this: It is acceptable for a reasoning trajectory (COT) to have some erroneous intermediate steps, but the proportion of these errors among the total reasoning steps should be as low as possible. In other words, we should not be concerned about whether a reasoning trajectory (COT) contains erroneous intermediate steps, but rather the proportion of these errors. High-quality reasoning trajectory (COT) data should be characterized by a low proportion of erroneous intermediate steps. For example, suppose we have 10 problems, and the model provides a reasoning trajectory (COT) with 10 steps for each problem. Even if all 10 trajectories contain erroneous intermediate steps, it is acceptable. However, if out of the total 100 reasoning steps (10 problems × 10 steps each), 50 steps are erroneous, compared to only 10 erroneous steps, the latter is considered high-quality reasoning trajectory data.</p><p>Regarding the multi-stage O1 training process mentioned earlier, the core implication of why later stages can further improve the quality of reasoning trajectory (COT) data is this: The proportion of erroneous intermediate steps in the reasoning trajectory (COT) data generated by Model RL-i in later stages should be lower than that generated by Model RL-i-1. This reflects the increasing quality of training data. Of course, this is also just an inference.</p><p>If we think further, even more interesting inferences can be drawn. This suggests that large models learn from reasoning trajectory training data not the correctness of the entire reasoning chain, but the logical relationships between segments. In other words, what is learned is the ability to derive step i+1 from step i, which are fine-grained reasoning segments and connections. These are the basic units of logical reasoning learning for large models. Therefore, even if some steps in a long reasoning trajectory are erroneous, as long as their overall proportion is not high, it does not affect the model’s ability to establish connections between these basic logical units. This is also an inference, and I believe it is likely valid. It can also explain the phenomena we currently observe, such as the most powerful models like O3, which have surpassed 99% of ordinary people in logical reasoning ability. This suggests that our traditional understanding of complex reasoning may be flawed. Large models are better suited than humans for learning complex reasoning processes. For large models, it is about establishing transfer connections between high-probability logical segments, playing a relay game step by step. In contrast, the human brain is not well-suited to learning long chains of reasoning knowledge.</p><h3><strong>Feasible MCST Approaches</strong></h3><h4>rStar-Math Technical Solution</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hk6vAE7a-hEdb5SBWzHNfg.png" /><figcaption>rStar-Math Architecture and Effectiveness</figcaption></figure><p>rStar-Math has become a prime example of successfully implementing the Monte Carlo Tree Search (MCST) approach in replicating O1-like models, and it achieved this with relatively limited computational resources (4×40GB A100 GPUs). This demonstrates that tree search techniques are accessible and not overly resource-intensive. The architecture, methodology, and results of rStar-Math are illustrated in the figure above, showing significant performance improvements even for models of 1.5B and 7B parameters. If applied to larger models, these improvements would likely be even more substantial. rStar-Math has thus validated the feasibility of the MCST approach.</p><p>The specific implementation details are not expanded here, but it is recommended to read the paper thoroughly. Many previous attempts at MCST were unsuccessful, indicating that the devil is in the details — minor errors in implementation can lead to overall failure. Compared to previous MCST schemes, rStar-Math excels in two main aspects:</p><ol><li><strong>Multi-Stage Training</strong>: The training is divided into four stages, adopting a curriculum learning approach where more challenging problems are gradually introduced in later iterations. This technique is now recognized as a key factor in successfully replicating O1-like models.</li><li><strong>Enhanced Process Reward Model (PRM)</strong>: The primary challenge in MCST is the difficulty in developing an effective PRM. Traditional methods, inspired by AlphaGo, involve rolling out multiple trajectories from an intermediate step S to evaluate the likelihood of reaching the correct answer. However, this approach often includes erroneous intermediate steps, leading to inaccurate rewards. rStar-Math combines three strategies to address this:</li></ol><ul><li><strong>Code-Augmented CoT</strong>: Reasoning trajectories are represented in code form, allowing programmatic verification to prune unreliable paths.</li><li><strong>Process Preference Model (PPM)</strong>: Similar to DPO, this model evaluates the quality of all reasoning steps from the root node to step S, using both positive and negative examples.</li><li><strong>Traditional Rollout</strong>: This evaluates the probability of reaching the correct answer from step S onwards.</li></ul><p>By integrating these strategies, rStar-Math effectively filters high-quality reasoning trajectories, overcoming the limitations of relying solely on rollout evaluations. The PRM is critical in MCST, but recent advancements, such as those by Alibaba, have improved its accuracy by combining rollout with other models as judges. For future MCST implementations, it is recommended to adopt Alibaba’s enhanced PRM or reference rStar-Math’s approach, which is expected to yield significant performance improvements.</p><h4><strong>DeepSeek R1 and Kimi K1.5 as Special Cases of MCST</strong></h4><p>In the race to replicate O1-like models, the quality of reasoning trajectories (COT) data is crucial. The efficiency of finding high-quality COT data defines a good algorithm. For example, multiple iterations of SFT+RL are often required to improve COT data quality progressively. If method A achieves the same quality in two iterations as method B does in four, method A is more efficient.</p><p>MCST is inherently an efficient algorithm, as it quickly identifies high-quality COT data within a vast space of possible trajectories, guided by the PRM. In contrast, DeepSeek R1 and Kimi K1.5 generate a correct COT by directly sampling from the model, which is akin to randomly selecting a correct trajectory in the search space. Given a reliable PRM, MCST’s selected COT data is superior to the randomly sampled data. Thus, MCST is more efficient.</p><p>Kimi K1.5 can be seen as a special case of DeepSeek R1, which itself is a special case of MCST (random sampling vs. searching for high-quality paths). The main barrier to MCST has been the inaccurate PRM, but recent advancements have largely resolved this issue. Future improvements in PRM technology are expected to further enhance MCST’s effectiveness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SBHz4cs96HAQwPFi0o1pPA.png" /><figcaption>MCST++ Operation Mechanism Diagram</figcaption></figure><p>Since R1 and K1.5 are special cases, if their methods are effective, it should be possible to derive a more general tree search version. For convenience in subsequent discussions, I will name the derived model “MCST++.”</p><p>As shown in the figure above, MCST++ is essentially an improvement on the effective MCST method used in rStar-Math, incorporating the RL stage from R1. Alternatively, it can be seen as a combination of rStar-Math and R1. For example, similar to rStar-Math, the training process can be divided into four stages following the principles of curriculum learning, with logical problems increasing in difficulty. In each round, rStar-Math uses a policy network to expand the tree structure by generating m sub-reasoning steps from an intermediate node S during the tree search process. It then combines the Process Reward Model (PRM) to find better paths, searching for high-quality reasoning trajectories. After forming the tree structure, a batch of high-quality trajectory data is used to adjust the base model, which serves as the new policy network for the next round of MCST search. The policy network, now trained, generates higher-quality sub-reasoning steps. The PRM is also updated to more accurately identify good nodes, leading to an iterative improvement in performance.</p><p>rStar-Math only uses the high-quality reasoning trajectory (COT) data found in the MCST tree to perform Supervised Fine-Tuning (SFT) on the base model to improve the policy network, without an RL process like R1. Clearly, we can introduce R1’s RL process into the policy network. After SFT, an RL stage similar to R1 can be added to further enhance the policy network’s capabilities. In the next round, the model strengthened by both SFT and RL stages serves as the new policy network, forming a self-evolution of the policy network (the PRM can also evolve similarly, following the approach of rStar-Math, which is not elaborated here).</p><p>From the perspective of R1, as mentioned in the section “A More General Method Derived from R1 and K1.5,” the main change is that the source of COT data used in the SFT stage is switched from randomly generated reasoning trajectories by the large model to data obtained through MCST tree search, while the RL part remains the same. Essentially, MCST++ integrates R1’s method with rStar-Math’s tree search-based approach. If R1’s RL stage is effective and if “MCST tree search can obtain higher-quality data compared to random sampling” holds true, then MCST++ is undoubtedly an effective MCST-based method. This is why it was stated earlier that if R1’s method is effective, an effective MCST method can be derived. Moreover, this multi-stage approach is a more general process.</p><h3><strong>All You Need is High-Quality Logic Trajectory Data</strong></h3><p>Currently, the most important aspect for developing better O1 models is obtaining more high-quality reasoning trajectory (COT) data. This includes acquiring more &lt;question, answer&gt; data, especially difficult problems. After obtaining &lt;question, answer&gt; data, the focus is on generating increasingly high-quality intermediate reasoning trajectory (COT) data, where quality is likely measured by the proportion of erroneous intermediate steps. The goal is to produce high-quality &lt;question, reasoning trajectory COT, answer&gt; data. The reasoning trajectories can be manually generated, produced by large models, or distilled from other models. The method of acquisition seems less important than the quality of the data. As long as the quality improves, cost considerations come next.</p><p>There seems to be an inherent aversion to distillation in the field of reasoning trajectory COT data, with concerns that using distilled data might be frowned upon. However, this is a misconception. The quality of the data is paramount, regardless of its source. For example, is R1 distillation? Essentially, it is (with stage one distilling data for stage two), only using its own model for distillation. The core idea of distillation is to generate data using models rather than relying on human effort, reflecting the trend towards automation in AI development.</p><h3><strong>Low-Cost and Rapid Enhancement of Logical Reasoning Capabilities in Large Models</strong></h3><ol><li><strong>Gather a large volume of &lt;question, answer&gt; data</strong>, including problems in STEM, coding, mathematics, and logic.</li><li><strong>Rewrite questions</strong> to expand the quantity of &lt;question, answer&gt; data from the question side.</li><li><strong>Introduce open-source O1-like models</strong>, such as the various R1 open-source models released by DeepSeek.</li><li><strong>Generate reasoning trajectory data using the R1 model</strong> and label the difficulty of the questions: Use the R1 model to generate multiple reasoning trajectories for each question (e.g., 8 trajectories per question). Filter out examples with incorrect final answers to form a &lt;question, reasoning trajectory COT, answer&gt; dataset.</li><li><strong>(Optional but important)</strong> Find a good PRM model, such as Alibaba’s open-source PRM model, to evaluate the overall quality of a reasoning trajectory COT. For example, if a reasoning trajectory consists of 10 steps, calculate the average PRM score for each step to determine the overall trajectory score. Lower scores indicate more erroneous steps, suggesting lower quality. Filter out low-quality &lt;question, reasoning trajectory COT, answer&gt; data to retain only high-quality reasoning trajectories. This step effectively improves the overall accuracy of reasoning steps and enhances the quality of training data.</li><li><strong>Perform SFT on the base model using the remaining high-quality positive examples</strong>, following a curriculum learning approach by starting with simple problems and gradually increasing the proportion of difficult ones. This will yield the strongest logical reasoning model.</li><li><strong>(Optional)</strong> Introduce some negative examples (reasoning trajectories COT with incorrect final answers) alongside positive examples for DPO (Data-Parallel Optimization). This step is optional but may add technical depth to your approach.</li></ol><p>This is essentially a data distillation method, with the advantages of low cost and rapid implementation, allowing for the quick creation of the strongest current logical reasoning models. If everyone adopts this approach, the strength of the resulting models will depend on three factors: the number of problems (especially difficult ones), the quality of reasoning trajectories generated by O1-like models, and the accuracy of the PRM model. However, this method lacks a self-evolution mechanism. The three factors mentioned above essentially determine the ceiling of achievable performance, without a mechanism for continuous model iteration and enhancement. To introduce a self-improvement mode, one can refer to the ideas mentioned earlier in R1, K1.5, or MCST++.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32ae6325ca72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reverse-o1: Reverse Engineering of OpenAI o1(Part 2)]]></title>
            <link>https://medium.com/@zhangjunlin2015/reverse-o1-reverse-engineering-of-openai-o1-part-2-e730278d5ff4?source=rss-c53ce4c021e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e730278d5ff4</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[openai-o1-preview]]></category>
            <category><![CDATA[openai-o1]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Zhangjunlin]]></dc:creator>
            <pubDate>Mon, 07 Oct 2024 08:32:58 GMT</pubDate>
            <atom:updated>2024-10-07T08:32:58.356Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reverse-o1: Key Elements of RL and How to Integrate RL with LLM</h3><p>We start by deducing how o1 might integrate RL with LLM and call the deduced model Reverse-o1.</p><p>We will first analyze the key elements of RL in the Hidden COT scenario: State Space, Action Space, and Reward Model. As for the RL method, I speculate that it is likely to be similar to AlphaGo/AlphaZero, for several reasons:</p><p>Firstly, it is said that OpenAI employees read Sutton’s “Bitter Lesson” several times a day, which mentions that “universal methods that can leverage computing power, such as search and learning, will ultimately succeed.” The search mainly refers to the MCTS method of DeepMind’s AlphaGo. It would be strange if OpenAI employees, influenced by this, did not put search into practice.</p><p>Secondly, in the interview video of the main members of o1 recently announced by OpenAI, an employee mentioned that they have always been trying to integrate AlphaGo’s search method with LLM, which is also evidence.</p><p>So, we will briefly introduce the working principle of AlphaZero and try to integrate it with LLM to construct a complex logical reasoning system.</p><h4>State Space in O1’s RL: Continuous State Space Composed of Token Sequences</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KOOk8zVF2nm78iOzgddRkg.png" /></figure><p>Regarding the RL state space of o1, the first question is: Is this state space discrete or continuous? It is likely to be a continuous state space, or it is best to regard it as a continuous state space. O1 is a combination of LLM and RL. When a user inputs a question, naturally, these Token sequences that make up the question can be regarded as the first state (State1). The Token sequence of State1 serves as the input for the o1 model, o1 selects an action in the action space (the definition of the action space will be discussed later), regardless of what this action is. After selecting this action, o1 will output a Token sequence fragment (not a complete Hidden COT, it should be a fragment of it). Then, o1 appends the newly generated Hidden COT fragment content to State1 to form State2, which is used as the new input for o1 again. o1 selects a new action based on the new input and outputs a new Token sequence fragment… and so on, until the Hidden COT output is completed. It’s basically this process.</p><p>The RL state space of o1 is unlikely to be composed of discrete states. It is difficult to clearly divide a number of specific states. Of course, it can be said that in the extreme case, each Token forms a discrete state in the state space. However, this is basically not feasible in practice. Of course, it can be said that in the extreme case, each Token forms a discrete state in the state space. However, this is basically not feasible in practice. If each Token represents a state S, first, the state combination space is too large. Assuming the Token dictionary size is 100,000, the combination space of 2 Tokens is 100,000 squared, and the state space for a Token sequence of length n is 100,000 to the power of n, which is an astronomical number. Secondly, for o1’s RL, for each Token input, a certain action A needs to be selected, and the next Token representing the transition to another state S’ needs to be generated. If the RL process has search, it means that a search needs to be done for each Token, and we can see from many examples of o1 on the Internet that the Hidden COT is often very long, possibly tens or hundreds of K, and this calculation is basically unacceptable. So, looking at each Token as a discrete state is not impossible, but the granularity is too fine, and it feels difficult to apply in practice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1uOrwM2cohI9qBzqoZQ9g.png" /></figure><p><strong>I think it is more appropriate to regard o1’s state space as a continuous state space composed of Token sequences. </strong>Although the example mentioned above refers to State1 or State2, which seems to be discrete states, this is just for the convenience of explaining the process (of course, if State1 is regarded as a point sampled in the huge Token combination space, there is no problem). It is similar to RL playing games or RL playing Go, where the RL input game (or Go) screen is composed of, for example, 1024*1024 different pixels (different pixels can be likened to different Tokens of LLM), and due to the huge combination space of pixels, it is difficult to clearly define what a discrete state is. Therefore, general RL playing games or Go treats the input image as a whole and regards it as a continuous state space, mapping it to a specific action through a neural network. The state space of O1 is similar to the image (refer to the figure above), and a Token fragment can be likened to a certain image input corresponding to RL playing games, regarded as a continuous state space composed of Token sequences, and mapped to a certain action in the action space through the LLM+RL neural network of o1.</p><p>From the above analysis, it can be seen that the RL technology used for playing games or Go is mostly based on continuous state space as the network input, and the output is mostly a certain action in the discrete action space. So it is obvious that these RL technologies are more suitable for being used as the solution for the RL part of o1, and RL models with discrete state spaces, such as MDP methods, are not very suitable.</p><h4>Possible Action Space in O1’s RL: “Thought-Factor” Discrete Action Space</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvJbMKKNqIZLZAaMXmqlrg.png" /></figure><p>The key link in the RL technical solution of O1 is how to define the action (Action) space. The process of generating Hidden COT by OpenAI 01 is essentially imitating the thinking process of humans in solving complex problems, and when humans think about complex problems, there are relatively fixed and not too many “thinking modes” or “thinking factors”. For example, when we get a complex problem, we usually first clarify what the goal of the problem is, then decompose the complex problem into several links or steps, in order to get the solution of a specific step, we may propose a hypothesis, and then verify whether the hypothesis is established, if not, then continue to propose a new hypothesis until the sub-problem is solved… We may also calculate in the process and find that there are errors in some intermediate links, and correct the errors.</p><p>If you carefully analyze several Hidden COTs released by OpenAI’s official website, you can summarize some typical human thinking factors implied in thinking about complex problems (refer to the figure above, I have given some specific examples). I think if you regard Hidden COT as a Token, it is difficult to do RL (the state space of Hidden COT is already continuous and non-discrete, and if the action space is also non-discrete or the combination space is too large, RL is difficult to model. So the action space is discrete, this is very likely to be true, of course, how to define the discrete action space should have different methods), in my imagination, <strong>a reasonable method is to summarize the human thinking factors implied in thinking about complex problems, and use them as the candidate action set</strong>, such as “decompose the problem”, “rephrase the goal”, “check the result”, “correct the error”, “propose a hypothesis”, etc., the total number should not be too much, even if it is divided more finely, it is estimated to be a few dozen to a hundred. For each specific “thinking factor”, a Token fragment that conforms to the corresponding distribution probability can be generated, for example, if the behavior is the “propose a hypothesis” factor, then the probability of generating the Token “Alternatively” is relatively large (learned from the training data by PPO). So, the original content of Hidden COT may look like this:</p><p>&lt;ACT_Proposer-Start&gt; Alternatively, perhaps combine the numbers in some way. &lt;ACT_Proposer-End&gt; (Proposing a hypothesis)</p><p>&lt;ACT_RephraseTarget-Start&gt; Overall Task: Write a bash script that takes one argument (the string representing the matrix) and outputs its transpose in the same format. &lt;ACT_RephraseTarget-End&gt; (Rephrasing the goal)</p><p>That is to say, the original content or training data of OpenAI’s Hidden COT may be a two-level structure in form:</p><p>&lt;Think_Start&gt; (Hidden COT start mark)</p><p>……</p><p>&lt;ACT-1_Start&gt;token token token…..&lt;ACT-1_End&gt; (Thinking factor 1)</p><p>&lt;ACT-2_Start&gt;token token token…..&lt;ACT-2_End&gt; (Thinking factor 2)</p><p>&lt;ACT-3_Start&gt;token token token…..&lt;ACT-3_End&gt; (Thinking factor 3)</p><p>……</p><p>&lt;ACT-n_Start&gt;token token token…..&lt;ACT-n_End&gt; (Thinking factor n)</p><p>&lt;Think_End&gt; (Hidden COT end mark)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F--V7TCG3_JwzoouVWkOZw.png" /></figure><p>This hierarchical hidden COT structure can reflect the combination of advantages of RL and LLM. The action space of discrete actions, such as estimating what action to take given a state S, that is, the estimation of function Q(S,A), is something RL is good at, and the generation of Tokens in the thinking factor label is something LLM is good at. LLM can learn to adjust the generation probability of Tokens inside the factor label according to the type of “thinking factor”. The figure above shows the possible operation form of o1 after the two-level “thinking factor” discrete action space as described above. In the process of generating Hidden COT, the input and output both have the start and end symbols of ACT action Tokens.</p><p>First, O1 predicts the most likely “thinking factor” to be taken next based on the current question and the already generated Hidden COT fragment, to decide what specific thinking mode to take later, and then under the guidance of this “thinking factor”, LLM generates a specific Token sequence, using the end Token of “thinking factor” as the end mark of this thinking mode. And the Token sequence output this step is merged into the input to cycle through to generate the corresponding action and Token sequence for the next thinking… (Of course, the whole process is my imagination, there is no specific evidence).</p><p>You may ask: Why can’t I see the start and end Tokens corresponding to the “thinking factor” in the Hidden COT examples I give? The COT shown to users is likely to be a filtered version. You think, the start and end Tokens of Hidden COT (&lt;Think_Start&gt;/&lt;Think_End&gt;), these two Tokens are very likely to have, you haven’t seen it, right? It means that the output is a filtered COT, so there were “thinking factor” marks before, but they were filtered out when displayed, which is also possible.</p><h4>Reward Model of O1’s RL Model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vD2WOCEXlLSyOBNLCM1jMA.png" /></figure><p>How to set Reward is crucial for RL. There are actually quite a few academic works on LLM+RL, and there are two common types of Reward models (refer to the figure above): Output Reward Model (ORM) and Process Reward Model (PRM).</p><p>The meaning of ORM is to train a model that only scores the final result, regardless of how many steps the derivation process takes. If you look at it in terms of Hidden COT, it means that only when o1 has completely written the Hidden COT, ORM will give a reward signal, and if the model result matches the standard answer, give a reward of 1, if the answer is wrong, give a reward of -1, something like that. It is clear that the advantage of ORM is that the feedback signal is accurate, for example, for math problems, the model is either right or wrong, very clear, so the feedback signal is precise; but the disadvantage of ORM is that the feedback signal is sparse, which is very intuitive, even if you write 10 pages of derivation process, anyway, there is only one feedback signal in the end. (The RM model of RLHF stage when OpenAI trains a large model belongs to ORM)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n7kaDQ1oFGosiF8YHXY7vg.png" /></figure><p>The meaning of PRM is to train a model that can give feedback signals for each intermediate process, so it is clear which step is wrong in the derivation process, and you don’t have to wait until the end, so its characteristic is that the feedback signal is rich and not sparse. But the problem comes, to train PRM, you need to have annotated data for each step, how to get so many annotated signals? The conventional approach is to rely on manual annotation, such as last year’s very popular OpenAI’s PRM work “Let’s Verify Step by Step”, which relied on manual annotation of 800,000 intermediate step feedback signals of math problem derivation process, and proved that PRM is better than ORM. So, the advantage of PRM is that the feedback is rich and the effect is good, but the cost of training data production is too high, and ordinary people can’t do it.</p><p>So is there a relatively low-cost method to annotate each step? Yes. The better approach I have seen is to do it this way (refer to the figure above): assuming we have a batch of math problems with complete derivation processes, we can first copy the first problem-solving step, and then use the MCTS tree to continue the derivation by search, we can do multiple derivations from this step, some of which will get the correct answer, and some will result in errors. In principle, the higher the proportion of derivations from this step that lead to the correct answer, the more important this copied step is for getting the correct answer, so it can be given a high score, and then the second problem-solving step can be copied, and so on… In this way, we can automatically annotate the quality of each derivation step. Then we can use this data to train the PRM model, and PRM can score each reasoning step. But it is clear that the precision of the PRM score trained by this data is definitely not as good as ORM.</p><p><strong>So will OpenAI o1 use ORM or PRM during the training process? I guess both will be used. ORM is accurate, and PRM has rich feedback, each has its advantages, and the combination should be better</strong>. In addition, o1’s official website mentioned “Our large-scale reinforcement learning algorithm teaches the model how to think productively using its chain of thought in a highly data-efficient training process.”, the “data-efficient” here should refer to PRM.</p><h4>The Basic Principle of AlphaZero</h4><p>Here we will first introduce the basic working principle of AlphaZero. The Reverse-o1 plan we give later, the core is how to integrate RL and LLM, and the main framework mainly refers to the main idea of AlphaZero, so we will explain it here to facilitate the understanding of the subsequent content.</p><p>At the end of 2017, the general version of AlphaGo’s chess game, Alpha Zero, came out, not only Go, but also for other chess games such as international chess and Japanese chess, AlphaZero also defeated the strongest AI programs including AlphaGo with an overwhelming advantage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tz4Tdvvnw0ejD8yx6OwU1A.png" /></figure><p>AlphaZero has not made essential improvements in terms of technical means compared to AlphaGo, and the main body is still the MCTS Monte Carlo search tree plus neural network structure and RL training method, but the technical implementation is much simpler and elegant (refer to the figure above). The main changes include two aspects: one is to merge AlphaGo’s two prediction networks (policy network P and value network V, the policy network P is mainly used to predict the winning probability of each action a, that is, the possible chess piece position, under the current state S, that is, the function P(S,a); and the value network V mainly evaluates the overall probability of winning the current state S, that is, the function V(S), which is a value between 0 and 1, the larger the value of V(S), the higher the probability of winning from the current situation S.) into one network, and output two types of results P(S,a) and V (S) at the same time; the second is to upgrade the network structure from CNN to ResNet. AlphaZero completely abandoned learning from human chess games and started learning from a blank sheet of paper through self-play, and obtained far more than a thousand years of human accumulated Go experience in just three days of Self Play.</p><p>AlphaZero combines MCTS and RL, with MCTS as the main body, and RL plays a role in accelerating the search speed. During the Self Play process (refer to the figure a), for a certain AI chess player, it will use MCTS search, search for each possible chess piece (Action) under the current state S, and after searching each position, it can obtain the winning probability distribution pai of each chess piece position, and choose the position with the largest probability to place the chess piece, and then another AI chess player will also adopt a similar idea to place the chess piece… So back and forth until the winner is determined z indicates who is the winner, Reward signal).</p><p>So far, it seems that we have not seen the role of the neural network structure, in fact, it mainly plays a role in the MCTS search of a certain chess piece position. Because starting from a certain chess piece position to search, the searchable space is too large, and brute force search is definitely not feasible, so the role of the policy network P and the value network V (AlphaZero has already merged into one network, it is mainly to facilitate the explanation) is mainly to guide the search process, and prioritize the search of paths with high winning probability, and prune paths with low winning probability, so as to increase search efficiency.</p><p>During the search process, the neural network parameters are fixed, and when a game of chess is finished and the winner is determined, the corresponding training data can be generated for each state S passed through in the chess game. For the policy network P, the learning goal is the action probability distribution pai obtained by the MCTS search at the current state S, and for the value network V, the learning goal is the fact that “the final winner z has a high probability of winning”. Then, based on this training data, the neural network parameters can be adjusted, so that it will be stronger in the next game of chess (it can be seen that the reward model of AlphaZero is ORM). In this way, through the infinite repetition of the game process, the ability of AlphaZero becomes stronger and stronger.</p><p>It should be realized that for AlphaZero, its essence is still the MCTS Monte Carlo tree search. The reason why Go seems difficult to overcome is mainly that the search space is too large, and brute force search is completely unfeasible. If we assume that there is a machine that is infinitely powerful and can quickly traverse all search spaces, then even if we use MCTS tree search alone without relying on RL, the machine can achieve a perfect game state. AlphaGo Zero</p><p>mainly achieved better evaluation of the chessboard state (V) and the quality of the chess piece (P) through self-play and deep reinforcement learning, and gave up a large number of inferior paths, thus greatly reducing the search space needed. The self-evolution mainly reflects that the evaluation of the chessboard state (P and V) is more and more accurate, so it can find the chess piece with the highest winning probability more and more quickly. The reason why a large number of training data can be produced through self-play is that playing chess is a task with clear rules, and it can be won or lost at a certain state, it’s just that this final win or loss comes later, not visible with each chess piece.</p><h4>Reverse-o1 Model Network Structure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rm-HRvnsvFv3E-cXdhUyGQ.png" /></figure><p>o1 is different from playing chess in one point: in addition to RL, even Hidden COT, it is also output by a Token at a time behind, LLM must still be the main structure, but RL must also have a network structure to adjust the model parameters to gradually learn the internal thinking process. So, the first question we face is: how to integrate LLM and RL two models to obtain a complete network structure that simultaneously has the functions of both LLM and RL.</p><p>The figure above shows a structure I imagined: the main body is still a LLM model based on Transformer (Dense or MOE can be, the mini version should be a Dense structure), when the input is “question + already generated part of Hidden COT” (that is, the current state S composed of continuous Token sequences), it is encoded by the GPT network. On the LLM output Head, two sub-structures can be differentiated: one is used for the conventional LLM prediction of the Next Token, which is consistent with the usual LLM; on the Head, an RL model structure can be built, here referring to the idea of AlphaZero, one network with two outputs. For example, an FFN network structure can be used, on the one hand, it outputs the policy network P result (P(S,a)), representing the distribution probability pai of the next Action “thinking factor” under the current state S, the larger the probability of a “thinking factor”, the greater the possibility of this Action being selected for execution in the next step; on the other hand, it will output the value network V result (V(S)), representing the probability of the current state S leading to the final correct answer, the larger the probability, the higher the quality of the current state S, meaning that the overall quality of the part of Hidden COT that has been output so far is higher.</p><p>At this point, when Hidden COT is in a certain state S, after the network knows what action to take next, the current state S has a certain probability of leading to the correct answer. But there is still a part missing, that is, the corresponding Hidden COT series of Tokens after the next “thinking factor” behavior is known.</p><p>A simple method is to use the LLM part above the LLM head to continuously output the subsequent Tokens (when there is manual data training, PPO can be used to increase the output probability of the corresponding Tokens), and when outputting the subsequent Tokens, RL output is not considered, until LLM outputs to &lt;ACT_i-End&gt;, then judge the RL output to select actions… Continue this process, and the model that combines LLM and RL output Hidden COT can operate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UaonTaSYayjjjT9K3L6JUw.png" /></figure><p>As we analyzed before, o1 is likely to use the process reward model PRM, and it is likely to be composed of multiple models. Under these two constraints, the model structure above can be transformed in this way (refer to the figure above): after knowing the next “thinking factor”, instead of having the main model generate subsequent Tokens, in order to increase the quality of the subsequent generated COT, the idea of Best-of-N Sampling can be adopted, and multiple copies of the Reverse-o1 model (different copies can set different temperature parameters to increase the diversity of the output) each give a Token sequence, and then the PRM trained offline is used as a judge to score, and choose the Token sequence with the highest score as the output Tokens of this “thinking factor”. After selecting the best content, it can be synchronized to the main model, and the main model can perform an operation similar to Prefill to synchronize the output of the best content, and then start the next round of output… This can be done in this way, and it is obvious that the quality of the generated Token sequence will be higher.</p><h4>Reverse-o1 under MCTS Tree Search</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k-k-rkL3owGCUyFbG2ifuw.png" /></figure><p>We imitate AlphaZero and introduce the main structure MCTS, and its operation process is as follows (refer to the figure above): when a user inputs a question, Reverse-o1 uses the MCTS tree to search for each possible “thinking factor”, and uses the policy network P and the value network V to quickly find the optimal search path during the search, so as to obtain the distribution probability pai of all “thinking factors”, the larger the probability value, the higher the probability that this type of thinking leads to the correct answer. Then, the “thinking factor” with the largest probability is selected as the behavior of the current state, and as described in the previous section, the COT Tokens fragment is generated for this behavior by Reverse-o1. The COT Tokens fragment is merged with the user’s question to form a new state… and so on, until the answer to the question is produced, and compared with the standard answer, it is either right or wrong, and the corresponding Output Reward is obtained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qpdb7CGxZRYSnbzjH1oBGQ.png" /></figure><p>Imitating AlphaZero, starting from state S, when searching for the probability of a certain “thinking factor” leading to the correct answer, the optimal next state S’ is sought in the form of max(Q+U), and the Q function is positively correlated with the value network V(S), and the U function is positively correlated with the policy network P(S,a), so the meaning of Max(Q+U) is to find high-quality search paths guided by the value network and the policy network; when searching to the leaf node, node expansion will be carried out, and the strategy network and value network are used to estimate the initialization of related search parameters, and then the Q function corresponding to all states on the optimal path is updated from bottom to top. After each candidate “thinking factor” has been searched for a round, the distribution probability pai of all actions will be obtained, and the search step is completed. The difference between O1’s search and playing chess is that: if you want to transfer to the next state, you also need to generate the corresponding Hidden COT Tokens based on the current selected behavior, and this step can be completed by the Best-of-N Sampling strategy described in the previous section.</p><p>After generating the Hidden COT fragment step by step from the question, when it reaches the answer phase, the Output Reward is obtained, and a MCTS search process from the middle link to the answer is completed. If the answer is correct, Reward can be set to 1, and if the answer is wrong, Reward can be set to -1. Based on this, training data can be constructed for all intermediate states passed to train the policy network P and the value network V, and the learning goal of the policy network is the action probability distribution pai obtained by the corresponding state MCTS search, and the learning goal of the value network is the Output Reward.</p><p>In addition, for each “thinking factor” selected during the search process, the corresponding Hidden COT Tokens sequence obtained through Best-of-N Sampling (which can also obtain the corresponding Process Reward score given by PRM) can be used to adjust the LLM model parameters with PPO (the Reward of PRM is used as the Reward of PPO), so that LLM will increase the generation probability of these Tokens when encountering this “thinking factor” later.</p><p>So far, the journey of reverse engineering o1 can be basically ended, and some of the constraints mentioned earlier (o1 should be composed of multiple models, some or several tree searches should be used, RPM and ORM should be used, etc.) are basically reflected in the imagined Reverse-o1.</p><p>However, I personally think there is still a problem worth thinking about deeply: “Is the thinking factor necessary?” After all, this requires manual induction of human potential thinking modes, and there is still a strong trace of manual work, and it will increase the cost of manual annotation of data. I have been thinking about this problem for several days, and the conclusion seems to be: the whole framework can still be this framework, and it should be possible without introducing “thinking factors” insead of a “Hidden Thinking Factors”, because the article is already too long, and it is a bit complicated to explain, so let’s skip it for now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e730278d5ff4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reverse-o1: Reverse Engineering of OpenAI o1(Part 1)]]></title>
            <link>https://medium.com/@zhangjunlin2015/reverse-o1-reverse-engineering-of-openai-o1-part-1-69bd11161d95?source=rss-c53ce4c021e1------2</link>
            <guid isPermaLink="false">https://medium.com/p/69bd11161d95</guid>
            <category><![CDATA[o1-preview]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Zhangjunlin]]></dc:creator>
            <pubDate>Mon, 07 Oct 2024 07:35:11 GMT</pubDate>
            <atom:updated>2024-10-07T07:35:11.249Z</atom:updated>
            <content:encoded><![CDATA[<p>The introduction of OpenAI o1 is nothing short of a breakthrough. Despite rumors about Q* and strawberries circulating for a long time, the general consensus on using reinforcement learning to enhance logical reasoning abilities was more or less correct. However, few would have guessed the integration of LLM and RL to generate Hidden COT, and the results are indeed impressive.</p><p>As OpenAI moves closer to Close, it reveals very little technical content beyond “reinforcement learning generates Hidden COT.” Sora at least provided a rough technical framework, with many implied technical points that can be pieced together to reveal the underlying technology. However, there is a scarcity of direct references for analyzing o1, as there is little public literature on Hidden COT generation using LLM+RL.</p><p>Is it impossible, then? Not necessarily. By observing details and making professional inferences, there are still traces to follow. This article attempts to analyze the technical principles of o1 in an understandable way, aiming to answer questions such as:</p><p>· Besides the significant enhancement of complex logical reasoning abilities, what other significance does o1 have?</p><p>· What would the complete training process of o1 be like?</p><p>· Is o1 a single model or multiple models?</p><p>· How is the RL state space defined in o1? How is the action space defined? What kind of Reward Model is used? What kind of training data might be used? What might the structure of the model be after the fusion of LLM and RL?</p><p>For convenience in this text, I will refer to the deduced model as “Reverse-o1.” Some parts are based on judgment, while others are inferred from mainstream technology. As long as OpenAI does not announce the technical framework, there may be as many interpretations as there are practitioners. I mainly refer to the methods of AlphaZero, attempting to integrate LLM and RL on this basis.</p><h3><strong>The Significance of OpenAI o1</strong></h3><p>I personally believe that OpenAI o1 is a huge breakthrough in the field of large model technology. In addition to the significant improvement in complex logical reasoning abilities, let’s analyze its significance and value in other aspects.</p><p><strong>Firstly, o1 brings self-reflection and error correction capabilities to large models, which I believe is particularly valuable.</strong> Models like GPT 4, when outputting answers token by token, will inevitably make mistakes in the middle of long outputs. However, even if LLM later realizes that a token was wrong, it has to continue the mistake because there is no mechanism to correct previous errors.</p><p>o1, during the “thinking” process of generating Hidden COT, if you have analyzed the examples provided by the official OpenAI website, will indeed realize that it has made a mistake before and can automatically correct it. This self-error recognition and correction are very important for LLM to perform long-chain thinking and solve complex tasks, which is equivalent to crossing a high threshold that locks the capabilities of LLM.</p><p><strong>Secondly, the so-called new Scaling law of RL.</strong> OpenAI’s own PR may emphasize this more, and various interpretations also focus on this. I guess that o1’s RL is likely to use a relatively complex tree search similar to AlphaGo’s MCTS, or a simple tree structure expansion, such as generating multiple candidates and choosing the best one (Best-of-N Sampling). If used continuously, this strategy is also a simple tree search structure. It is also possible to use both. Regardless, the tree search structure is likely to be used, and COT is linear, but this is the output result, which does not mean that the internal thinking process is necessarily linear. I think it is almost inevitable to solve complex problems with linear thinking, and the tree structure is almost inevitable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AU6ANTyLl5ne-dTkRPEIIg.png" /></figure><p>Someone asked, do you have evidence to show that o1 is likely to use a search tree structure? I have no evidence, but I can infer. My judgment is based on o1 mini. The previous research conclusion was this: although the language ability of small models is strong and the world knowledge is okay, it is difficult to improve the logical reasoning ability. Even if you try to internalize the logical ability into the parameters of the small model through measures such as distillation, the effect is limited, and the biggest gap in ability between small models and large models is logical reasoning ability. This means that it is estimated that the improvement of small models’ logical reasoning ability through parameter internalization alone is limited. However, o1 mini is obviously a small model, and its complex logical reasoning ability is very strong, and it seems that it can be enhanced or reduced through configuration (the so-called inference-time Scaling law). If you understand the working mechanism of AlphaGo, you will find that these are all typical characteristics of search trees, and the model’s ability can be enhanced by controlling the search space size. If you understand this, you will find that the scalability of this method is very good, and the effect can be improved by increasing the search width and depth during the RL training phase and the Inference phase of LLM. The scalability is good and the method is flexible. From this point of view, o1 is indeed of great significance because it has proved that it has taken the path of how to integrate LLM and tree search, and the upper limit of LLM models has been greatly improved.</p><p><strong>Thirdly, after o1, small models can truly become popular.</strong> Small models have also been popular in the past half year, but there is still an upper limit from the perspective of ability acquisition. This limit on small models is logical reasoning ability. As mentioned above, the characteristics of small models’ abilities are: language ability is not weaker than large models, world knowledge is not as good as large models but can be continuously improved by giving more data, and due to the model size, logical reasoning ability can be improved but it is relatively difficult.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e_nRNpmCSi_8craHKn_Mpg.png" /></figure><p>So the focus of small model optimization is world knowledge and logical reasoning ability, and from the effect of o1 mini (weak world knowledge, strong logical reasoning), we can deduce that in the future, we can adopt a “Divide-and-Conquer of Ability” (DCA) model to promote the technical development of small models (refer to the figure above): decoupling language, world knowledge, and logical reasoning abilities, with language ability relying on the small model itself, logical reasoning relying on the deep thinking ability obtained through RL like o1, and world knowledge can be enhanced by RAG.</p><p>Through “Divide-and-Conquer of Ability,” small models are entirely possible to have the capabilities of the current most powerful models, which is to say that the obstacles on the road forward for small models have been truly cleared, and the cost of SLM is relatively low, so many people and institutions can do this, so it can be predicted that this DCA model will become popular in the future and form a new paradigm for developing small models.</p><p><strong>Fourth, o1 may trigger a new paradigm of “safety alignment.” </strong>The safety alignment of o1 probably adopts a similar approach to Anthropic’s “AI Constitution,” which means giving some safety rules, specifying which behaviors can be done and which cannot be done. After the logical reasoning ability of o1 is improved, its ability to follow these rules has also been greatly enhanced, and the safety ability is much stronger than GPT 4o. This may trigger a new paradigm of safety alignment: everyone can first strengthen the logical reasoning ability of the model, and then take a similar approach to the “AI Constitution” on this basis, because OpenAI o1 proves that this model can greatly enhance the safety ability of large models.</p><p><strong>Fifth, the domain generalization ability of “reinforcement learning + LLM” may not be limited to the field of science.</strong> Reinforcement learning is suitable for solving complex problems with clear rewards, which are typical of disciplines with standard answers such as mathematics, physics, and chemistry, so many people will question whether o1 can be generalized to a wider range of fields. Indeed, whether the thinking ability of o1 can be generalized to fields without clear standard answers and rewards that are not easy to quantify is the key to its development. If it is well generalized, it will open up a broad avenue; if it is not well generalized, the field will be relatively limited.</p><p>I speculate that OpenAI may have found some reward definition methods for non-mathematical disciplines and expanded this method to more fields through RL. Since o1 can understand and follow safety rules and solve safety problems with the idea of the “AI Constitution,” I think it can be inferred from this that a reward assignment method for fields with vague standards can be derived: that is to say, for fields that are not easy to quantify, by writing some textual judgment standards or rules, let the large model understand and follow it, and use it as the standard for whether to give a reward, the reward is high if it meets the standard, otherwise it is low. For example, for writing compositions, you can list the standards for good articles (clear structure, beautiful writing, etc.) and let the large model give rewards according to it. In this way, it can be expanded to many fields.</p><p>From the analysis above, it can be seen that the technical direction of o1 not only enhances the model’s complex logical capabilities but may also lead to many important innovations in the development of large models. This is the main reason why I say o1 is important.</p><h3>The complete training process of OpenAI o1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sCowcm-iJq9M3MOh6lorQg.png" /></figure><p>Training of LLM models such as GPT 4 generally consists of two stages: “pre-training” and “post-training” (refer to the above figure). “Pre-training” absorbs basic abilities such as language, world knowledge, logical reasoning, and code from a large amount of data through Next Token Prediction. The larger the model size and the more training data, the stronger the model’s capabilities. The Scaling Law we usually refer to pertains to the model expansion characteristics of this stage, which is also where LLM training consumes the most computational resources. “Post-training” is divided into three processes: SFT, RM, and PPO, collectively referred to as Reinforcement Learning with Human Feedback (RLHF). The main purposes of this stage are twofold: one is to enable LLM to follow instructions to perform various tasks, and the other is content safety, preventing LLM from outputting impolite content. The trained model’s inference process directly generates tokens one by one to form answers to user questions.</p><p><strong>The entire training and inference process of OpenAI o1 should be quite different from typical LLMs like GPT 4. </strong>First, the “pre-training” stage should be re-trained and is unlikely to be obtained by continuing pre-training on GPT 4. Evidence is readily available; OpenAI officials have repeatedly claimed that o1 mini has extremely strong logical reasoning capabilities but is very weak in world knowledge. If it were modified from other models, the world knowledge would not be weaker than GPT 4 mini, so it indirectly indicates re-training; moreover, this also suggests that models like o1, which focus on logical reasoning, should greatly increase the proportion of logical training data, such as STEM data, code, papers, etc., during the pre-training stage. I even doubt whether o1 mini introduced general data, otherwise, there would be no need to constantly emphasize the weakness in knowledge capabilities.</p><p>In the “post-training” stage, there should be a link to enhance the LLM model’s ability to follow instructions, which means the RLHF stage should be present. Since o1 is not weak in following instructions, and the generated Hidden COT segments obviously contain a lot of instructive content, if the ability to follow instructions is weak, it is likely to have a negative impact on the generation of Hidden COT. Therefore, it is inferred that this link is probably before the “thinking” stage. (However, the RLHF stage may not have RM and PPO). But here, there should be two important differences from the corresponding RLHF stage of GPT 4: First, o1 should not have done content safety at this stage, and it is likely to be moved to the later stage (it may also have been done in both stages?). Second, this stage is also likely to greatly increase the proportion of logical reasoning instruction following data, thereby further strengthening the base model’s logical reasoning capabilities, for reasons we will explain later.</p><p>The next stage is the biggest feature of o1, the so-called introduction of “System 2” slow thinking ability. ClosedAI only mentioned the use of RL reinforcement learning and did not mention anything else, with first-class technical confidentiality. From this, we can only infer that o1 integrates LLM and RL to achieve the model’s “think before speaking” Think ability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*038VmBb_X_jhixoBJDgpvg.png" /></figure><p><strong>OpenAI o1 should move the “content safety” related capabilities after the “Think” stage, and the approach should also be quite different from GPT 4. </strong>After o1 further enhances its logical reasoning capabilities through the Think stage, it does not use safety-related Instruct data to adjust the model parameters. Instead, it introduces several safety rules that LLM should follow, such as not outputting details on how to manufacture harmful products like drugs, etc., in the System Prompt. After the logical capabilities of O1 are enhanced, it can basically refer to the “Safety Regulations Manual” when outputting and not output harmful content. This approach is similar to the previous “AI Constitution” approach by Anthropic (refer to the above figure). Moreover, o1’s ability in content safety is much stronger than GPT 4o, which means a huge change in the safety paradigm of large models in the future: one should first greatly enhance the model’s logical reasoning capabilities and then adopt a model similar to the “AI Constitution” or the “AI Safety Manual.” Obviously, if done this way, the safety issue becomes much simpler because it is equivalent to treating LLM as a human. You tell it what can and cannot be done, and when its logical capabilities are strong, it can now fully understand, that’s all there is to it.</p><p>The above is the training process of o1. In the model inference stage, o1 reflects the characteristic of “thinking before speaking,” which is divided into three stages: first, by thinking, Hidden COT data that reflects the thinking process is generated according to the user’s Prompt questions. Because many Hidden COTs are very long, the “COT summary” stage is introduced to extract some key thinking links from the long Hidden COT to show users, and finally, answers are output according to COT.</p><p>From the above content, it can be seen that o1 is still quite different from traditional LLMs in both training and model inference stages. In addition, I will elaborate on two things here.</p><p>The first one, if you want to imitate a model to achieve a similar effect to o1, an easy way to take a shortcut is: neither to specifically enhance the base model’s logical reasoning capabilities (for example, greatly increasing the proportion of logical data in pre-training), nor to do the “slow thinking” stage of RL training (because I don’t know how to do it), but only to focus on adding the “Think” process in the model inference stage. For example, try to introduce the simplest tree expansion strategy like Best-of-N Sampling, and then write Prompts to remind LLM to think and reflect on itself. The combination of the two can also let the model write Hidden COT by itself. In this way, the reasoning effect of the model can be improved to a certain extent. <strong>However, the ceiling for the improvement of this approach is relatively low, that is to say, your model’s logical reasoning ability seems to have improved a bit, and then it will be stuck.</strong> Even if you increase the computational power in the inference stage (for example, expanding the number of samples N from 10 to 50, something like that. Inference-time Scaling law is probably the meaning of this approach. Do you think this approach is a law or not a law?) it is actually useless.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1IW7t_hOI01hqm84AY4wTA.png" /></figure><p>This conclusion comes from the literature “Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameters” and “Are More LM Calls All You Need? Towards the Scaling Properties of Compound AI Systems”. They have proven that: for simple or moderately difficult logical reasoning problems, increasing computational power through inference-time, such as tree search methods, is more effective than enhancing the model’s logical reasoning capabilities in the “pre-training” stage; for difficult logical reasoning problems, it is difficult to improve by relying solely on inference-time, and sometimes it is even counterproductive, it is better to enhance the model’s logical capabilities in the “pre-training” stage (refer to the above figure).</p><p>Why is that? You can think about it, in fact, the truth is easy to understand if you think about it carefully. This is because for simple or moderately difficult problems, the model is likely to provide most of the steps in the answer during inference (or most of them are correct in multiple samplings), with only a few steps being wrong, leading to the final answer being wrong. By using simple tree search methods like Best-of-N Sampling to increase the diversity of outputs, coupled with a reliable Verifier to screen, it is relatively easy to correct this minor mistake. However, for difficult logical problems, because most of the steps in the model’s output may be wrong (or most of them are wrong in multiple samplings, in this case, you vote to take the opinion of the majority, and the result is estimated to be very sad), you want to rely on inference-time to increase computational power, and it is impossible to save the day.</p><p>I myself, based on the above thinking, further deduced the possible training process of o1 mentioned above: <strong>The base model of OpenAI o1, whether in the Pre-training or Post-training stage, has greatly enhanced the base model’s complex logical reasoning capabilities, which is the foundation for it to solve complex problems by increasing computational power during the subsequent inference-time.</strong></p><p>So the conclusion on this point should be like this: relying solely on inference-time to increase computational power is only useful for easy and moderately difficult logical problems. If you want to continue to improve the model’s complex reasoning capabilities, you still need to work hard in the Pre-Train and Post-Training stages.</p><p>When it comes to this, some people ask: But I don’t have money to train my own base model? What should I do? This is actually a problem faced by the vast majority of people. In fact, taking a pragmatic approach should also be possible, but you have to choose those base models with strong logical reasoning capabilities. I estimate that code-based base models are relatively more suitable, and then try to do some work in “Think” training and “Think” inference, and it should be possible, and the demand for computational power is not something that most people can’t do.</p><p>The second matter to elaborate on is actually related to the first one. I’ve noticed that many people, after looking at o1, are saying that the Scaling paradigm has changed, and that as long as you scale the computational power of Inference-time, the model’s inference effect can continue to scale. This is clearly a misunderstanding. For the reasons mentioned above, if you only expand the computational power of Inference-time, the model’s effect ceiling should not be too high. Ultimately, you still need to expand the complex logical reasoning capabilities of the model during the Pre-train or Post-train stages. At the very least, the two are complementary and mutually reinforcing. Talking about inference-time Scaling alone is probably wrong.</p><h3>o1 should consist of multiple models.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpqKA1vNvFtSzMeL-3ezSA.png" /></figure><p>From the System Card of o1, it is clear that o1 has at least one main model and one relatively independent “Hidden COT Summary Model” (refer to the above figure). Its role is to provide a concise and content-safe COT summary based on the user’s input questions and generated Hidden COT. <strong>Therefore, o1 consists of at least two models.</strong></p><p>So, the question is: <strong>besides the main model and the summary model, are there any other models? I think there probably are.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*76jfpiXHBpjx1ThJJZ2e_g.png" /></figure><p>We can start analyzing from the price of o1. It is known that o1 Preview is three times more expensive than GPT 4o for input and four times more expensive for output. The input and output prices of o1 mini are both 20 times that of GPT 4o (refer to the above figure).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wAh5LDHRz54VWxGxjvtyqw.png" /></figure><p>Let me insert a paragraph here to explain why the input and output prices of large models are different. This is because during the inference stage of large models (inference, relative to model training, not logical reasoning), it is divided into two stages: Prefill and Decoding (refer to the above figure). During the Prefill stage, the user’s input prompt is calculated in parallel to generate the Key-Value corresponding to each Token’s Self-Attention and stored in the KV Cache for the Decoding stage to calculate Self-Attention when generating each Token. At this stage, the Key-Value of each Token can be calculated in parallel, and the model can output the KV of multiple Tokens in one run, so the GPU utilization rate is high. However, during the Decoding stage, the subsequent content is generated according to the user’s prompt, but the model can only produce one Token per run, so it cannot effectively utilize the parallel computing advantages of the GPU, and the resource utilization rate is insufficient. The difference in resource utilization leads to a high cost in the output stage, which is why the output price of large models is generally three to four times the input price.</p><p>Back to the core issue of the price: why is the input price of o1 mini (the input part of the large model’s processing logic is simple, only generating the KV Cache corresponding to the prompt, which is easier to analyze) 20 times that of GPT 4o mini? This is a very strange point. If you think about it carefully, it should contain a lot of clues about the internal mechanism of o1. The input price corresponds to the Prefill stage, which in principle only handles the user’s input prompt and Sys Prompt. The price is 20 times more expensive during the Prefill stage, and there are only two possibilities:</p><p>One possibility is that the input length of the user’s Prompt + Sys Prompt is 20 times that of the GPT 4o mini input. Of course, the prompt input by the user is the same for o1 and 4o. If there is so much more input, it can only be that OpenAI has stuffed a lot of things into the sys Prompt. However, considering that o1 Preview is only three times more expensive than GPT 4o, the possibility of the sys Prompt being particularly long is not very big, otherwise, the input price of o1 Preview should also be 20 times that of GPT 4o. In addition, if the price increase is only due to the sys Prompt, then o1 should not be so expensive during the Decoding stage, because the sys Prompt mainly affects the computational cost during the Prefill stage (of course, if the KV Cache is long, the calculation amount during the Decoding stage when calculating Self-Attention will also increase, because you need to see a longer context, but with the current large model’s support for long texts, the cost will not be too high).</p><p>So, for this possibility, the conclusion is probably that OpenAI may have stuffed things into the sys Prompt (it should be the “Safety Rules Manual” mentioned above), but it has not reached a 20-fold price difference. The reason for inserting a very long sys Prompt cannot explain the 20-fold price gap.</p><p>Let’s consider the second possibility. If we assume that the difference in the length of the input Prompt is not too large, then from the Prefill computing mechanism perspective, it can only be understood that the total number of parameters of the o1 mini model is about 20 times that of GPT 4o (there is still a difference of more than ten times in addition to the summary model). Here are two possibilities. One is to say that o1 mini has only one model, and its parameter volume is about 20 times that of GPT 4o, which is obviously not true. We can see that o1 mini runs quite fast in various tests, so a single model cannot be too large.</p><p><strong>Therefore, the only remaining explanation is that o1 mini, in addition to a main model and a summary model, probably has about 18 other models of similar scale. </strong>Considering that the input price of o1 Preview is only three times that of GPT 4o, it can be understood that o1 Preview, in addition to a main model and a summary model, also has another model of similar scale. Because the overall working mechanism of o1 Preview should be similar to that of o1 mini, it can be known that the extra model in o1 Preview and the 18 extra models in o1 mini (why don’t these 18 models share the KV Cache? If they can share the KV Cache, at least in the Prefill stage, the 18 models can be reduced to one model, then the input price of o1 mini only needs to be three times that of GPT 4o mini. Since it is still 20 times more expensive, it indirectly indicates that these 18 models themselves have different model parameters or configurations, making it impossible to share the KV Cache), are probably doing the same kind of thing. And the nature of this matter is that the number of models can be configured, that is to say, you can set this place to deploy 1, 5, or 18 such models, and there are some differences between these models that make it impossible to share the KV Cache. The effect of o1 mini in many scenarios is better than that of o1 Preview, which may be related to the number of such models deployed. So I speculate that these models are mostly related to tree search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uv0voMXR9PupGhHAoslcNA.png" /></figure><p><strong>In summary, that is to say, the o1 model is probably composed of three parts (refer to the above figure): a main model, a summary model, and a pool of models related to tree search that can be flexibly configured.</strong> If we want to give a technical solution to reverse engineer o1, your technical solution may need to meet this constraint, need to contain these models, and can explain the operation mechanism of this kind of model pool.</p><h3>OpenAI O1 ‘s training data.</h3><h4>Manual annotation data.</h4><p>First of all, training o1 will definitely manually annotate a batch of COT thinking processes, that is to say, to get a batch of &lt;question, answer&gt; data, and manually write down the thinking process and steps to solve the problem, forming &lt;question, thinking process (including errors and error correction processes in the thinking process), answer&gt;. Without the manual annotation process, the: Hmm, wait, … in COT, if it is purely generated by LLM itself, it is estimated that LLM has already become conscious, this probability is very small, these are mostly originally from manual annotation data. These data can be used to SFT the initial model of o1, to start the model’s output mode, let it get used to this kind of expression, but relying solely on SFT is definitely not enough.</p><h4>Synthetic data.</h4><p>Manual annotation is difficult and costly, so the number of COT data annotated manually will not be too much. The problem with manual annotation is that it is not very scalable, and the advantage is that the quality is relatively high. Later, synthetic data can be used. The most intuitive way of synthetic data is similar to the mode of making PRM annotated data mentioned above: extract a segment of manual annotation from the COT, and then use the MCTS tree search method to complete the subsequent reasoning process. Each segment runs multiple times, some of which are correct in the final answer and some are wrong. Whether it is correct or wrong, it can be used as synthetic data to train the o1 model. If you are more radical, for logical problems with a definite standard answer, you can start searching for the correct answer directly from the problem by trial and error. The correct and wrong answers found here can be used to train the o1 model (but this seems to be o1 already? So it’s not very possible).</p><h4>Reverse generation of code COT data.</h4><p>There is a way to greatly expand the code COT data: we have a large number of ready-made codes, and we can teach the large model to try to reverse generate the reasoning steps of Hidden COT from the code. This should be feasible and can greatly expand the COT data of the Coding type. (A similar idea is borrowed from: Planning In Natural Language Improves LLM Search For Code Generation)</p><h4>Reverse generation of mathematical COT.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYAtm35GVBL3fTapqDG49w.png" /></figure><p>AlphaProof, a powerful mathematical problem-solving system, first transforms mathematical problems in natural language into a formal language description through a model, and then uses a method similar to AlphaZero with lean, using reinforcement learning and tree search to continuously search and verify the intermediate reasoning steps. This method is guaranteed to be effective, and it can basically reach the level of a silver medalist in IMO (refer to the blue part of the above figure). However, this kind of system that needs to be transformed into a formal language to solve problems has a problem, that is, it has poor versatility and can only be used to solve mathematical problems, and it is difficult to extend to other fields.</p><p>Inspired by the reverse generation of code, I think mathematical COT can also be generated in reverse (refer to the red part of the above figure). Since AlphaProof can construct a neural network that translates natural language problems into formal mathematical language, it is also possible to construct a reverse generation model, that is, to translate mathematical formal language into natural language, and then use this translation system to translate the reasoning process found by AlphaProof from formal language into natural language thinking COT. Of course, the ones that are done wrong in the middle can also be used, because it has a clear verification system, and even if each step is wrong, it knows why it is wrong, and these can also be translated into natural language. In this way, tens of millions or even hundreds of millions of mathematical reasoning COT thinking process data can be constructed. I think this idea is generally feasible.</p><p>OpenAI o1 is currently the best in mathematics and Coding, and it is known that there is the most training data in this area. I don’t know if it will use a similar reverse generation idea to automatically construct COT data, but it seems that this method seems quite feasible.</p><p>(To be Continued)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69bd11161d95" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>