Exploring the Development of a ChatGPT Plugin for SuttaCentral

Hello everyone,

I appreciate the ongoing discussion and the valuable insights shared. I’d like to clarify a bit about how I envision the ChatGPT plugin for SuttaCentral.

A ChatGPT plugin is a tool that currently only ChatGPT Plus subscribers have access to. Setting it up would involve configuring ChatGPT to communicate with the SuttaCentral API using an OpenAI manifest file. This file would be added to one of the domains that SuttaCentral owns, and then we’d need to register it with OpenAI. This would make the plugin available for everyone to use. I see this as a straightforward way to drive more interactions with users and help people engage with early Buddhist texts.

I imagine this plugin as a tool that allows ChatGPT to access SuttaCentral to answer questions. For example, a user might ask, “Can you summarize sutta MN10 and get a list of its parallels with their summaries as well?” or “Tell me about The Simile of the Saw sutta. What translations do you have available in Bengali and English?” The plugin would retrieve the information or text of the suttas from SuttaCentral, and ChatGPT could process it based on the user’s requests. I see this as more of a study tool.

Interestingly, ChatGPT has been trained on the Pali Canon and some Mahayana sutras. This means it might be able to do more than just respond to direct questions about specific suttas. It could potentially provide information or links to suttas where specific ideas are discussed.

Here are a link to a article that talk about creating a ChatGPT plugin: How to Create a ChatGPT Plugin: This article provides a step-by-step guide on creating a ChatGPT plugin.

Ayya @Vimala, regarding your translation project, this plugin wouldn’t be creating ready-to-publish translations. However, if we configure it to use the API to get different languages, ChatGPT Plus subscribers could ask to translate one of the suttas or sutras that hasn’t been translated to their language yet. It might be a helpful tool for a translator to use.

@michaelh, regarding your idea of making connections for the whole Canon, that might be better done using a custom trained model on the Pali text and translations. As mentioned before, ChatGPT can’t translate Pali well, probably because it wasn’t trained on any Pali. In theory, we could take one of the open source LLMs and train it on the Pali and/or Chinese and/or Tibetan Canons and make an LLM that could translate, summarize, and find connections between them.

Here’s the HuggingFace leaderboard for open source LLMs: HuggingFace Open LLM Leaderboard

Many of these are nearly at ChatGPT’s level and might actually surpass it soon. However, training an LLM would require significant computational resources. Unless someone has a very powerful computer or a lot of credit with one of the cloud computing providers, this might not be feasible for us to do at the moment. However, it’s an exciting possibility to consider for the future.

Thank you all for your enthusiasm and support. I’m looking forward to our collaboration and the journey ahead.

Metta,
Jon

4 Likes

Hi everyone, really cool work here!

I would love to help out. I have a computational job – I’m not a software person though I would love to pitch in however I can and learn along the way, whether it’s on the translation or the plugin. One immediate thing I can contribute: I have partial access to some large computers, time permitting. I’m not too familiar with training models, though perhaps I can work with someone here to figure out the resource requirements/specs and train a custom model tailored for our use cases here.

Additionally, one potentially interesting use case to explore: perhaps by using LLMs on different bodies of text (say, scholarly commentary vs average user commentary, or worse yet, what is in the rest of the internet/ChatGPT right now), we could use LLMs in a meta-analysis kind of way, to perhaps bring out common misperceptions, and different levels of understanding and language trip-ups. I would imagine that chatbots customized to draw from different bodies of text would probably give different answers, which could be illuminating.

3 Likes

Hi @StudentOfLife
Welcome to Discover and Discuss (D&D) forum. We hope you find the discussions here beneficial and enjoyable. Please make use of the various resources, FAQs, and previous threads; you can use the search function for topics and keywords you are interested in. Forum guidelines are here:
https://discourse.suttacentral.net/guidelines

If you have any questions or need further clarification regarding anything, feel free to contact the moderators by including @moderators in your post or a PM.
With Metta,
trusolo
On Behalf of the Moderators,

3 Likes

Hello @StudentOfLife,

Thank you for your interest in the project and for bringing up the question about the resources required for training a custom Language Learning Model (LLM) like GPT-3.

Training a model of this scale is a resource-intensive task that typically requires a high-performance computing environment. Here are the estimated hardware requirements:

