Tag: ChatGPT

  • The math behind ChatGPT

    The math behind ChatGPT

    A Russian mathematician invented the math behind ChatGPT in 1906 while trying to humiliate a priest in an academic feud, and he died 16 years later without knowing any of it.

    His name was Andrey Markov. His nickname was Andrey the Furious. And the thing he built was never meant to be about language at all.

    Here is the story almost nobody tells you.

    Russia in 1905 was fracturing. The Russo-Japanese War was bleeding the country. Revolution was in the streets. And inside the Imperial Academy of Sciences, two mathematicians were tearing each other apart over a question that had nothing to do with either of them professionally.

    The priest was Pavel Nekrasov, a theologian turned mathematician who believed numbers could prove God’s design. His argument was this: the Law of Large Numbers, the foundational rule of probability theory, only works when events are independent of each other. Like coin flips. No connection between them. And if human decisions follow the same pattern, he said, then human beings must be making truly free, independent choices. Mathematics, in his telling, proved free will. Which meant it proved the soul. Which meant it proved God.

    Markov found this professionally offensive and personally infuriating.

    He was a fierce atheist who had been excommunicated from the Russian Orthodox Church by choice, sending a letter demanding they remove him after they refused to recognize Tolstoy’s excommunication. He had no patience for what he called the abuse of mathematics. The idea that a priest was using probability theory to smuggle theology into science made him furious in the precise way his nickname suggested.

    So he set out to destroy the argument.

    His proof was elegant and brutal. He showed that the Law of Large Numbers does not require independence at all. Averages can stabilize even when every event is connected to the one before it. Free will had nothing to do with it. The soul had nothing to do with it. Nekrasov’s entire theological superstructure collapsed on a mathematical technicality.

    But Markov needed a real-world demonstration. Something concrete. Something that would make the proof undeniable.

    He picked up a copy of Alexander Pushkin’s Eugene Onegin.

    Not to read it. To count it.

    He sat in his study in St. Petersburg and wrote out the first 20,000 letters of the poem in one continuous string, stripping out every space and every punctuation mark until it was just a raw chain of characters. Then he began counting. Vowel or consonant. What follows what. How often does a vowel follow a vowel. How often does a consonant follow a vowel. Week after week, letter by letter, by hand.

    What he found was that the letters were deeply dependent on each other. A vowel is far more likely to follow a consonant than to follow another vowel. The sequence is not random. Each letter is influenced by what came before it. And yet across 20,000 letters, the overall frequency of vowels converged to a stable number. Dependence and statistical regularity could coexist.

    Nekrasov was wrong. The math worked without independence. Free will was not hiding inside probability theory. Markov had proven it on the back of a love poem.

    He called the structure he had discovered a chain. What we now call a Markov chain.

    The idea is simple enough to explain in one sentence. The next state of a system depends only on its current state, not on everything that came before it. Each step carries just enough memory to take the next step. No more.

    What Markov could not have imagined is what that idea would become.

    Every language model that exists today is built on this exact logic. When ChatGPT reads your prompt and generates the next word, it is doing a vastly more sophisticated version of exactly what Markov did with Pushkin’s letters. It looks at the current state of the conversation and calculates what should come next based on patterns in everything it was trained on. The core mathematical intuition, that sequences have structure, that the next element depends on what came before, that you can model language as a chain of dependent probabilities, is Markov’s. It has been Markov’s since 1913.

    His paper on Eugene Onegin was presented to the Imperial Academy of Sciences on January 23, 1913. The audience was mathematicians. The context was a dispute about free will. Nobody in that room was thinking about computers. There were no computers. The first electronic computer would not exist for another three decades.

    He died in 1922, nine years after the paper, in the early chaos of the Soviet era. He was 66. He had spent his final years watching the Tsar fall, the revolution rise, and his country become something unrecognizable. He never saw a transistor. He never imagined a machine that processes language. He thought he had settled an argument with a priest.

    The argument he actually settled was one nobody had asked yet.

    Today his chains are inside every search engine, every voice assistant, every spam filter, every autocomplete. The 2024 paper Large Language Models as Markov Chains shows formally what practitioners have known informally for decades: the inference mechanism of GPT-4, Claude, and Gemini can be characterized as a Markov chain operating over sequences of tokens. The math is his. The name on the paper is someone else’s.

    There is a version of this story where Nekrasov wins the argument. Where Markov decides the priest is not worth his time. Where nobody counts 20,000 letters in a poem to settle a theological dispute.

    In that version, the chain is never invented. Or it is invented later, by someone else, for different reasons, on a different timeline.

    We got this version instead. The furious atheist. The love poem. The weeks of counting. The proof that destroyed a man’s theology and accidentally handed the 21st century its most important mathematical tool.

    Nekrasov wanted to find God in the numbers.

    What he found instead was Markov. And Markov found something neither of them was looking for.

    Source: Ihtesham Ali

  • Creation in the Quran

    Creation in the Quran

    Testing AI, first question: creation in the Quran; composed it instantly

    The Qur’anic view of creation emphasizes a purposeful, deliberate, and intricate process through which God (Allah) brought the universe into existence. It is a perspective that reflects divine wisdom, power, and transcendence. Here are some of the key themes:

    ### 1. **Creation by God’s Will and Command**

    In the Qur’an, creation is often described as being initiated by God’s command. God says, *“Be!”* and it is. This emphasizes the sovereignty of God in bringing the universe into being with a single utterance. For instance:

    * **Surah Al-Baqarah (2:117)**: *“The Originator of the heavens and the earth. When He decrees a matter, He only says to it, ‘Be,’ and it is.”*

    This reflects God’s omnipotence and the simplicity of His command.

    ### 2. **Creation in Stages**

    The Qur’an suggests that creation was carried out in stages, which parallels some modern scientific understandings of cosmology (though the Qur’an doesn’t use modern terminology). It speaks about the heavens and the earth being initially a unified mass before God separated them:

    * **Surah Al-Anbiya (21:30)**: *“Do not those who disbelieve see that the heavens and the earth were a closed-up mass, then We opened them out?…”*

    The idea of the heavens and earth being once a “closed-up mass” suggests a primordial state of the universe, before God caused the differentiation.

    ### 3. **Creation of the Universe, Earth, and Life**

    The Qur’an offers descriptions of the creation of the universe, the Earth, and life forms. The creation of the Earth and its balance is seen as an act of divine design:

    * **Surah An-Naba (78:6-7)**: *“Have We not made the earth as a bed, and the mountains as pegs?”*

    These verses emphasize the Earth’s stable foundation and the presence of harmony in nature, a theme repeated throughout the Qur’an.

    The creation of life, including humans, is also carefully detailed. The creation of Adam, the first human, is a special and significant event, showing humanity’s direct creation by God. The Qur’an describes the creation of Adam from clay:

    * **Surah Sad (38:71-72)**: *“When your Lord said to the angels, ‘I am creating a human being from clay, from molded mud…’”*

    Adam’s creation is unique because God breathes His spirit into him, making humans special among all creation.

    ### 4. **Purpose and Intention of Creation**

    The Qur’an stresses that creation is not random but purposeful. Everything in the universe has a reason for its existence, and its purpose is to reflect God’s glory and serve humanity’s needs. Humans are reminded that their creation is meant to acknowledge the sovereignty of God, live righteous lives, and steward the earth.

    * **Surah Adh-Dhariyat (51:56)**: *“I did not create jinn and mankind except to worship Me.”*

    Humanity’s role is to serve as caretakers of the Earth, living in harmony with God’s will.

    ### 5. **The Creation of Humans**

    The Qur’an also offers a detailed account of the creation of humanity. Adam’s creation was followed by the creation of his mate, Eve (Hawwa), and the story of their fall from paradise serves as a foundational narrative for human life on Earth. The Qur’an does not focus on the literal, material details of creation but on the spiritual significance and lessons:

    * **Surah Al-A’raf (7:19-22)**: *“And O Adam, dwell, you and your wife, in Paradise and eat from wherever you wish, but do not approach this tree, lest you be among the wrongdoers.”*

    This passage, among others, shows the relationship between humanity and the divine, emphasizing free will, responsibility, and the consequences of disobedience.

    ### 6. **The Role of Angels and Divine Guidance**

    The Qur’an speaks of angels as the ones who carry out God’s commands. They play significant roles in creation, maintaining order in the universe, and delivering divine messages to prophets. For instance, they were involved in the creation of Adam:

    * **Surah Al-Baqarah (2:30)**: *“And when your Lord said to the angels, ‘Indeed, I will make upon the earth a vicegerent.’”*

    This verse illustrates the idea that humans are placed on Earth to be God’s representatives (khalifah), with a duty to uphold justice, peace, and righteousness.

    ### 7. **Creation as a Sign of God’s Existence and Power**

    The Qur’an encourages reflection on the natural world as a sign of God’s existence and majesty. Everything in creation is seen as a symbol pointing to the Creator. The vastness of the universe, the intricacies of life, the cycles of nature—these are all signs that people are urged to contemplate.

    * **Surah Al-Imran (3:190-191)**: *“Indeed, in the creation of the heavens and the earth, and the alternation of the night and the day, are signs for those of understanding.”*

    ### 8. **Life, Death, and Resurrection**

    The Qur’an emphasizes that life and death are part of a larger divine plan. Life is given by God, and it is He who will cause death, followed by resurrection. Creation, in this sense, is a dynamic process, with human beings living through cycles of life and death, and eventually being resurrected for accountability in the afterlife:

    * **Surah Al-Mulk (67:2)**: *“It is He who created death and life to test you \[as to] which of you is best in deed…”*

    The ultimate purpose of creation, for humans, is to worship God and live according to His guidance, with the final goal being eternal life in the hereafter.

    ### Conclusion

    The Qur’anic view of creation presents a universe that is the result of divine will and purpose, where everything has its place and role. Humans are created with dignity and responsibility, entrusted with stewardship over the Earth, and are guided by divine revelation. The universe, in all its complexity, is seen as a sign of God’s greatness and a means by which believers can come closer to Him.

    Created by  CHATGPT.  5/14/25
    aydan mahoney