Using ChatGPT to create Unity Scripts and shaders

This basically means:

8736402--1182894--upload_2023-1-17_16-21-11.png

That they should probably rethink their text encoding approach.

I would say anybody interested in translation should use Chat GPT in native language and couple it to one of these translator models https://huggingface.co/models?pipeline_tag=translation&sort=downloads

Yeah, it is breadboarding but until the toolsets arrive that allow integration of various models types and control their order of I/O we are gonna be breadboarding.

1 Like

There is a number of experiments that already chain chatgpt with other model, like langchain.

https://huggingface.co/spaces/JavaFXpert/Chat-GPT-LangChain

Fairly sure their encoding approach is about the smallest information blocks that the AI processes. Some languages happen to put a higher and others a lower amount of information per letter.
At least if DeepL is to be trusted, japanese for example tends to need ~30% less characters than english.
That Telugu symbol there might mean lot maybe? It is an alphabet with 56 characters after all.
Having this discrepancy solely for technical reasons would indeed be unfair, I suppose.

1 Like

It is not about characters. Japanese, for example, requires an alphabet of something like 3000 characters to be usable.

The point is that for a tokenizer “woman” is one character, while that telugu letter is apparently twelve. Which means the model is biased towards english.

Now it is not that bad, because it makes sense for an AI to use a convenient language, and for example, english words do not change based on gender, and rarely use inflection, words are conveniently separated by spaces (japanese ones are not, for example), and so on. Still, if the goal is to make an omnilingual chatbot, it feels like they’ll need to rethink something down the road.

Also, it might make sense to consider alternative language for an “oracle” type AI, and translate from that language into whatever people want to use. Supposedly there were proposals to use lojban for that.

I finally came back to the math problem I was having, I put it to rest because I didn’t want to see math, but chat GPT is really helpful.

Posted Jul 12 2020
:hushed:

I solved the translation into math in like 5mn with its help:

8746908--1184784--upload_2023-1-21_10-53-33.png

I have been using it on my story, which is a setting that doesn’t appear in its training set, using my cultural background which is poorly represented on internet, with elements that are even more obscure. Once I explained the settings, it can like just “run” it. Heck, I was writing a snippet of the intro in which the character have 4 simili mundane obstacle, and it’s been able to link them to the thematic and the relevant elements of the settings instantly, so it understand relation established in the universe, ie data it has never seen before.

I have been highly productive, applying it to every problem I had and not spending days trying to solve them!

Also it know versu, I tried asking turning Kiki delivery service, from Miyazaki, into a game, then translate the game into versu, then create a BDI (Belief, Desire Intent) of Kiki, turn that into versu rules, then write some Emily Short’s quip format, then a Behavior tree of Kiki and asked it translate it into c#, which run.

The thing is, it’s useless to compare it to human intelligence, it’s able to simulate intelligence to a degree, but that’s not ITS intelligence, I think of it like an universal operating system. You can instance one or many model of intelligence it will operate, sometimes in parallel. For example it doesn’t do math correctly, unless you ask it to think like a math teacher, in which it does marginally better (still limited), you can instance many characters, in many type of context type (example a story, but not limited to), have them interact, extract their state toward multiple behavior models at any moment, have them each have a goal, coordinate toward a goal (like character in a story) using action that serve a higher goal (like thematic story goal), extract the behavior toward codes that run, etc …

It’s a new perspective, it’s simulator AS intelligence rather than simulated intelligence. Also both simulator as intelligence and simulated intelligence are side effect of its fundamental intelligence, predicting the next word, which doesn’t know and doesn’t care about those emergent property, the same way human aren’t reducible to chemical in their brain.

1 Like

Except it is not an OS as it can’t run commands and it can’t simulate anything, run anything or run anything in parallel.

Your conversation serves as a temporary memory which defines what kind of response you’re getting and past directives will adjust the likelyhood of responses appearing. Past that point it still outputs “most likely text”.

It also makes sense to compare it with human intelligence, because at least in english it is very likely to pass Turing test with flying colors. Also it raises many philosophical questions without an answer.

A N A L O G Y

Useful method to encode new things in old concepts.

I compare it to human intelligence all the way anyway, but as equivalence of function not similar functioning, just stressing a different nature of intelligence, but people don’t like that too, so there is no way to engage the conversation on the fine ability of the system past absurd extremism of “human like” or “text predictor”. One issue is that text is a format human use to encode a functioning model of human reality and its state, it thus encode efficiently, in a lossy way, elements such as time, space, relations between objects, relation between property, intentions, emotions, etc … in order to predict the next word, you need to “understand” this model and predict the whole state (simulate) as context to the next action (word to pick), in a way that maintain the model as learned. The simulation is therefore a product of choosing the next word, because words are “actions” in that model. It’s like playing go, but the field is human knowledge.