Minimum Hardware Requirements:

  • A modern Linux OS (such as Ubuntu 20.04).
  • An NVIDIA Ampere architecture GPU or newer with at least 8 GB of GPU memory.
  • At least 16 GB of system memory.
  • Docker version 19.03 or newer with the NVIDIA Container Runtime.
  • Python 3.7 or newer with PIP.
  • A reliable Internet connection for downloading models and data.
  • Permissive firewall, if serving inference requests from remote machines.

Ideal Hardware Requirements:

  • Multiple high-end GPUs, such as the NVIDIA A100 GPUs, with NVLink for GPU-to-GPU communication.
  • A large amount of system memory (RAM), ideally more than 256GB.
  • High-speed storage (SSD or NVMe SSD) to store the training data and model checkpoints.
  • A high-speed internet connection for downloading datasets and models.

As for the time it would take, training a model like GPT-3 can take weeks or even months, depending on the specific configuration and scale of the model being trained. This process typically can’t be interrupted and would require the machine to be running continuously during this period.

I hope this gives you a clearer picture of what would be involved in training a custom LLM. It’s a significant undertaking, but the potential benefits for understanding and analyzing early Buddhist texts could be immense.

For more detailed information on deploying a large-scale model like GPT-3, you might find this NVIDIA blog post helpful. It provides a comprehensive guide on the hardware and software requirements, as well as the process of deploying a 1.3 billion parameter GPT-3 model.

1 Like

@jgreen01 Thanks! I’ll go through that blog post, 1.3B is very modest.

I have access to an A100 (80GB VRAM) for development. If 8GB VRAM (like in the blog post) can train a 1.3B model, we could perhaps train up to a 13B model – I’ve seen some translation models that are 13B. From the public discussions, it seems that around 30B is when models acquire more depth and nuance, but 13B is still very functional.

Once we have a better sense of the mechanics, whether we want to train or simply to fine tune, perhaps we could have discussions about the cost-benefit analysis of using cloud servers to train larger models. If we’re really optimistic maybe we could even try to apply for a computing time grant.

In the mean time, perhaps we can brainstorm more concretely what we would like an LLM model to do for us. Seems like there are a few directions/questions right now:

  1. improved translation? would have to think about how this would complement Ayya Vimala and SebastianN. Access commentaries in other languages.
  2. tools to correct misinterpretations.
  3. study tool, as suggested by @jgreen01
  4. how to account for evolving knowledge/understanding? I imagine commentaries from scholars 100 years ago vary differently from more recent scholarship. It’s not so much that newer is necessarily better, but it would be instructive to see how things evolve.
  5. From the discussion raised by @michaelh, it seems like what would make the tool most helpful is it was really good at pointing back to the source material (and perhaps even providing some modest reasoning/explanation for its thought process, e.g. via langchain), instead of simply paraphrasing/summarizing (essentially what Chat-GPT does). For this purpose, it may also be that simply embedding the text into a vector database, a one-off cost, would be sufficieint.
  6. Also from @michaelh, working on prompts to help correct for biases. (I would be very curious to hear about some of these problems that @michaelh encountered).

From the above, I think 3) and 6) are the lowest hanging fruit, while 5) can be partially done via vector embedding, also relatively easy, with interesting questions about context.

Longer term, a better Pali model and translation/mistranslation model would be very interesting, but would need a lot of careful thought because words can be translated in many ways. How do we make sure we retain nuance, and not create a tool that misleads people?

5 Likes

Ah, I just came across this older thread that is relevant: Training AI models on the suttas - #6 by pjteh

wondering how we can coordinate/not duplicate efforts? Is there another more appropriate discussion forum for this work?

1 Like

Thank you StudentOfLife for your enthusiastic response and for offering to contribute your resources and ideas to this project. Your access to computational resources could indeed be a game-changer for us, especially in the early stages of development and testing.

I appreciate your thoughtful suggestions on the potential directions for the project. The idea of creating a study tool and working on prompts to correct biases resonates with me, and I believe it aligns well with the initial vision for this project.

Your point about accounting for evolving knowledge/understanding is also very insightful. It’s indeed a challenge we need to consider as we move forward.

