High Value Project Tutorials - Why I Do Not Let The AIs To Fully Code DataPredict™

Introduction

Some people want to argue that they don’t have to pay for a comprehensive pure Lua machine learning library and they’ll just ask the AIs to fully code a DataPredict™ competitor.

My reaction? Indifference.

I already know on how this would go.

In fact, I have seen fully AI-generated competitors died immediately (in terms of popularity and maintainance) after being released to the public.

DataPredict™ has existed since around February 2023, where that is where ChatGPT is around. So I had every opportunity to let the AI do the work for me.

Some people want to argue that AI models back then wasn’t that good back then, and tell me that I should use latest models.

I did, including the day that you are reading this document right now. This includes using ChatGPT, LLama, Gemini, Mistral, Qwen, DeepSeek, Kimi and many others. I have tested them all under a lot of different configurations like choosing between high and low thinking modes, personalizing my prompts and so on.

The AIs still had glaring problems. The AIs will always have them.

The AIs are good in general software engineering, I’m not going to deny that.

But software engineering that is heavy in mathematics? This is where the AIs will screw up the most.

I don’t remember how many times that I kept encountering mathematical issues generated by AIs.

There’s a good reason why despite the claims of AI having PhD intelligence, the newest AI models are still built by PhD people and not the older AI models themselves.

Below, I will list what I kept encountering despite me using the latest AI technologies.

Common Issues Encountered With AI-Generated Codes

  • Unlike the general software engineering projects where functionality errors are easy to visualize and to fix by the AIs, the mathematical errors tend to be silent and not raise any errors. This means that if the AIs misses the bugs related to mathematics and the AI receives no errors, the AIs will assume it is working without checking the individual first derivative values. You have to be very explicit about the first derivative values when you use AI to generate tests. A first-time library developer will not be aware that they need a more sophiscated tests than what is given by the AIs. Also, I am not confusing this with the unavoidable floating-point errors.

  • Even if I had given them research papers directly, they would still hallucinate for some reason. This can be seen with Proximal Policy Optimization, where the AI insists on saying my base implementation of Proximal Policy Optimization is wrong due to lack of clipped objective or the entropy terms. However, as seen in OpenAI’s Spinning Up website, those are two different variants separate from the original Proximal Policy Optimization. What made this even worse, OpenAI is the original developer for Proximal Policy Optimization and acknowledged the fact that there are two variants of Proximal Policy Optimization, where the clipped objective and the entropy terms are just extensions to this algorithm.

  • Since they are trained on existing data, the more complex first derivatives tend to be incorrect as they are not present in the wild. For example, the first derivatives for the Factorization Machines kept changing whenever I regenerate the AIs’ texts despite the same prompt. It can be made worse if I made it to show the individual steps. At that point, I gave up having the AI doing the first derivative mathematics and use Google it, WolframAlpha or I do all of the derivations myself. Granted, I would make a mistake once in a while, but it wasn’t that common compared to AI-generated codes. Also, I am not confusing this with different mathematical notations, but I do suspect that AIs being trained on different mathematical notations for the same algorithm leads to these first derivative issues.

  • Related to the point above, any simplification made to the formula or the first derivative formula is a hit or miss. Sometimes the AI would argue that your simplification is correct, sometimes the AI would argue that your simplification are not correct. The siimplification is required here because I want to optimize DataPredict™ by removing redundant calculations. This effect will be very obvious when it comes to letting the AI to do the first derivative of a logistic regression algorithm. Even asking for steps isn’t even a guarantee that the AI will get it right.

  • For things that are well-known like Neural Networks, they suffer certain code rigidity which would be extremely bad if you want to do optimizations on the existing codes since the AIs’ rely on their own ideas of the “correct” implementation for these codes. This is especially noticeable if you have hand-crafted the neural network codes that have all the hand-crafted optimizations. Even if you tell the AIs’ not to touch those codes at all costs and at all times, the AIs will literally change those correct and optimized codes if they see that the codes that the AIs generated themselves produces wrong results. They will literally insist that the reason for incorrect results was due to the previous codes you had prior to AIs’ code changes and the AIs are “forced” to change them, leading the resulting codes to be either unoptimized, incorrect, broken or all of them.

  • Whenever I attempt to do time complexity and space complexity analysis for optimizations relating to matrix operations, it kept changing whenever I regenerate the AIs’ texts despite the same prompt. It can be made worse if I made it to show the individual steps.

  • The AI seem to never even apply Inheritance, Composition, DRY, SOLID, and Design Patterns properly that is common in my codebase. I literally need this to make sure my code to be maintainable. I also need it to be readable for everyone including the AIs.

  • My DataPredict™ library codes for individual objects are already interacting with each other in the most very strange way, with their own very strange external API. Because of this strangeness that is required for DataPredict™ library, a single DataPredict™ API code change breaks every other interacting codes.

  • The AI can be easily confused if the algorithm has these two conditions:

    • The AI has a general assumption of doing gradient descent and not gradient ascent when it comes to first derivative formulation.

    • Switch the predictedLabelBalue - labelValue to labelValue - predictedLabelBalue in mean squared error cost function and its first derivatives.

  • When it comes to building a pure Lua tensor library to be used by DataPredict™, they have this bias towards making this library towards object-oriented programming approach. The AIs will insist on saying object-oriented programming being more performant when compared to purely functional one due to the so-called “memory allocation” savings when creating new tensors. However, this is not true since both object-oriented programming and functional programming approaches requires memory allocations for creating new tensors. On top of that the AIs did not take account of performance overhead from having metamethods from object-oriented programming approach. They may also cite broadcasting and deep copy inefficiencies as an exclusive problem to the functional programming approach, when you technically can create similar inefficiencies with the object-oriented programming approach.

