Monkeys on Typewriters
AI will take your job - AI will make it easier until it does - AI in Python and C++ using Copilot - AI does not know the difference
If you've read any of the articles or tried the examples in the repository from the Python geotechTools on GitHub series, you've already been exposed to Python code written by AI. Over the last year, many entry barriers have fallen silently, and the quality of the experience came as a surprise to me when I took the dive (shoutout to my colleague James who told me to try GitHub Copilot last year).
The rapid advancement of Artificial Intelligence (AI) poses a significant threat to traditional job structures due to its ability to perform tasks with greater efficiency and accuracy than humans. AI excels in areas such as pattern recognition, data analysis, and executing repetitive tasks, making it a cost-effective solution for employers in industries ... blah blah blah. This and four more paragraphs were obviously written by ChatGPT4. Or you could read Will AI take my job? - hopefully written by a human (Not that it makes any difference, right?). Erik Ronald (coincidentally today) had some valid points on AI in mining software. ABC News Australia raised it yesterday: Heard AI is coming for your job?
If you've been browsing the articles for the fun of it but still think coding and that stuff is for the younger generation, and you're confident your proficiency with Excel is all you need ... I guess you're retiring soon anyway, right?
GitHub Copilot
GitHub Copilot is an AI tool developed by GitHub and OpenAI (fully and partially owned by Microsoft, respectively). It plugs (after forking out $10 US/month) into your integrated development environments (IDEs), such as Visual Studio, Visual Studio Code, Neovim and JetBrains. It seamlessly works in the background, interpreting lines above and below your cursor position and uses all files you currently have open as context.
It will prompt (light grey) the suggested code, easily accepted by pressing 'tab', (with up to nine alternatives, pressing 'alt-.'). An example from Principal Stress Transformations:
Now this comes in handy and makes coding faster, a very real benefit for repetitive tasks. The ability to predict patterns is already quite intriguing:
Now this next step goes further, but I can see the influence of other code I wrote that it saw in my repository:
For this part of the code where I keep listed headers in xyzData in assigned positions (in particular x,y,z are 0,1,2 for practical aspects) I had a vague idea where I was going when I typed the first few lines and I was impressed with the correct suggestion:
Pushing the clever predictions further, the Principal Stress Transformations feature five lines that do the intended job, except I don't want [::-1] as the first principal stress S1 should be the lowest value (negative stress is compressive).
Microsoft Edge also features a Bing Copilot "Your everyday AI companion", recently featured in a Super Bowl ad, that can reply to code requests:
领英推荐
One of the most surprising examples I have seen so far is in our libraries to work with numerical simulation files. Here, output from a model created in StopeX is packaged into an Abaqus input file. At this point, we're writing the SIMULIA Abaqus USER MATERIAL card with the parameters for the IUCM user subroutine. The prompt has the correct syntax for the Abaqus Input file (*.inp) elastic material card and parameters:
So "*MATERIAL" - correct, "*DENSITY"- correct, "*ELASTIC"- correct, with parameters, and no "*DEPVAR" (no additional internal state variables that are needed for the user subroutine) - correct. There was no template for this in the code or files I was writing, and where this knowledge came from still eludes me.
One more impressive application example: Cavroc's IUCM model prides itself in "a detailed and transparent description of all the model’s components". In my upcoming talk at the Eastern Australian Ground Control Group, I wanted to support this with a slide showing a snippet of the actual Abaqus implementation. Do I show some code (real that I have written)? Yes. Does it give away IP? No. Why?
Can you turn the equations in the image into C++ code?
I love the confident opening with "Certainly! ... " and appreciate the "Remember to replace the /* initial value */ comments with actual values based on your specific problem. If you have any further questions or need additional assistance, feel free to ask! ??"
So, I can put my feet up and let the robots code ...
Monkeys on Typewriters
Now, the caveat ... just as much as self-driving cars will be delayed if they swerve for the teddy bear and hit the pram, AI seems to know what it is doing until it doesn't. As much as DALL·E image generation (thanks to Marcos Jacinto for valuable suggestions and inspiration from his Python article) has some bizarre outcomes (above robots came from a prompt that included my 'middle-aged, slightly overweight, thinning short hair' self-assessment for the fun of it), so is the suggested code plagued with flaws and misinterpretations. (Also, I thought I'd share the monkey image that was cropped at the title in its full magnificence at this point).
Examples include wrong indexing and assuming properties of libraries that do not exist (just because Abaqus odbAccess features array objects does not mean these have sum methods defined like numpy arrays). Copilot also seems to learn from my mistakes and repeat them. If you know what you're doing you can spot these problems easily. If not there's no hope of success.
Bottom Line
A lot of us are already working faster and more productively. In particular when it comes to insights from data. I'm using my own Python geotechTools on a daily basis, and they save me a lot of time when it comes to analysing and interpreting data. If you look at tools like JetBrains DataSpell IDE that combine elements of coding with the interactive ways you'd find in Power BI (or Excel pivot tables if you insist), you'll find another great example of the step change happening.
Please share your thoughts and stories on the prevalence of AI and emerging copilots everywhere. Have you used them? Did the outcomes meet expectations?
References
Vakili, A. 2016, An improved unified constitutive model for rock material and guidelines for its application in numerical modelling, Computers and Geotechnics, Volume 80, December 2016, Pages 261-282, ISSN 0266-352X, https://dx.doi.org/10.1016/j.compgeo.2016.08.020
Data GeoScientist at Geowellex ? Geologist ? M.Sc. in Geodynamics and Geophysics ? MBA in Cloud Engineering & Archicture
1 年Great images! Thanks for mentioning me, Stephan!
Principal Geotechnical Engineer @ Mining One Consultants | MAusIMM CP(Geotech) RPEQ Founder @ Cavroc
1 年I am truly speechless ?? ????
Principal Consultant | Mining Geology | Mineral Resources | Exploration
1 年Good stuff Stephan!
Chief Geotech - Mining enthusiast and experienced in underground mining
1 年Thank you for sharing Stephan. I will definitely give Copilot a try