As for coordinating efforts and avoiding duplicating work, I agree that it’s crucial. Perhaps we could start by mapping out the current landscape of similar projects and identifying areas where our project could add the most value.

I’m looking forward to discussing these ideas further and starting to shape the direction of this project. I’m also eager to hear the thoughts of @Vimala, @michaelh, and others in this discussion.

Thank you again for your valuable input.

Metta,
Jon

2 Likes

I am not a technical person or computer geek but last two weeks my attention was drawn to artificial intelligence and its scary implications (watched a few youtubes on that). Just watched this video interview with Jack Kornfield and Sam Altman (more positive and encouraging) on mindful possibilities for AI to raise collective wisdom and intelligence in the planet and wanted to share here for all.

Youtube: ChatGPT CEO on Mindfulness, AI and the Future of Life.

peace & metta

3 Likes

It might be worth setting up a github with a boilerplate ChatGPT plugin, just to see what kind of improvements are possible for English and Pāli. SuttaCentral is CC licensing and you can’t charge for its content, which I think was your first concern @jgreen01. Since the ChatGPT subscription requires people to pay, I wonder if that’s breaking SC’s license. I tend to think people would already paying a subscription and the payment is for ChatGPT rather than SC content, a bit like paying for an Internet subscription.

One latest update from a week ago to gpt-4 that might allow it to refer to MUID/segments easily is the “function calling” that allows output and input as JSON. Getting the plugin to answer an arbitrary question on a large sutta is a good start I think - what do you all think?. Playing with Tree of Thoughts prompting might work for accuracy reasons. When I first read about CoT-SC and ToT it did remind me of some of my own mindfulness practices of re-thinking and reflecting before deciding things - not to add to any of these kind of claims from OpenAI chief scientist or that Sam Altman interview from @Nava (had not seen - thanks!! Some of his answers very glib, but he says he is a meditation practitioner and asks Jack Kornfield for advice - OK!).

From my perspective the first task is to just make answers accurate, allow it to traverse the suttas and answer questions with more truth for Buddhist scriptures from various sources, maybe inspire new dhamma understandings/talks, rather than as a chat-interface to SC only. 6) is probably worth ignoring til later, quite hard, so I think focus on 5) and 3). 1) and 2) would follow - anything that is more accurately reflective of translated texts already assists with translation I think.

Translation is obviously its own specific task for ML, GPT4/ChatGPT must have done a lot to make its translations the quality it is - might be better to inform actual translators rather than be a better translation imo. Just listen to some translation decisions from Bhante @Sujato or Bhikkhu Bodhi and it’s clear how incredibly complex a choice of translation is - context, history, decades of deliberation, living traditions, private debates and private research, use of alternate definitions that are usually ignored, style, consistency, etc. Even obscure texts outside the suttas could lead to the only accurate translation such as with the word Bodhisatta as an example.

On fine-tuning, I’ve looked at some possibilities for doing this, and so far I haven’t found many good domain-specific fine tuned models on large document sources - if you have seen some please let me know! I am yet to to test until I see a working model in the wild. Much fine tuning is not about knowledge bases/knowing texts accurately but more about instruction following. I think the best strategy would be to set up some fine-tuning datasets or some code to produce such training datasets; make it model-agnostic until a domain-specific model is shown to work for quoting texts accurately and with the right licensing. There is already code on SC for ingesting the multiple languages into the Arrango search vector DB, so maybe this can be used.

There’s a real art to pre-training base models specifically, easy to overfit/not do properly (many domain-specific base models released by big tech fell flat) and specific requirements. Would be ideal but as you mentioned @jgreen01, but hey if a short test can be done to fine-tune a 1.3B model or 13B, even on a small section of suttas(?) would be good to see if there are any hints about how a bigger model would go.