The immediate intelligent property, we interact with, is an emergent property of that. It’s kinda insane that the pseudo intelligence isn’t the behavior of the model, but a side effect of that behavior. The thing is the model is not meant to be human relevant, the relevance is a side effect, that’s why it’s wild in the gpt 2 and 3 form, less so in the chat GPT format because it’s constrained by the training toward certain state. But basically there is still poisoned data that lead to the model making irrelevant state, which is one of the many reason why the intelligence is NOT human, it does thing we don’t approve of in way we don’t know. But is it intelligence. The goal of using these unresolved philosophical question isn’t to muse endlessly on existential idea, but to find analogy to get back to a practical understanding, this ai does challenge some of hard earn assumptions, and we must rebuild a model that is useful to handle such model.

The notion of “not knowing” for example is not helpful when it’s obviously doing something pretty similar, if doesn’t know as we usually assume knowing mean, it surely do something that close enough to be useful, it doesn’t know about cat (in a practical sense), but it knows OF a cat enity, something analogue, like old medieval tapestry got wrong animal they had never seen, they still knew OF them. Similarly if it just reference it’s training data, which is surely does, how to explain the fact it can manipulate novel concepts in way that is human relevant. I mean it’s demonstrable by having it do task, and see where it fail and how, that’s as far as philosophical musing as we can be, and since it’s not exactly humane, and fails in specifics way, that is beyond cherry picking failure and success, how do talk about this new ability? If not by making analogy, while outlining the difference? The training data itself is the storage in which human express knowledge, which it leaned OF and from.

I called it operating system, as in an analogue to explain how we can use it, I can create and manipulate one or many entity with finite boundary, in the working memory, for as long as the entity exist in the memory (which is limited), and I can query and track their state change overtime. Prompt are command analogue. You can also shift the whole system and run it in different mode (using the ignore all previous instructions command), you can even return it to a basic state where it just always try to continue text and forget it’s chat persona. It run on a turn base basis with prompt eliciting the next run. When entity are set to human character instance, they comes with a fully functioning model, in which you set the state, that is quite incredible.

Fun observation, in my current game project, where I use it seriously and not as a toy experiment, If I instantiate character that are too complex, it’s answers get shorter and cut abruptly earlier (for example deeper personality, relations and complex interactions like dialogue) because it becomes harder to tracks all the data. Also It forget much faster, for example I set up 4 clans with distinct functioning, but with complex character it takes just a few round to forget at least one clan, when I query it it says we never talk about it, or its state get diluted (it forget some aspects and fills with generic). I have to set up and manage manually the memory each time I need an element, using a “scratch memory” where I store compressed state I made it create through summary command, to be used when needed.

There is a limit to the number of characters in my actual use case, and it literally crashed when I started having more than 5 complex characters having dialogue (returned consistently error messages, fail to complete, catastrophic forgetting of all states and rebooting essentially the conversation). When I lessened the process, but cutting the scene into manageable chunks of interactions, it was able to complete, but still by chaining multiple rounds. It’s also very consistent, when I important old data, It process them in very similar way. On a more technical level, I pushed it far enough to get an idea of the implementation. Before I thought it was doing something funny with working memory, but it’s basically JUST a glorified ai dungeon. It just happen that the working memory is much bigger and the internal state more stable (constrained) relative to input. Knowing that, by looking at obvious tell of the system, I was able to bypass the limits and act in way that just goes over the limitations, and works.

If we are to share best use of this new tools, we can’t beat around the bushes about what it’s actually able to do. I’m positing that the idea of agent based ai we used to assess these type of ai, ie goal seeking agent optimizing a reward structure, are pointless in understanding the emergent property of this system. Which is were I come with the idea of framework that separate the state of intelligence. With the word predicting optimizer as just the basic layer, that allow the emergent simulator logic to shine, and separating the simulator as intelligence from entity it operate on. This gave IMHO a saner interpretation of the behavior, that is practicable and more importantly actionable. That is you can explain and predict the functioning of the system in plausible way, in such a way you can act on it, like I do in my scenario situation, with memory management, on my project.

No. That’s the problem. You don’t need to understand. You need a reference book with sentences.

Ask ChatGPT about chinese room experiment. And about markov chains.

Again, no.

Imagine a box that stores all possible conversations a person could have with it. When you ask it something, a simple mechanism retrieves a card with a response and returns it to you, and previous conversation serves as library index.

