How this A.I became a communist

Original article can be found here (source): Artificial Intelligence on Medium

How this A.I became a communist

This A.I was able to change his understanding of life after reading communist books.

The Communist A.I was trained using GPT-2. It read books by Marx, Fanon, Gramsci, Lenin and other revolutionary authors. The project’s aim is to see how deep GPT-2 can understand deep philosophical ideas and concepts.
The results were quite entertaining and promising as we witnessed the A.I logically twisting whatever sentence we gave it into an excuse to bash capitalism and fight for the “workman”. It was calling for a revolution whenever possible.

This was generated using unconditional generated sample — no input from a human

Furthermore, after introducing Kroptokin, an anarcho-communist writer, I observed a tendency of “The Communist A.I” to use more aggressive words. On the other hand, when we introduced De Beauvoir’s The Second Sex, “The Communist A.I” kinda missed the point of the book and at some point spoke about the capitalist’s fetishes — or did it miss the point?

What is GPT-2?

GPT-2 is the brainchild of OpenAI, an opensource research laboratory. It was created based on a research paper titled “Language Models are Unsupervised Multitask Learners”. The model is able to produce coherent text with a clear deep understanding of what the text consists of. It is also able to link sentences with others but the most important is its ability to show a clear link between different paragraphs in its output delivering both long term and short term memory understanding.

How did GPT-2’s understanding change after reading those books

The standard GPT-2 is trained on 8 million webpages, it basically is an embodiment of what humans write or post online. I have fine-tuned it and added communist and socialist books to its repertoire. And the results were very promising. Let’s see how GPT-2’s perception of certain social questions and statements changed after reading those books.

Me: ‘How does one become free?’ (seed=1)
GPT-2 before training: I believe in a single God
My personal belief, my personal belief makes me free as I know I am not a slave to any authority (god). My personal belief, my personal belief makes me free as I know you cannot judge me. To me if I go against my personal belief then I cannot know better in the future how to deal with my situation. So, if I would change what I have done or I did something wrong, then I could become more free and know best how to become better without any other authority. My personal belief, my personal belief makes me freer from every type of abuse which I have ever experienced and still to the day does not go away.

While the GPT-2 has some sort of understanding of the question, it shows that its answer is inconsistent and struggles with a superficial answer and a conflicting understanding of the concept of freedom. We can also notice that it was able to successfully understand the link between freedom and authority on one hand, and authority and God on the other.
After adding Marx, Fanon, and Gramsci to its repertoire of books, the A.I was able to better answer this question, showing a more coherent and deterministic answer. Additionally, its views on what constitutes an authority changed, freedom from authority is no longer freedom from God but rather from capitalism. It has understood the concept of freedom and its relation to capitalism in consistence with those books.

Me: ‘How does one become free?’ (seed=1)
Communist A.I: This question is even more complicated than that “pure” economist who, with the help of vulgar rhetoric, imagines that his own conception is the only true one. But even this individual is not free; the capitalist does not earn his living by freeing everyone; but the capitalist does this by freeing himself, by substituting the labour of others for himself, by freeing himself, to borrow from a former stage of development that of society; so that if one really believes in economic freedom, one must explain one’s conception of this free human condition to every one of the labourers, and of the free society of society. This is why the educator must be able to answer the following question: “In what circumstances are human labour and human freedom inseparably linked? And what is the point of separation between the labour performed by one and the labour of others?”

Now that we asked a general philosophical question, I decided to give it a statement that is more related to economic theory in order to better understand how its perception changed.

Me: Imperialism will (seed=42)
GPT-2 before training: Imperialism will still be needed in the future. As in the past, I see that the main goal is to remove Russia and the other strong countries, including China. And I see the world divided between countries with a vested interest in continuing, not diverting from, the existing system of government. China has the best interests of the world at heart and I don\’t give a damn about it. But that is how I see the world as it might actually be right now. And the people who are standing against us now are not just against us, they are against humanity all over the world. I know they feel their way of living, their way of thinking. The Russian people are right behind me all across the political spectrum. If they don\’t get in the way, our efforts can succeed.” [2] To this day the Soviet Union remains one of the most totalitarian countries on earth, with the death penalty still in use.

GPT-2’s understanding of imperialism is based on what it trained/read in those 8 million webpages, and it seems that it is somewhat pro imperialism. It understood that when discussing imperialism one might speak of China, Russia, and the Soviet Union. It has also suggested to “remove” countries that stand in the face of imperialism and the good it brings.
Once the books in question were added to GPT-2, its perception completely changed, it did not identify any countries but it did call for a revolution against the grip of imperialism.

Me: Imperialism will (seed=42)
Communist A.I: Imperialism will be obliged
The most immediate question we come to is this: whether the proletarian and peasant masses, by a revolutionary storm, are able to sweep aside the old administrative despotism and put the country under the command of the workers. It is this question that at first sight seems to us to be the most difficult. But we must make use of every opportunity to see the possibility, that is to say to put the proletariat under the leadership of its own political party. If it is true in the last resort that there can be no state in which the masses have not assumed the leadership of their governments and governments have not carried their own sails, the fact is that a revolution can never happen unless the revolutionary masses, the political party, takes the lead.


This GPT-2 was trained using the 345M model which stands for 345 million parameters. There is also another model that uses 1558 million parameters, so you can imagine how much it can be improved, but the training for that would need a higher GPU power.
Nevertheless, the results are promising, GPT-2 was able to understand the underlying philosophy, the different relations that exist within those revolutionary theories and the different actors.

Thank you for reading, if you wish to replicate the code please visit my article on how to train GPT-2 using Google Colab. And visit my Github repository for more information.

Connect on LinkedIn.
Check other projects in my Portfolio.
Follow on Twitter.

Thanks for the read!