Suggested models for fine-tuning tests:

  • Falcon-40B Instruct model. I don’t think the license allows for supplying the model or its weights publicly, but maybe fine-tuned final layers are ok. License is weird in that if something makes over $10 million you have to give them a cut :/, unsure what other weirdness is in the license. Uses AliBi which allows for training on very large context lengths in theory.
  • Llama and their counterparts like Vicuna and just this week Orca. Licensing for “research” only - I don’t know what that means in practice, I think we definitely could not distribute the model or its weights given this license.
  • BigScience Bloom-176B did not measure up so well. But the infrastructure and training set up to share GPUs over the Internet and use LoRa/QLoRa to train large models with consumer GPUs petals.ml might be a good way to train if the base model we choose is too big for your A100 or will take too long for your wonderful offer @StudentOfLife. If they ever get a Llama model or Falcon model up, could be a good alternative. They’ve mentioned on their discord that other open-source models are in the works. I have some old hardware too with 24GB VRAM and a new card with 16GB. Petals devs also said they’ll be introducing a kind of compute-for-compute credit system like torrents. BLOOM also uses AliBi.
  • PrimeQA (this is transformer based but old). Still gets high benchmark scores for Q&A which is a big use case here I think, and training is short. They keep adding models and it’s by MIT.
3 Likes

Yes, I agree that developing the plugin is the first step. As for the subscription, I see it more like an internet subscription. It’s important to remember that this technology is incredibly new, and OpenAI is just the first to offer it. In the future, it’s likely that users won’t need a subscription, or there will be free LLM options that support plugins like this.

Full disclosure, while I have a strong background in programming, my experience with AI/ML is limited. However, I’m about to start a Data Science Masters program, so I’m eager to learn more about these fields. Training a model is a new concept for me, but it’s one that I’m keen to explore.

The envisioned plugin would allow ChatGPT to access SuttaCentral to answer specific sutta-related queries. I see great potential in this project as a study and possibly research tool, and I’m excited to collaborate with you all.

1 Like

Hello everyone,

I’m excited to share that we’ve made some progress! We’ve set up a GitHub organization called suttaML, thanks to @michaelh. This will be our main workspace for the project.

We’ve also created two projects within the organization: one for the Chat GPT Plugin and another for the Custom LLM. The Chat GPT Plugin project already has some stories added to it, based on our discussions in this thread. However, the Custom LLM project is still empty as we haven’t started working on that aspect yet.

The next steps involve setting up a dev environment and testing a proof-of-concept (POC) version of the plugin. Our focus is on creating a POC version to ensure we all understand how it works.

@Nava, thank you for sharing the interesting video about the Chat GPT CEO. It’s always insightful to hear from the people behind the technology we’re using.

Lastly, I want to express my deepest gratitude to everyone involved in this project. Your contributions, ideas, and support are truly invaluable. A special shout-out to our software development team, specifically @michaelh, @StudentOfLife, and @harishvs. Your expertise, dedication, and collaboration are driving this project forward. Here’s to our continued collaboration, success, and to the exciting journey ahead!

Best regards,
Jon

3 Likes

I’m not sure if you are interested in discussing the dangers/drawbacks of “AI” as it relates to your work, but I just found out about this issue raised about MDN’s recent addition of “AI” to explain code examples on their documentation.

I had always thought that one of the areas where these LLMs excelled was in things related to coding. However you can see from the discussion that it’s doing a very bad job. And with all the LLM work, it gives false information quite shamelessly. Of course software does not have shame, which I guess is the root of the problem.

I wonder how you are going to address these issuse with your plugin.

I’m also unclear how a LLM is goign to to a better job than a human in summarizing suttas. We already have summaries of suttas done by a (highly qualified) human in the Dictionary of Pali Proper Names. And there are very brief summaries already here on SC that were created by another (highly qualified) human.

If you aren’t interested in discussing these things in this thread, then perhaps it could be split off.

2 Likes

Hello @Snowbird,

Thank you for your thoughtful response. I understand your concerns and I’d like to clarify a few things about the two projects we’re working on: the Chat GPT plugin and the custom Language Learning Model (LLM).

The Chat GPT plugin is a tool designed to help Chat GPT access up-to-date information. It’s essentially a way for Chat GPT to connect to data that it was not initially trained on and interact with other services. In our case, we’re aiming to use it to make more accurate information from the SuttaCentral database available. Any translation or interpretation that someone may ask from Chat GPT would be outside the control of the plugin. The plugin is solely a conduit for information.

