In this paper, the sentiment of private investors and the divergence of opinions of users of online investment platforms are analyzed as factors in the emergence of herd behavior on the stock market in different clusters. This clusters are formed on the basis of stock exchange information on shares of Russian issuers. The relevance of the study lies in determining the significance of consensus periods and their impact on the behavior of different groups of investors on the Russian stock market depending on different levels of risk taking by investors. Based on the Russian stock market data for the period from 2019 to 2023, 66 discussed Russian stocks were analyzed. To conduct sentiment analysis, an algorithm was applied to collect and automatically classify textual data using machine learning methods. As proxies for private investor sentiment, metrics of logarithmic sentiment and market-wide divergence of opinions on the stocks under discussion were constructed. The testing of the research hypotheses was based on the implementation of clustering and quantile regression analysis methods. As a result, the significant role of divergence of opinions of Internet users in the formation of herd behavior of private investors on shares with lower average return and risk level was determined. It was also found that asset clustering helps to determine the opposite behavior of investors on stocks with higher volatility level. Consensus of opinions in the market is a signal to deviate from the general market trend. Finally, the test of the hypothesis about the significant influence of investor sentiment did not provide sufficient evidence that this kind of sentiment is important for determining herd behavior in the market.