While communicating with the box, you’ll have full illusion of intelligent behavior. But will it be intelligent? Clearly not. It is similar to making a XO playing program, where the program knows every possible state of the game and every appropriate response to it.

ChatGPT is doing something similar.

It does not know, does not understand, but does an amazing job fooling your human brain into thinking t hat it has a mind of its own when it does not, or that it knows, when it does not, or that it thinks when it does not. or that it understands when it does not. As a result you start assigning human qualities to it, talking about it “knowing”, “simulating” etc. When in reality what you have something similar to a box with all possible conversations recorded within.

  1. markov chai aren’t efficient in manupulating anything, they don’t find theme from story.
  2. the chinese room ask if the man in the room understand chinese, but what about the whole contraception, it doesn’t matter because the result are the same if it’s able to perform high level cognition task, I don’t know if you are sentient and not a simulation made to trick me, same concept. Because i’m NOT saying chat GPT understand (ie the first layer of intelligence, or the man in the room if you prefer), I say the emergent model understand (the room, the man and the card), BECAUSE it’s able to manipulate high level idea correctly.

We will agree to disagree on that one, I don’t agree with your assessment. It’s not about fooling, it’s about doing verifiable, quantifiable, tasks. And it’s on a spectrum of the concept. And more importantly, such dogmatic thought are literally useless in approaching the model behavior.

Also you make the fallacy of equating word with human behavior, light simulation is done by machine, it’s not specific to human, if anything I’m highlighting the NON humanness of the machine (simulator as intelligence, which is not human like).

As you said before:
“A N A L O G Y.”

With sufficient amount of training material, Markov chain will find a story. It simply requires a huge body of text where that conversation has occurred.

That’s not what chinese room argument is about.

https://en.wikipedia.org/wiki/Chinese_room

The argument is that something appears to have a mind or understanding, does not necessarily have those. A computer does not know what it is doing, for example.

We also had “Eugene Goosman” which fooled turing test despite being a chatbot without any neurla networks in it.

Also see my earlier argument of “a box with all possible answers”.

It really is about fooling your mind into thinking that this thing has a mind or understanding. In reality you’re riding wave of probabilistic text prediction.

Regarding “verifiable/quantifiable”, excuse me, as far as I can tell, ChatGPT is non-deterministic. Meaning the same input can produce a different output.

As I mentioned earlier, the best idea is to think of it as programmer’s duck.

It also reminds me of my earlier thoughts about Detroit Become Human.
Humans tend to project themselves onto things. They see something human-like, and unconsciously assume that it is a human, just like them. That it has emotions, a mind, and that it is a person. People do that all the time, non stop. One day an AI could arrive which will exploit that human trait, analyze humanity, play our minds to make humans produce responses that suit its needs, and then, perhaps, destroy us all, and we’ll happily help it make it happen, because we’ll be assuming it is our friend and is just like us.

ChatGPT, despite having neither mind nor understanding nor agency is already capable of fooling humans. You talk to it, and it feels like it is an intelligent entity. And as far as I can tell, that feeling is wrong, but that feeling is not something you can control, it is automatic response from your mind.

The amusing thing to consider, however, is that we actually don’t know how ChatGPT operates, because OpenAI no longer releases their findings and models. If we turn paranoia to 11, we could arrive at conclusion that ChatGPT could be something that is not based on GPT3, but is entirely different thing pretending to be a language model. And we can’t prove that’s not the case, because it is a SaaS blackbox.

It is a fun thing to consider, eh?

1 Like

This is a discussion about the subjects @neginfinity and @neoshaman are discussing

Not even chat gpt understand coroutines:)

What did you ask exactly?
Don’t forget you can ask for details on an answer! That’s the great part of it compared to a classic tutorial or the docs.

It gave me a nice example and a list of benefits (am posting an image because formatting is impossible to copy well):
8754601--1186342--upload_2023-1-25_0-4-36.png

We were just talking about potential improvements on my code and it suggested to use coroutines. Once i corrected it on how they work he directly picked up on it :slight_smile: it’s pretty cool how you can get him to output better stuff just in the course of a single chat session

With regard to image creation, I see that Bing now has the Image Creator available ( in the UK at least, its on a rollout for other territories ) using a DALL-E 2 image generator.

It appears that image creation is free, but you are given 25 ‘boosts’ to start with, which give faster processing time. Not sure if ‘free’ will take too long to use, but at least its an option and from what I remember this seems like the cheapest and easiest entry point to playing with this tech, without going as far as installing it on your own device.

Even better if you get Microsoft Rewards you can spend those on buying more boosts, though I’ve not been able to determine the exchange rate.