The custom LLM, on the other hand, is a more ambitious project that we haven’t started yet. It would likely take many months to create and months more to test. The goal of the custom LLM is to create a model that’s specifically trained on the Buddhist Canons and related texts, which could potentially provide more accurate and context-aware translations and hopefully facilitate new research that would be too time consuming today. However, the target audience for the custom LLM would be translators, scholars, and monastics who’d all have a high level of knowledge and could spot errors. It’s not intended to replace human translation or research, but rather to be a tool that can assist those who are already deeply familiar with the texts.

I hope this clarifies our intentions with these projects. We’re very much in the exploratory phase and are open to feedback and suggestions!

Best,
Jon

2 Likes

And I think here is the root of my issue with using SC material for LLM training.

At it’s core the purpose of a LLM is to lie effectively. They are not Large Knowledge Models. Their purpose is to make sure that the next word they say convincingly sounds like a human saying it. There is nothing in the software that tries to make sure that the words they are saying are accurate.

It’s for this reason that I feel that these LLMs are actually antithetical to the Dhamma. Lying is not an accident, it’s the point.

By training ChatGPT on Sutta material, all you are doing is teaching it how to lie more effecively when asked questions about the suttas. I think it’s kind of irresponsible to simply say that what people do with the tool is outside of your control.

I’m sorry to sound like such a downer.

2 Likes

Hi @Snowbird, thank you for your input. It’s always interesting to hear different perspectives on AI.

For anyone who’s curious about the kind of AI tools we’re working with, you might want to explore ChatGPT and Bing Chat. You can find ChatGPT at chat.openai.com and Bing Chat can be accessed from the chat option on www.bing.com.

There’s also an intriguing article, “Top 20 Most Insane Things ChatGPT Has Ever Done”, that shares some creative uses of ChatGPT. It’s quite a read for anyone interested in the potential of AI.

I understand your concerns about the potential for AI to ‘lie’ or misrepresent information. It’s important to remember that AI, including Language Learning Models (LLMs) like the one we’re working with, have limitations. They generate responses based on patterns they’ve learned from large amounts of data, but they don’t understand or know the truth in the way humans do. Therefore, it’s crucial for users to understand these limitations and to always refer to trusted teachers or religious texts before accepting anything generated by an LLM as truth. It’s much like the saying, ‘don’t believe everything you read.’

One idea we’ve been considering is to embed a warning into the plugin itself, reminding users of these limitations each time they interact with it. Do you think that would help address your concerns?

Also, we’d love to have you help us test the plugin when it’s in a usable state. Your perspective could be very valuable in ensuring we’re addressing these important ethical considerations.

And as always, if there are more technical questions or if anyone wants to understand more about our project, I’m here for a chat. Always happy to discuss our work with those who are interested. Feel free to DM or post here.

1 Like

Venerable @Snowbird, thanks for saying these things - your site and posts have been a wonderful way into the scriptures for me. I have been trying to work through these ethics - thanks so much for engaging :pray:. With my previous work with LLMs - I was originally planning to put up a site inspired by yours, where scriptures could be navigable by location, person, list or subject that’s present in multiple parts of the scriptures after I’d checked/rewritten all the outputs, which I was planning to check over the course of some months/years.

Boycotting LLMs is more and more looking like the best ethical position here as this stuff is playing out, but I’ve chosen to try to reform rather than boycott. On top of confident lies these models produce, are we entering a world where unfeeling LLMs are to teach children rather than people, every interaction with any service will be through a chatbot, our intelligence outsourced, our efforts/kamma relinquished to some language model - not to mention large sections of the population becoming redundant or their lives dominated by these things. It’s frightening. I also don’t think that these promise better understandings of dhamma by virtue of being from a super-intelligence, but this may become true for other subjects imo.

You raise that the plugin will do summarisations - super problematic if they purport to interpret the dhamma. The Buddha declared the 4NT are for “one who feels”. I would like it if we could stop the model interpreting too much or at least add a big disclaimer if people are trying to learn dhamma from it directly, as @jgreen01 has suggested.

With these in mind, I’m working on this because:

  • It’s a way to make ChatGPT answer more accurately rather than confidently spitting out falsehoods and misquoting scriptures. Some of its answers are better than those found on many web sites or forums. Better to improve rather than leave people with lies - I think there may be a kind of bad kamma by not attempting to improve it if I can help.
  • It can do things with texts with a great amount of attention, and answer certain kinds of questions that are otherwise extremely arduous to find answers to or produce data about.
  • It is a way into the texts broadly - there is a possibility there will be answers that could lead to an improved dhamma understanding, but in order to do that, it at least needs to go to the texts.

