AI Coding with AI: How ChatGPT Helped Me Optimize AI Stock Trading

For the past few weeks, I’ve been deep in the trenches, optimizing AI Stock Trading with cuDNN and libTorch to improve speed and efficiency. But this time, I wasn’t working alone.

I had a coding co-pilot.

No, not a junior developer—ChatGPT.

Now, I know what you’re thinking. “Can AI really write AI?” Well, yes and no. While it’s definitely not a replacement for a programmer (yet), it has been an invaluable tool for accelerating my workflow and teaching me new techniques along the way.

The Challenge: Scaling AI Stock Trading

AI Stock Trading has been evolving for years, but as the system grows, training speed became a bottleneck.

The goal isn’t just faster training—it’s about reclaiming time for higher-level optimizations. Instead of tweaking low-level AI performance, I want to focus on fine-tuning the genetic algorithm that drives the system’s evolution.

  • Slow training limited experimentation – Longer iterations meant I couldn’t test new genetic algorithm techniques as quickly as I wanted.
  • Neural network execution needed optimization – Faster processing meant less time waiting and more time evolving AI strategies.
  • cuDNN and libTorch were the solution – Leveraging cuDNN’s GPU acceleration and libTorch’s C++ deep learning framework drastically reduced training time, freeing me to focus on the bigger picture.

I could have spent weeks fine-tuning low-level optimizations, but that’s not where my time is best spent. Instead, I leveraged AI itself to handle the lower-level work, allowing me to focus on evolving intelligence.

From Hand-Tuned CUDA to cuDNN Graphs: A Faster Path Forward

Two years ago, I hand-coded CUDA in C to accelerate training. At the time, it was a massive performance boost, improving training speed by hundreds of percent over CPU processing.

But technology moves fast.

What was once a cutting-edge solution is now outdated.

Today, cuDNN Graphs and direct libTorch integration make everything faster, easier, and more efficient. Instead of manually writing CUDA kernels, I now:

  • Use cuDNN Graphs to dynamically optimize the execution pipeline.
  • Run deep learning models natively in C++ with libTorch, eliminating unnecessary overhead.
  • Let NVIDIA’s optimized backend handle low-level memory management, so I can focus on AI strategy.

The difference? Less time tweaking CUDA, more time evolving AI.

ChatGPT: Not Perfect, but a Huge Time Saver

Using ChatGPT, I write code faster than ever before. While it doesn’t always produce perfect code, that’s not the point.

It’s like having a coding assistant who isn’t always right, but always useful.

Here’s where it really helped:

  • Learning new libraries – It explained how cuDNN handles tensor operations, saving me hours of digging through documentation.
  • Generating functional code – Even when imperfect, it provided a solid starting point, reducing time spent on boilerplate.
  • Debugging and refactoring – Instead of wasting hours deciphering error messages, I could ask ChatGPT for insights and keep moving.

I expected basic syntax suggestions—instead, I got a serious productivity boost.

AI Isn’t Replacing Programmers (Yet), But It’s Changing How We Work

Let’s be real—AI isn’t replacing programmers just yet. It still makes mistakes and doesn’t fully understand context like an experienced developer.

But it is making programming faster and more efficient.

Instead of digging through API docs, I can get a quick, clear answer in seconds. Instead of writing hundreds of lines of boring code, I get a solid framework to refine and improve.

I can absolutely see a future where LLMs improve their own code, writing faster and more optimized AI without human intervention. But for now, it’s a tool—and like any tool, it’s all about how you use it.

What’s Next? Evolving AI Beyond Training

With training speed no longer a bottleneck, I can shift focus from optimizing a single AI to evolving populations of AI traders that learn, compete, and refine each other.

  • AI Ecosystem Development – Instead of training in isolation, AI traders will interact, adapt, and challenge each other, simulating real market dynamics.
  • Genetic Algorithm Advancements – Faster iterations mean I can refine mutation and selection strategies to evolve smarter, adaptive trading agents.
  • Self-Improving AI Strategies – By fostering competition and cooperation between AI agents, the system can uncover new trading patterns and push itself to higher intelligence.

This is the next frontier—not just training AI, but evolving AI populations that drive each other toward peak performance.

Final Thoughts: AI Helping AI

AI is making AI development easier. That’s the real takeaway here.

ChatGPT didn’t just help me write code faster—it helped me learn faster. And in a field where speed and efficiency mean everything, that’s a game-changer.

Want to see AI Stock Trading in action? Follow the progress at www.ai-stocktrading.com.