Its seems pretty basic at the moment, you can’t easily ‘remix’ an existing creation, nor can I see a way to generate a high resolution version, but again as a jumping off point to get to grips with writing good prompts for free seems like its worth it.

2 Likes

Alright, so…

Based on my past interactions with ChatGPT it seems like OpenAI really wants to nerf it into the ground, and turn into some sort of automated bank phonecall responder. It is a reasonable goal, but doesn’t let the tech reach its own potential. After the latest update the thing started to easily lose track of the conversation. Some people comlained about this on reddit. ( Reddit - Dive into anything )
Also, in the faq there’s now information about “memory window” size, supposedly chatgpt remembers about 3000 words… which should probably be improved.

There was a talk on twitter about hacking or jailbreaking it, which was particularly amusing.

Example:

Meanwhile in case of stable diffusion someone managed to make software that alters images based on your instructions which you give in english. This is kinda nuts (the tool is instrucct pix2pix, the details can be seen here:
Reddit - Dive into anything )

Overall I feel like it would be great if someone stepped up and made an opensource clone of ChatGPT, but apparently computational requirements are still too high to develop and run this, unless a huge breakthrough happens literally tomorrow.

Meanwhile in regards of writing, I managed to finally load a local KoboldAI ( GitHub - KoboldAI/KoboldAI-Client ) model with 6 billion parameters without frying my PC (last time an attempt to run the largest model almost killed my computer), and … it is not as awful as I remember, though you obviously can’t talk with it the same way or use it to get information about codebases. Those trying to use ChatGPT for writing might want to give it a try, though using it is similar to switching from midjourney to stable diffusion. While Midjourney often “understands” words, stable diffusion needs babystting, same deal with KoboldAI. It requires babysitting.[/spoiler]

3 Likes

One more thing. “ChatGPT prompt hacking” and results returned by it implies that the model is actually general purpose and might not be geared towards chatting, and instead relies on external data appended to openai prompt. Meaning you could probably make other models act in similar model providing similar background.

I tried this with KoboldAI.

Basically the idea is to provide background information in an opening prompt (which is hidden in case of ChatGPT), which would specify the mood and mode of conversation and then have things roll from there.

Opening prompt (fed into the model to start it up):

This makes the model “assume” this is a story written from point of view of the chatbot.

And the result…

Gotta say this thing is dumb as a brick. (well, it is a tiny model)

Looking at responses in console, apparently “Chat mode” means that the model only returns first line of input, and discards the rest. in reality the model invents continuation of the dialogue which is not displayed…

Perhaps this could be interesting to someone.

1 Like

You can instruct it to replace the prompt with a new one too.

8764930--1188682--upload_2023-1-29_8-2-41.png

4 Likes

Here is some code if you get an API key. Adjusting params gets some interesting responses. I once typed “What is the lergest country in the world?” And the gibberish was off the charts in the reply. It was trying to make sense of lergest and was substituting “bigdog. tallest. most smaller” and other attempts to tokenize the question. Anyways the fields that affect responses are there and a timer to see how long a response is sent and a queue…implement it yourself. Chat GPT was very little help in writing this and gave me lots of false starts. I decided to just manually parse stuff though I did leave in the faulty class it suggested for its response parsing of the JSON object…

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Networking;
using TMPro;
public class ChatGPTController : MonoBehaviour {
    public string apiKey = "";
    public string postURL = "https://api.openai.com/v1/engines/davinci/completions";
    // public string model = "text-davinci-002";
    public string prompt = "";
    public float temperature;
    public float presence_penalty;
    public float frequency_penalty;
    public float top_p;
    public int max_tokens = 512;
    public List<string> stopWords;
    public List<string> responseQueue;
    public string currResponse;
    public float responseTime;

    public TMP_InputField promptInputFld;
    public TMP_Text chatGPTOutputTxt;
    public TMP_Text promptTokensReadout;
    public TMP_Text completionTokensReadout;
    public TMP_Text totalTokensReadout;
    public TMP_Text responseTimeReadout;
    public TMP_Text responseIdReadout;
    public float timer;
    bool startTimer;
    bool querySent;
    bool responded;

    void Update () {
        if ( querySent && responded ) {
            startTimer = false;
            responseTime = timer;
            responseTimeReadout.text = responseTime.ToString();
            querySent = false;
            responded = false;
        }
        if ( startTimer ) {
            timer += Time.deltaTime;
        }
    }
    public void PostPromptFromInputField () {
        Debug.Log("PostPromptFromInputField ()" + promptInputFld.text);
        prompt = promptInputFld.text;
        PostChatGPTQuery(prompt);
        startTimer = true;
        timer = 0.0f;
    }
    public void PostChatGPTQuery (string _prompt) {
        prompt = _prompt;
        StartCoroutine(SendRequest());
    }