I don’t think developing this plugin will lead to OpenAI utilising it for training - just inference. But this is something to research for sure, and yes something to ponder that it will sound more convincing if it can quote and yet infer wrongly :frowning: .

2 Likes

Is there a way to get an LLM to quote the source of the information associated with the output, every time a statement is made?
Especially when discussing EBTs (or any other specific topic), we notice how precise references are important. If the source of information is given, then at least someone could verify it.

3 Likes

Thank you Venerable @Snowbird for starting a really important conversation!

I work in a university, and we share similar concerns, esp. with regard to supporting proper student growth.

One helpful analogy that has helped me sort through all the concerns is via parallels to the massive proliferation of content on the internet over the past two decades, and the relationship of end-users to all this content. History has many lessons for us (both things to worry about and potential solutions), that I hope we can take forward. The SuttaCentral community has been a critical part of managing and mediating this online relationship between dharma and student, and has a lot of institutional experience that is super valuable in this regard.

This is not a perfect parallel, but I think one particularly apt example for thinking through the human-centered part of the equation is wikipedia, because of its purported stature and authority. I came of age as wikipedia was just starting, and back then there were lots of questions that are still pertinent to ChatGPT-like tools today: how much trust to place in it? how to ensure quality? what purpose does it serve/what kind of tool is wikipedia? How to use wikipedia responsibly? How do we educate students in the use of wikipedia?

The long-term answer to these questions, for me, is that the responsible way to use wikipedia is as a map to ideas/content/vocabulary that are new to me, so that I can begin looking for better sources, and ideally, people to talk to.

I suspect that, once all the hype comes back down to reality, something similar will happen with ChatGPT. It will forever change the way people begin to access information (just as google search and wikipedia did). I think it is important to get ahead of the many problems that you have identified. Just as it became important to teach students to develop a measured approach to wikipedia (i.e. it is not “ground truth”), we as a community have an important role in guiding the responsible use of, relationship to, and improvement of ChatGPT-like tools.

Thank you for joining the discussion and guiding us!

1 Like

Yes I believe some plugins will do that @Ric, the web plugins show their URL sources but not how they arrived at their conclusions necessarily.

2 Likes

But the ability to misrepresent information is a design feature, not a limitation. The purpose of these LLM is to convincingly use Language in a fluent way, not to provide correct information. That the information it presents is sometimes correct is a side effect, not a feature.

I played around quite a bit with ChatGPT asking it questions about Buddhism. It was very impressive how convincingly it could present wrong information. But the number of actual suttas it could present wrong information about was quite limited. If your plugin is attempting to train ChatGPT on a larger body of texts, then it will eventually be able to very convincingly present wrong information about a larger body of texts. No matter how much you feed it, it will still not distinguish between true and false information. And the whole while it will be shockingly convincing.

But they don’t understand or know truth at all. That’s the issue. They only know patterns.

I’m sorry if I seem hyperbolic, but you can’t put poison in someone’s drink and absolve yourself by putting a label on it. Especially if you don’t know how that drink is going to be served. If you want my ethical advice, it would be to not put poison in people’s drinks. Don’t ask me about how you can ethically put poison in people’s drinks.

And besides, once someone feeds the texts into the model, they are no longer in a position to even put a warning on things. So then they’ve poisoned the drink but it won’t be served in a glass with the warning label.

I really don’t mean my criticisms personally. It’s a general issue. But I’m still not seeing any benefit in feeding suttas into these LLMs. I’m open to hearing one, but I haven’t so far.

Honestly I don’t think this is a parallel at all. Encyclopedias could never be used as primary sources in academic situations. And honestly, Wikipedia has never been considered an authority. Moreover, the purpose of Wikipeda is in fact to present references to primary sources. And if there are inaccuracies there is a method for correcting it. This is completely different than these LLMs whose purpose is to sound fluent in language and hide the primary sources all the while being impossible to correct.

There is no shortage of articles out there talking about the problems with these LLMs but I found this one especially interesting:

From the article…
5 Likes