Experiments with AI derived Zen wisdom

Inspired by my interests in AI, Machine Learning, Buddhist thought, Non-sequitur “reasoning”, the nature of sentience, and storytelling, I’ve begun a deeper dive into deep learning and deep thinking.

We become what we behold. We shape our tools and then our tools shape us” – This quote is often misattributed to Marshall McLuhan. The tone and observational brilliance about humanity in the face of a technological leviathan of its own making has a McLuhanian feel, but was actually coined by someone else. Father John Culkin, SJ, a Professor of Communication at Fordham University in New York and friend of McLuhan, is it’s author. He wrote it in an article about McLuhan, so the misattribution is entirely understandable. I reflect on this thought often as I engage with technology both personally and professionally. So, when last year I read about the monks at the Kodaiji Temple in Kyoto using a robot as an avatar of the Buddhist deity of mercy, Kannon, my interest became piqued. My entirely limited understanding of Buddhist thought regarding technology is that, as an expression of human experience and effort, technology is not to be viewed as separate from us, but part of us. As yet, Mindar, the robotic avatar of Kannon communicates with visitors using a pre-programmed recitation of the Heart Sutra.
As this is a static text, it makes sense to have it pre-programmed. But, if servos and wires can embody a deity, why not a neural network? Within zen Buddhism there is a lexical tool for freeing the mind from reliance on “making sense” to find truth. The Kōan, is “a paradoxical anecdote or riddle, used in Zen Buddhism to demonstrate the inadequacy of logical reasoning and to provoke enlightenment.” The current state of AI assisted text generation is a ripe platform for generating inadequate logical reasoning.

Another effort I’ve been following is the revealing and hilarious work of Janelle Shane. Among other poignant and ridiculous applications of AI of which she is the creator are the neural net generated paint names. After her encouragement, I explored the GPT-2 natural language model created by OpenAI.

After several attempts, I was able to get their 345M data set imported and working on my trusty MacBook Pro running High Sierra. It took some futzing because I find XCode to be bloated and OS X couldn’t run python3 out of the box. I’ll not go into technical details here. More Importantly, I’ve finally got a neural network driven Zen Koan … er creator? Or more specifically, expander.

While there are likely many sources for Koan text available I settled on the ones I found at Ashida Kim’s website as they were easily scraped for demo use. Without further adieu, here’s an early example of Koan prompt and resulting text generated.

Kōan: No Water, No Moon

When the nun Chiyono studied Zen under Bukko of Engaku she was unable to attain the fruits of meditation for a long time.

At last one moonlit night she was carrying water in an old pail bound with bamboo. The bamboo broke and the bottom fell out of the pail, and at that moment Chiyono was set free!

In commemoration, she wrote a poem:

In this way and that I tried to save the old pail

Since the bamboo strip was weakening and about

   to break

Until at last the bottom fell out.

No more water in the pail!

No more moon in the water!

======================================== RETURNED SAMPLE 1 ========================================

 She eventually became a nun, but Bukko kept her company all those years. At first, Chiyono believed that she had heard the words “Master Chiyono” in Bukko’s presence.

Eventually, when Chiyono asked Bukko for a meal every day, Bukko replied:

“I, Bukko, eat today, and next day after that. I can do it every day.”

After Bukko returned from a lecture on “How to do Zen” in Korea, Chiyono returned from her teaching and asked him the following:

“By the time you return from the lecture, will you be able to become a nun?”

Bukko replied:

“No, Chiyono, there will be no more lessons for you in Zen in the future.”

Chiyono then gave up Zen and abandoned all further study of Zen. After leaving Zen in the seventies, she began practicing the zazen technique. Zen became another topic of conversation for her. When Bukko came to visit her a third time, the teacher had given her a new book on various kinds of Buddhism that he had produced for her. He said:

“Please read this book carefully before returning to Zen. As you know that I do what I do because I love you. I want you to become a true Zen nun, and when your teacher comes to visit this time of the year, don’t miss it!”

Chiyono, feeling a sense of relief, came home and asked Bukko for a “study book for the year 2000” and one or two books on Zen itself. Bukko did not object and offered her the books.

Chiyono later became an associate of Bukko. At the end of Bukko’s third year, Chiyono realized that Bukko was a man with deep faith and devoted himself fully to his calling as a Zen monk. He told her that Zen would continue to be a life’s work and he would continue to teach Zen to people after Zen as Chiyono did on her own. When the third year of Zen came, Chiyono was in the first year at the monastery. On the third day, she fell asleep on the floor next to Bukko. Her feet were so tired that she was afraid that she would fall to the floor. Bukko was still asleep on the other side of her and she did not hear a beat. She heard him waking up with Chiyono. ======================================== SAMPLE 2 ========================================

This scene had a vivid impression of joyfulness and sorrow; even Chiyono himself, who seemed to have been in the grip of the most grievous anxiety, could not help shedding tears.

When Kiyobaka was asked whether he had spoken with her at last, he answered simply: “Yes”; and as he turned towards the door she said to him thus: “What is it that has happened? Why have you not been able to return to the hotel yet?”

And he answered: “My life has ended in this way; I cannot return to life until I have a son.”[1]