History Of Building DataPredict™ With AIs

Do you want to know why DataPredict™ is overly verbose?

During the first three months of DataPredict™’s development, I used the AI too excessively but never checked the correctness. I then get complaints that the library doesn’t work. This is where I began doing first derivative by hand and realized how wrong the AI was…

I then asked the AI to show steps. Somehow, the first derivatives kept changing whenever I regenerate the AI texts with the same prompt.

From here, I pay very close attention whenever they do derivations and convert those derivations to code.

Even the process of translation from mathematics to code is problematic for the AIs. It kept mixing up these derivatives if you don’t ask them to separate different parts of gradient calculations:

  • The derivative in respect of inputs.

  • The derivative in respect of activation functions.

  • The derivative in respect of the cost functions.

As a result, I have became paranoid about my first derivatives and made sure the variable names are verbose so that I can understand which variables are for which part of the first derivative calculations. The once that does not use first derivatives eventually follow suit for their variable names just to keep track on the correctness of the mathemaically-heavy codes.

The Absurd Requirements For Building DataPredict™

While I told everyone that building DataPredict™ requires a near-PhD knowledge, I never really covered in depth what it actually entails. Below, I will tell you what knowledge I had used when applying DataPredict.

Formal Knowledge

IGCSE

  • Business Studies: This subject creates a foundation for creating products that are competitive or better to the existing ones. This also allowed me to understand on how to price DataPredict™ library for commercial uses.

A-Levels

  • Mathematics: This subject allows me to do first derivatives which is one of the A-Levels mathematics’ topics. However, this don’t generally cover derivatives involving matrices and tensors.

  • Physics: While this subject is unrelated to machine learning, it allowed me to explore game development easily due to games having a lot of physics simulations. As a result, this indirectly lead me to Roblox game development and eventually made me aware of machine learning technological gap in the Roblox’s and Lua’s ecosystem. Without this subject, I would probably never build DataPredict™ library as this library is built for Roblox and pure Lua.