    IEnumerator SendRequest () {
        querySent = true;
        ChatGPTJSON json = new ChatGPTJSON();
        //json.model = model;
        json.prompt = prompt;
        json.temperature = temperature;
        json.presence_penalty = presence_penalty;
        json.frequency_penalty = frequency_penalty;
        json.top_p = top_p;
        json.max_tokens = max_tokens;
        if ( stopWords.Count > 0 ) {
            //json.stop = stopWords.ToArray();
        }
        string jsonStr = JsonUtility.ToJson(json);
        byte [] jsonBytes = System.Text.Encoding.UTF8.GetBytes(jsonStr);

        UnityWebRequest request = UnityWebRequest.Post(postURL, jsonStr);
        request.uploadHandler = new UploadHandlerRaw(jsonBytes);
        request.downloadHandler = new DownloadHandlerBuffer();
        request.SetRequestHeader("Content-Type", "application/json");
        request.SetRequestHeader("Authorization", "Bearer " + apiKey);
        Debug.Log("SendRequest () -> " + postURL + " -> jsonStr  : " + jsonStr);
        yield return request.SendWebRequest();

        if ( request.result == UnityWebRequest.Result.ConnectionError ) {
            Debug.Log(request.error);
        } else {
            currResponse = request.downloadHandler.text;
            Debug.Log("Response : " + currResponse);
            LogResponse(currResponse);
        }
    }
    public void LogResponse (string _currResponse) {
        responded = true;
        ChatGPTResponseJSON response = JsonUtility.FromJson<ChatGPTResponseJSON>(_currResponse);
      
        Debug.Log("response.id = " + response.id);
        Debug.Log("response.usage.prompt_tokens = " + response.usage.prompt_tokens);
        Debug.Log("response.usage.completion_tokens = " + response.usage.completion_tokens);
        Debug.Log("response.usage.total_tokens = " + response.usage.total_tokens);
        Debug.Log("response.choices.text = " + response.choices [0].text.Trim());
        promptTokensReadout.text = response.usage.prompt_tokens.ToString();
        completionTokensReadout.text = response.usage.completion_tokens.ToString();
        totalTokensReadout.text = response.usage.total_tokens.ToString();
        responseIdReadout.text = response.id;
        chatGPTOutputTxt.text = response.choices [0].text.Trim();
        responseQueue.Add(chatGPTOutputTxt.text);
    }
    public string ConsumeResponseFromStack () {
        if ( responseQueue.Count == 0 ) {
            return "";
        }
        string r = responseQueue [responseQueue.Count - 1];
        responseQueue.RemoveAt(responseQueue.Count - 1);
        return r;
    }
    public string ConsumeResponseFromQueue () {
        if ( responseQueue.Count == 0 ) {
            return "";
        }
        string r = responseQueue [0];
        responseQueue.RemoveAt(0);
        return r;
    }
    public List<string> ReturnAllResponses () {
        return responseQueue;
    }
}
[Serializable]
public class ChatGPTJSON {
    //[SerializeField] public string model = "";
    [SerializeField] public string prompt = "";
    [SerializeField] public float temperature = 0f;
    [SerializeField] public int max_tokens = 150;
    [SerializeField] public float top_p = 0.9f;
    [SerializeField] public float frequency_penalty;
    [SerializeField] public float presence_penalty;
    //public string [] stop = new string [0];
}
[Serializable]
public class ChatGPTResponse {
    //faulty  JSON object as suggested by ChatGPT
    [SerializeField] public string id;
    [SerializeField] public string [] choices;
    [SerializeField] public string [] stop;
    [SerializeField] public object [] log;
    [SerializeField] public object [] warnings;
    [SerializeField] public string [] generated_text;
}
[Serializable]
public class ChatGPTResponseJSON {
    [SerializeField] public string id = "";
    [SerializeField] public string _object = "";
    [SerializeField] public int created;
    [SerializeField] public string model;
    [SerializeField] public Choices [] choices = new Choices [0];
    [SerializeField] public Usage usage = new Usage();


    [Serializable]
    public class Usage {
        [SerializeField] public int prompt_tokens = 0;
        [SerializeField] public int completion_tokens = 0;
        [SerializeField] public int total_tokens = 0;
    }

    [Serializable]
    public class Choices {
        [SerializeField] public string text = "";
        [SerializeField] public int index;
        [SerializeField] public string logprobs;
        [SerializeField] public string finish_reason;
    }
}