I was pondering how detection of AI generated text might work. Since GPT and the like are large language models (LLM) with varying context awareness they are basically Markov chains on steroids. Ofcourse none of the detect-AI-generated-text slingers really want to disclose their secret sauce as it would kill their business case, so we can only guess.
The way I would solve it is either by
For context the very basics of a Markov chain in text generation is that it uses the last output word as input for selecting the next word based on how likely it is to follow the input word. Which is also where the context and good chaining comes in with these LLMs. For instance if your text generation tool only looks at the last word to build upon it is bound to run into quirks that will quickly show that the text is generated.
Ages ago I wrote a tool to use Markov chains to generate credible text, it did however lack all awareness of context and subject and just blindly followed its training data sets using the most likely next step with no regard to anything else. This is also why the amount of available quality training data is so important. Then a rendering layer can be applied to polishup the text for it to really be credible.
More information on Markov chains on Wikipedia and on Brilliant.org or view a video on the subject.
Where better to ask this question but chat-gpt?
My query:
Please describe a few ways you would design a system to detect if a text is generated by a LLM such as chatGPT or written by a human? Also outline which would be the the fastest version and wich would be the most correct version.
ChatGPT
Designing a system to detect whether a text is generated by a language model like ChatGPT or written by a human is a challenging task. There are several approaches you can consider, each with its own trade-offs in terms of speed and accuracy. Here are a few possible methods:
Statistical Analysis: One approach is to analyze various statistical properties of the text. Language models like GPT tend to have certain statistical patterns that differ from human writing. You can extract features such as word frequency distributions, n-gram frequencies, sentence length, punctuation usage, and syntactic structures. By comparing these features with known human-written texts and language model-generated texts, you can train a classifier to differentiate between the two. This method can be relatively fast but may not be as accurate as other approaches.
Linguistic Analysis: Another approach involves analyzing the linguistic characteristics of the text. Human writing often exhibits certain linguistic nuances, such as context coherence, logical reasoning, consistency, and domain-specific knowledge. By analyzing the text for these linguistic cues, you can build a system that can detect if a text is likely to be generated by a language model. This method can be more accurate than statistical analysis but may require more computational resources and time.
Fine-Tuning: You can fine-tune a pre-trained language model like GPT specifically for the task of distinguishing between human and machine-generated texts. By training the model on a dataset that consists of both human and machine-generated texts, it can learn to identify the differences between the two. This approach can provide good accuracy, but it requires significant computational resources and time for training.
In terms of speed, the statistical analysis approach would likely be the fastest as it involves extracting features and comparing them without the need for extensive computational processing. However, its accuracy may be limited compared to the other methods.
The most correct version would likely involve a combination of the linguistic analysis and fine-tuning approaches. By leveraging both the statistical properties and the linguistic cues, you can develop a more robust system that is capable of detecting machine-generated texts with higher accuracy. However, this would require more computational resources and time for both feature extraction and model training.
It's important to note that distinguishing between human and machine-generated texts can be a challenging task, especially as language models become more sophisticated. Therefore, achieving high accuracy and speed simultaneously may require ongoing research and development to keep up with advancements in language generation technology. (ChatGPT3 with DaVinci 002 rendering)
Notice how it picked up my badly chosen choise of correct rather than accurate above. So this was not at all like how I would have thought of doing it, and that might be because the training data it is trained with is very limited after 2021 and back then there was little discussion on this subject.
Not a very conclusive post but rather a shower thought that I needed to get out of my system.