The mother of the child now was able to express her delight, but she could not endure to look at the sad-faced Kiyobaka who was now crying like a child. Chiyono then went around her again to invite other women to hear her and, as she passed through them, she added: “My young daughter has been called by her father to the palace; the people say he is now very sad. I think you have heard enough. He looks very frail, and he says: ‘I cannot go to school. I was sent to the capital because of some troubles in this house. It was only that I got the idea to go into business, but now I have no more money; I cannot do it and have not even got an allowance of one-third of the amount of money I had earned before on the way there. Therefore, I cannot make the trip back to the palace again.’ Why has that happened?”


When Chiyono heard that little Chiyono had been called to the palace she was shocked, and she was so distressed that she cried like a child. The mother of the child, however, remained unaffected, and so did the others. When Chiyono went back into the hotel she asked the same people why the little Chiyono had become so sad and asked the same questions. But the people did not answer them, and the little Chiyono continued to laugh and talk happily. She kept saying: “You may not understand the reason for my joy. This is my only son. I wanted to come into business and now I have none. I wanted to have another child, but as they said, I can have only one. I wish you and the other girls to tell me all that happened while I was living in the capital

======================================== SAMPLE 3 ========================================

 “What does my baby girl’s father say to me? What does my baby girl’s father make her say to this man?”

But before that could be said, he did something unexpected for him – he made the girl wear a condom she had never touched.

The only way, she explained, to be sure he was all good? He was still a rapist.

“I’m not trying to shock anyone or bring attention to anything. I’m trying to save his life by trying to do whatever it is I can to make sure he doesn’t go through this again. And at some point we’re going to do some things which we think will make this guy want to turn around. You see some good things that happened yesterday.”

Now she’ll be able to spend the day and night in her bed, alone at night. But she thinks about him, and she thinks of her baby daughter.

When he finally came back out, a few hours later, she found his clothes still inside her, but not his trousers. That wasn’t something she was willing to do, she says.

She went into his bedroom and washed them.

She didn’t want to take them out there just yet.

“I don’t want it to be some of those things you hear on cable news, where a rapist is talking about how he can get away with this anymore,” she says. “If you look at our culture, it’s very common for someone who has been the victim of rape to be told that it was a punishment on a woman’s part, that they don’t get to complain about it anymore, that it’s okay. And that is not the case here.

“In fact, one of the things that I’ve noticed is more women have the kind of power to protect themselves that they had when they were younger, that they got to decide whether or not to report a crime of rape that they’ve been the victim of.

“I don’t think that we’re going to see the same levels of violence committed again. A year ago, you know, you could go out at night and walk down the street and you could get killed. It’s almost impossible to believe that that’s happened right before me.”

“You saved it,” said the Queen, who was delighted to hear it. “So did I.”

The two then took each other by the hand and hurried upon the same path and returned to the house, where they remained until all the night. A little after six o’clock the second son arrived back with two women and asked them:

“Do you know what the old man told you? That you have been lying here in my house all night thinking of your lost parcel?”

The King answered to all these questions, and they all, to their joy, left the house.

“I am not sure,” said he, “that we are both right; perhaps it is you, because all the time we were at bed you were speaking to your brother and you were thinking of his treasure.”

At these words, the old man burst into fits of laughter, saying (as he was about to say) that his heart still belonged to him and that now he saw in some dreams a great house, with two beautiful walls, and also a great garden outside with a lovely tree in the middle of the garden.

The King asked him (in a whisper):

“What do you mean by the garden?”

The old man answered:

“Well, I suppose you must understand, by such a garden you would not miss the sea; now you also perceive that a vast house cannot be in possession of a great house; you must therefore, perhaps, know, my brother, that you have only a small quantity of money to spend.”

The King, in a very low tone, took the little money from him and said:

“I do not care about the garden, I wish to take you the sea itself as well; the sea and every other ship are in your harbour; therefore I beg of you that if your brother ever comes that you must bring him back and take him to me. But there is one thing which I would rather not be forced to do; I would rather take my own vessel over and come to the house.”

The old man burst into a burst of laughter and replied (to the King in a louder voice), “I fear that such a desire cannot be entertained till you are old enough for it, now that your brother is in no condition to work for himself. Do you believe you can take the vessel over and go across the harbour?




So I have much work to do. Firstly reading and annotating the results and using that to inform the model. Although, would my input be an attempt to bring logic to something that should remain inherently illogical? Perhaps using non-sequitur texts to train the model further would achieve this.

Stay tuned!

09/08/20 – I’m interested in AI/Human interaction on a spiritual level. I have used GPT-2 to create a Zen Koan chatbot. I’d like to continue this effort using GPT-3. The non-sequitur nature of the Zen Koan lends itself well to AI/NLP. The intended purpose is to create a conversation which frees the user (and eventual AGI?) from the necessity to “make sense” and thus to open the mind/cognitive processes. I’d like to have API access to allow my application to be free to query te user about the qualitative experience of interaction and persist user responses to inform further interaction. I’m mostly interested in creating emotional/tone metadata to attach to conversational elements in the persistence. This is a personal project with no intent to monetize at this time.