Bachelor In Computer Science With Artificial intelligence

  • Programming And Algorithms: This subject allows me to understand how pointers work, which is quite common in Lua. I also learnt recursion here which is important for creating N-dimensional tensor library, TensorL, where it uses nested Lua tables to represent the tensors.

  • Mathematics For Computer Scientists 1 & 2: The first part of the subject allowed me to read complicated mathematical notations, but I was still not good back then until I had a lot of practice when implementing DataPredict™’s algorithms from mathematical formulations. The second part of the subject is what allowed me to implement the adjugate method for matrix inversion to code.

  • Algorithm Correctness And Efficiency: This subject allows me to understand what redudant calculations can be removed or cached during all of the algorithms’ optimization. This enables all of these algorithms to train between game frames.

  • Software Engineering Group Project. This subject what got me to fully learn how to code in Lua and Roblox’s game engine, Roblox Studio, for almost one year because our group were developing a Roblox game back then. While this is unintentional, this knowledge proved useful for coding a native Lua machine learning library like DataPredict™. Also, since I was the new leader for this group, I realized that integrating other people’s codes can be quite painful. This in turn reflects back to my code designs including the DataPredict™ library where I would make sure that that my libraries are easy to integrate with the existing codebases.

  • Software Maintenance: This subject allows me to be efficient in adding and extending algoritms since this subject has trained me to be more disciplined in Inheritance, Composition, DRY, SOLID, and Design Patterns for all kinds of codebases including DataPredict™.

  • Human Computer Interaction: This subject allowed me to create DataPredict™’s API designs that are comfortable for those who are not used to apply machine learning to their projects. If the users feel that the API design is uncomfortable to use, they are likely to think that the machine learning stuff are complicated. The API design extends to variable names, function names and how users would use those functions. It also directly contributes on how I design my documentation on my GitHub repositories including the DataPredict™ library.

  • Machine Learning: This subject acted as more of a suplement to my online courses. However, I did extract some of the useful machine learning algorithms that I had not learn from my online courses and implemented it directly to DataPredict™ library.

  • Computer Vision: Again, this subject acted as more of a suplement to my online courses. But this time around, there’s not much useful knowledge I can extract from other than refreshing my existing knowledge.

  • Designing Intelligent Agents: This subject is the starting point of my understanding the value of how machine learning, deep learning and reinforcement learning could be applied to games.

  • Professional Ethics In Computing: This subject allowed me to realize law-related value of the DataPredict™ library. I also learnt how contracts actually work, which is required for producing DataPredict™’s licenses.

  • Fundamentals Of Information Visualizations: This subject allowed me to understand different data types for machine learning, which leads to me implement rare algorithms like Ordinal Regression and many more to the DataPredict™ library.

Master In Artificial Intelligence (Half Coursework And Half Research)

  • Data Science: This subject made me realize the business value of the DataPredict™ library, leading me to write comprehensive high-value project tutorials for the DataPredict™ library. It also enabled me to add new statistical algorithms (like variants of Least Squares), solvers (like Gauss-Newton) and many more. These statistical algorithms served the same purpose to machine learning library where they learn patterns from data, but a bit more sample efficient than the machine learning algorithms.

  • Business Modelling: While this subject not related to machine learning or statistics, the lecturer made us apply our existing knowledge to novel ways for business modelling. This has led to further expansion of DataPredict™’s features that would be useful for more advanced use cases.

Online Course Knowledge

After the completion of my A-Levels and before my enrollment to the university, I had taken up several online knowledge just to evaluate what university courses that fits me the most before I make an irreversible decision.

  • Machine Learning: This subject is where I become comfortable to extend my A-Levels first derivative knowledge to matrices. Not to mention, this course helped me separated different parts of the gradient-based optimization algorithms into these main parts:

    • Calculation and derivative of hypothesis functions.

    • Calculation and derivative of cost functions.

    • Gradient descent.

  • Deep Learning: This is where I build upon my existing machine learning knowledge where I deal first derivatives from matrices to tensors. This is where I learn on how broadcasted tensors leads to collapsed first derivative tensors and accumulate the gradients along the broadcasted axes. In addition, I also learnt how algorithms can learn from images, texts and audio from this subject. While it looked complicated when I first started this course, I eventually get it once I write these algorithms by hand many times in the DataPredict™ library.

Experience Knowledge

  • Whenever I encounter gradient-based optimization algorithms, I would look into multiple websites for first derivatives and eventually do gradient descent or ascent formulation. Eventually, this makes my brain automatically create the first derivatives formulation without needing to visit any websites except in hard cases or purely to save time.

  • For algorithms I never implemented in DataPredict™, I generally looked into multiple websites to see all the optimization formulation and see the individual steps before translating into code. I tend to skip algorithms that has mathematical notations that are hard to read and converted to code. From there, I take on the more easier ones first, which sometimes ends uo leading me to converting harder algorithms to code.

Conclusion

If anyone thinking they can simply let the AI to fully code a library like DataPredict™, I would tell them to spend their AIs’ tokens somewhere else.

This is why I am unconcerned about about open-source AI-generated competitors to DataPredict™. I am already aware that if someone to do that, they will get the mathematics wrong, which in turns lead to wrong predictions and lead to loss of revenue. In addition, the game developers tend to be sensitive to risks since games don’t generate a lot of revenue. As a result, if an algorithm’s prediction is off even for a sligthest margin and that leads to loses in revenue, the game developers will remove the library eventually. I have seen this repeated for over three years now.

So build it properly by hand or license DataPredict™. The three years of development isn’t there for nothing. It is there to make sure the algorithms’ mathematics are correct and keeping them optimized for real-time use cases.


This site uses Just the Docs, a documentation theme for Jekyll.