transcribe

Ep. 365: Stefan Jansen on Agentic AI, ML Workflows and the Evolution of Machine Learning for Trading

Macro Hive · 58m · transcribed Jul 2026
More from Macro Hive Business
𝕏 Share ▶ YouTube 📥 PDF 🤖 .md

Section Insights

# 0:00

Introduction to MacroHive and New Offerings

What updates are there regarding MacroHive's new services?

MacroHive has been acquired by the BGC group, leading to the launch of MacroHive Markets, which offers execution services for macro institutional investors, combining strategy insights with global liquidity access.

  • MacroHive has launched a new regulated business called MacroHive Markets.
  • Clients can access execution services alongside strategy and quant insights.
  • This service aims to benefit macro institutional investors.
# 0:01

Defining AI in Today's Context

How is AI defined in the current landscape?

AI is often seen as a moving target, defined by tasks that machines have yet to solve. It encompasses machine learning, large language models, and reasoning capabilities, ultimately aiming to replicate human-like intelligence in various tasks.

  • AI definitions vary widely and evolve as technology advances.
  • Machine learning improves task performance based on data.
  • Large language models have broadened the scope of AI capabilities.
# 0:03

Challenges of AI in Trading

Why is applying AI in trading more complex than in general business applications?

AI in trading faces unique challenges due to the competitive nature of financial markets, rapid information incorporation, and the difficulty of predicting returns in a thin-margin environment. The data limitations and noise-to-signal ratio further complicate the application of AI.

  • Financial markets have a perfect competition environment, making predictions harder.
  • Data limitations and noise significantly impact the effectiveness of AI models.
  • Profiting from AI predictions in trading is more challenging than in other business contexts.
# 0:07

Overfitting and Model Validation

How can one address the issue of overfitting in AI models?

Approaching overfitting requires humility and honesty about model performance. It involves using statistical tools to adjust for multiple testing, validating results through forward testing, and ensuring that models are robust against noise and chance.

  • Be cautious of suspiciously high prediction accuracy as a red flag.
  • Use statistical tools to correct for multiple testing errors.
  • Forward testing is essential to validate model performance in real-world scenarios.
# 0:10

Synthetic Data in Financial Modeling

Is synthetic data useful for financial modeling?

While synthetic data generation techniques have advanced, they struggle to accurately replicate the idiosyncrasies of financial data. The challenge lies in capturing the unique characteristics of financial time series, making synthetic data less reliable for training models.

  • Synthetic data generation techniques are evolving but still face challenges in finance.
  • Financial data has unique characteristics that are hard to replicate synthetically.
  • Testing synthetic data's effectiveness on real data is crucial for validation.
# 0:13

Explainability in AI Models

What is the role of SHAP values in AI model explainability?

SHAP values provide a method to understand individual feature contributions to model predictions, offering insights into model behavior. However, they can be misleading if features are correlated, making it essential to interpret results cautiously.

  • SHAP values help explain model predictions by showing feature contributions.
  • Correlation among features can lead to inaccurate interpretations.
  • It's important to use SHAP values as a diagnostic tool rather than a definitive measure.
# 0:15

Using LLMs in Trading

How can large language models (LLMs) be applied in trading?

LLMs can assist in generating hypotheses, enhancing idea generation, and processing unstructured data. They are not designed to make trading decisions but can provide valuable insights and support throughout the trading process.

  • LLMs can aid in hypothesis generation and idea development for trading strategies.
  • They are useful for processing unstructured data and enhancing model features.
  • LLMs should not be relied upon for direct trading decisions.
# 0:20

The Importance of Workflow in Trading Strategies

What is the significance of a structured workflow in developing trading strategies?

A structured workflow is crucial for integrating machine learning into trading strategies, ensuring that all aspects, from hypothesis generation to risk management, are systematically addressed. This approach enhances the likelihood of developing profitable strategies.

  • A systematic workflow helps integrate machine learning effectively in trading.
  • Consideration of market realities is essential for strategy design.
  • The workflow should encompass all stages from idea generation to monitoring.
# 0:30

Advice for Young Professionals in AI

What advice is there for young people entering the job market in AI?

Young professionals should embrace AI tools, actively learn how to use them effectively, and balance their learning with practical applications. Engaging with coding agents and understanding their capabilities will enhance their skills and job prospects.

  • Embrace AI tools and learn to use them effectively in your work.
  • Balance learning with practical applications to build real skills.
  • Engage with coding agents to enhance your understanding of AI capabilities.
# 0:50

Overview of the New Book

What can readers expect from the new edition of the book on machine learning for trading?

The new edition features a complete rewrite with a focus on systematic workflows, nine case studies, and extensive libraries for practical application. It aims to provide a comprehensive guide for integrating machine learning into trading strategies.

  • The book includes nine case studies and emphasizes systematic workflows.
  • It provides extensive libraries for practical implementation of machine learning.
  • The focus is on integrating machine learning effectively into trading strategies.

Transcript

0:01 Welcome to the MacroHive Conversations podcast. I'm Bilal Hath, head of strategy at MacroHive. Before we dive in, a quick update. Following MacroHive's acquisition by the BGC group, BGC has launched a new regulated business called Macrohive Markets. For the first time, onboarded clients can also access execution services via MacroHive Markets. This new workflow will allow macro institutional investors to benefit from strategy and quant insights alongside access to global liquidity. Please contact Andrew Simon or Gail mode Crian on Bloomberg or click the link in the description below for more details on Macwag Markets and its service offering. Now onto this episode's guest, Stefan Yansen. Stefan is the founder and CEO of Applied AI. He advises Fortune 500 companies, investment firms, startups across industries on data and AI strategy, building data science teams, and developing end-to-end machine learning solutions. Before his current venture, he was a partner managing director at an international investment firm where he built the predictive analytics and investment research practice. He was also a senior executive at a global fintech company with operations in 15 markets, advised central banks in emerging markets, and consulted for the World Bank. Now, onto our conversation.

1:10 So, greetings and welcome, Stefan. It's fantastic to have you on the podcast show. >> Thanks for having me. Good to be back. >> Now, the last time I had you on, we were talking about your your book, which was about machine learning and AI for trading. you've essentially rewritten that book given all the advances that we've seen in AI since over the last 3 years now, especially Agentic AI and so on. So the book kind of incorporates all of that and we'll talk more about the book of later on but I wanted to kind of use your brain now to to see where we are in terms of using AI which includes generative AI LLM machine learning kind of this sort catch all term actually maybe I'll start with that I mean how do you define AI because it it seems to mean lots of different things to people these days so let's start with that perhaps you know how do you define AI >> yeah it's funny right there's the saying that AI is always the thing that we don't solve yet and as soon as we've solved it it's it's seen as being AI right like maps and the searching of path in the the 80s or so I mean it's machine learning is the old idea that machines get better at solving a task based on data you know so I think that in part is still you know related but of course large language model broaden the scope dramatically right you know you have reasoning etc so ultimately we always tend to define define intelligence as sort of something human inspired. You know, since you know, for lack of a better model, we ultimately always wanted to define as something you machines being as good as humans on a given number of tasks. All of them, some of them a subset, you know. So, I think ultimately you converge on something like this really for lack of a better of of a better benchmark, you know.

3:00 >> Yeah, absolutely. That makes a lot of sense. now you know a big issue kind of I face is that many people use AI for general sort of business purposes what I would call general business purposes. So you know lots of people are you know what they call themselves data scientists. So they usually work with some kind of data. They run some kind of machine learning and then they create dashboards often of the revenue and costs and client churn and that's kind of the bread and butter of a lot of data science. But obviously in financial markets is very different especially if you use AI for trading where the bar is way way higher around the problem you're trying to solve is way harder. So perhaps you could elaborate a bit on why is machine learning or AI in trading fundamentally much harder than using AI machine learning in kind of general purpose business functions.

3:57 >> Yeah. Yeah. Look there's a lot of pieces to that puzzle. ultimately the usefulness or the hardness let's say of you know applying say machine learning or AI in a context is kind of what is the ultimate use case right? What do you actually use the model output if we have defined it narrowly as kind of machine learning to say predict returns and then trade on these predictions you know if you predict your customer churn you know then you're probably in a more stable environment you know you have competition you know companies also compete for customers so it's not only in financial markets where you have competitive environment margins are very thin information gets incorporated very rapidly so it's quite hard to predict things for longer right because as information you know seeps into the world people act on it and and any gains disappear instantly. So, so you have that kind of sort of you know perfect competition market kind of situation to the max. but then you have a lot of other issues too which is how many data do you have you know what is the effective sample size that you can utilize you know and and financial markets are not the sort of YouTube environment where you have trillions of cats jumping around you know and they all look the same and they don't change so you have shorter time series they are not incremented by people uploading data but by days passing you know so one trading session after another adds new data. It doesn't get any faster than that. Maybe by putting more markets online worldwide, but ultimately you know there's there's there's a limitation to to the data that goes in and so so that plus the the limited information content in past history as it comes to the future, you know, no low noise to signal ratio makes us particularly hard, you know. So since you ultimately need to prove that you can earn a return on the predictions and many people are trying that I think that even though you may be able to achieve some measure of accuracy on your models and you do to actually gain from this in the markets is is hard. So you have this double whmy right hard to predict even harder to profit from any predictions that you can make.

6:06 You know very often you find that you have models oh it's really predictive and then you look at the assets and then they're very illquid you know that the micro caps and then if you were to trade them you know then the margin that you sort of predicting that kind of you know it's gets eaten up by market impact you know so so you have a bunch of challenges given that particularly challenging environment >> you know I suppose one one kind of issue you bring up there is one sort of general issue this is with all quantitative or systematic approaches is the risk of overfitting data where the back test looks fantastic often because you've data fitted although you don't admit it and then when you actually run it out of sample in in practice it turns out not to not to perform as well now with machine learning and AI in particular there's much more of a black box element on top of that as well which just adds another layer to it where you aren't quite sure why the signal in the back test was generated in the first place. So how how do you approach that that problem?

7:05 Yeah. So both being humble and honest goes a long way. humble and always expecting that prediction accuracy is going to be low. So any values that are suspiciously high or usually a major red flag and we get to all the potential errors that you can build into your historical simulation. but then you have to be honest in the sense that how many things did you actually try to get to the good results you know that you produced. and that goes back to the point that the effective sample sizes are not huge. So it's much easier to exhaust any signal in there or to just find you know you torture the data until it confesses kind of situation which is harder if you have the billion trillion sample data sets you know which we don't have and so so you have to be honest and discount the results you know you have all sort of multi you know statistical tools to adjust for multiple testing and the like you know which you should certainly use but once you you've done all that you're still only certain to you know some probabilistic degree that probably it's not chance maybe it is you know and so you also have to have the ability to forward test anything that you found in the market with very limited risk you know so you usually have after you applied all these safeguards and think that after you filtered your test and think okay you know out of the 100 thousand things here are five that actually seem to have a reasonable mechanism you know so you can inspect models and we get you tools how you can maybe try to sort of focus more on what mechanism it could be and then you try to refute it etc. So there are tools for that. After you pass all these different gates you get to the okay then let's deploy it and see if it actually works.

8:50 and maybe you try with you start with sort of paper trading and limited capital etc. You know that of course also has trade-offs because most things that you discover they decay right you cannot afford to do too much of this. So you know no free lunch as usual. but ultimately it's a mix of trying to detect the noise through various tests both correctness and statistical corrections and then a deployment that shows you that would it actually work in the future where we cannot have any look ahead bias you know and all these other things that you can build into the back test which is a historical simulation right so the fundamental problem with back test is you you try to simulate history so there are errors in terms of how you built the simulation is the data correct is it point in time was there anything that you used in the past that you wouldn't have known at that time and all these things which always sound trivial when when you say it but when you actually build it yourself you get surprised by how easy it is to trip over all these things right like you know thinking back in March 2017 would I have known this data point you know the label on the on the time stamp it says I would have but is that actually the case you know so so there are many little things that paint the these results so there's the historical simulation correctness and then there's the generic part of carrying the future future into the the past into the future and and hoping that it stays true in in a changing environment. Right. So these are >> actually on the small sample issue. I mean you said you know YouTube cat videos there's trillions of them but you know with with financial time series they're just one time series daily and there's not that much. I mean have you looked at I mean just creating synthetic histories you know whether it's through bootstrapping techniques or Monte Carlo or all of those sorts of techniques. Do you find that or just synthetic data of some kind through some of those process? I mean do do you find that's helpful or does that kind of give you a false sense of security?

10:42 >> It is super interesting. We have a whole chapter on this now. we had it before. There was a there was a model time GAN that came out of the medical domain actually. It was really well done. It was basically out of the medical domain where you have privacy issues. you know researchers came up with tools to generate synthetic time series of patient measurements you know to you know improve diagnostic tools and that actually worked in that domain where oh patients humans we're pretty stable our bodies don't change every 3 months you know so you try that in finance and it's a struggle the models get more and more sophisticated right synthetic data are all over right everybody has used nano banana and image generation and you know diffusion etc. So the techniques get much better but to learn the idiosyncrasies of financial data with you know the distribution characteristics the fat tales where actually the outliers matter right it's not just about getting 98% right you really want to get the the extremes right that is much harder because the models aren't really built for that so we haven't seen much and we try a bunch of things in the book to see you know could we simulate something where ultimely Again, you know, you want to build synthetic data and see how useful is it in practice, right? Not just run some some some visual similarity tests or just measure some, you know, etc. but actually if I were to train a model on a synthetic time series, would it be able to predict anything on real data? And these tests are usually very difficult to to to to succeed at. So, very interesting. I wouldn't count it out. You know, things keep getting better. I don't think we're there yet. This is this is really research frontier.

12:32 >> Okay, that's that's interesting. And then in terms of the explanability side, you know, one one common thing people use on the AI side, machine learning side is sharapply values. Do you have a view on on that, you know, because it seems quite elegant. It seems to explain why the output is what it is, but you know, there are some criticisms around it too. so I mean what's what's your take on that? Does does that turn the black box into at least a gray box?

12:57 >> Yeah, it's it's it's gray to varying degrees for partners. You know, correlation is a problem. You know, sharply comes out of game theory, cooperative game theory assign sort of the marginal contribution to individual players. players there are orthogonal or independent data and features are not. So the the the you know the the beauty of Shepley values is that they found a very elegant way to compute it. it's a pretty hard problem. but you know you can set it up computationally so you can you can get it and of course as soon as there's something that's computable that gives you a number everybody jumps on it and it is very useful you know it is very useful and that it shows very clearly how individual features contribute to individual decisions. So I like it a lot for instance. So we together with the book we're releasing a few libraries especially one that focuses on all sorts of diagnostics you know like these statistical corrections that I mentioned earlier and there's also the idea that you know you build a machine learning model and you predict returns and then you build a strategy that trades on these returns and then you want to understand here's a particularly bad trade what happened you know and you want to see which features actually contributed to that you know were these maybe features you know model inputs that usually are not that important but here they actually caused the problem.

14:16 Maybe that gives you a hint at how you can diagnose and improve the model maybe simply by removing that feature or by doing other you taking other steps to mitigate that. So it's I think it's a useful diagnostic tool as long as you're aware that the numbers that it assigns can be off to various degrees of magnitude if features are correlated. So it's not you know 100% accurate. >> No no noted. Now >> it's it's a substantial improvement on on what was there before.

14:43 >> Yeah. Yeah. now last time we spoke we that was very much the early years of chant. We've moved a long way since then. There's been much more advanced models have been released. There's a whole agentic sort of process now. So in in your eyes you know what what how do you use large language models and aentic AI within trading? I mean is there what the use cases? How can one use it at whatever stage of the the trading process?

15:12 >> Yeah, it comes in at at various points. it does not come in at the point that most people want them to come in, which is take the trading decisions for me, make me money. You know, I think that is where it actually does not come in. But if you look at so in the book, we describe this entire thing as usual as kind of a workflow or a process. You know, you have to come up with some hypothesis, right? there has to be some idea for a strategy maybe after you already know which asset class or market you want to play. idea generation is something where you know LLM or ji is as the name says it's useful right it's not the be all end all but you know rather than sitting there for an hour and coming up with stuff yourself it may get you started you know so that's that's one thing you know along the way you know it can provide useful sort of ideas if you want to build a model and come up with variations of the model what else should I try which other features could be useful here oh what does astrophysics do what kind of features is astrophysics actually derived from data I haven't studied that do I want to read the big book maybe you give me just 10 ideas you know I can then still skim the sources and check if that's plausible but you know in terms of pulling in adjacent ideas I think it's it's quite useful then on the agentic front one new chapter in the book is of on autonomous agents of course and richwater had this interesting paper last fall AIA is their it's their lab right the AIA forecaster agent which they train on on prediction markets and they have an interesting model. It's like a multi- aent system and you have agents tackle one question, you know, so it's it's a prediction market. So, you know, is the Fed rate going up or down at the next meeting and all things like that, you know, what's the CPI going to be like?

16:59 Is it going to be higher? Usually binary option kind of questions and so you can set up an agentic system that searches on the web, pulls in information in multiple steps. agents reason about it. Then you have multiple agents that have views, they debate them. You may have a supervisor. In that case, you have a supervisor that sort of looks at all these different opinions and then if they deviate then it could it procures additional evidence to kind of sort this out if possible and then kind of comes to a conclusion. And so in this case they they were able to show that it performs actually reasonably well. It doesn't really outperform humans or markets themselves. But what's interesting is that when combined with other information, it generates interesting incremental signal that is actually predictive. So, so you have kind of machines that are able to process unstructured data which is really the main value of large language, right? the very sophisticated and and and and really productive access to very large amount of text data where all other methods methods before were really not very good at. So suddenly you have access to that source and you can incorporate that you know into models into agents etc. So I think that is kind of in terms of direct LLM contribution is the main one. However, there's of course the sort of almost infrastructure or tool contribution which are coding agents. You know, coding agents of course really play a very heavy hand in in the process. We also so the book comes with 50 plus coding agent skills. You know for agents you have these skills you know that try to define how to correctly implement certain steps. You know, usually the idea is in in a company you have a certain workflow and you have your internal process documented and the model can't really know that because obviously it wasn't trained on internal data. So you try create these skills and then if the model has to execute or the agent has to execute you know some piece of a workflow it can pull in that information and then you know apply it. So similarly you can do this in in in in a quant research workflow right because you will find that coding agents are excellent at writing software but they're much less solid when it comes to methodical things on statistics machine learning and the like for many reasons probably simply it wasn't I wouldn't say it because oh it's so much more difficult it's probably that the training data on that domain is much thinner I would assume you know it's especially in finance there isn't that much information shared as in other domains. So that could explain some of that. but so it helps to kind of beef up the ability to write the actual code with sort of information that tells them how to do that correctly. So coding agents in terms of how do I use it?

19:52 coding agents themselves are probably the main contributor but you see that along the process you can have a bunch of valued inputs. there's one piece for instance you know knowledge graphs you know are kind of useful to organize information and we can talk about those in more detail but now suddenly you can create these knowledge graphs more cheaply by using LLM. So there is this kind of second line of defense or you know second kind of row of contributions of LLM to just prepare the data right which is an indirect input into the process you know so having unstructured data prepare it process it so that it becomes more useful in in whatever whether you're a fundamental analyst or a quant researcher you know that that is helpful so it's quite versatile you know >> and and you know leading on from that knowledge graph element that you that you just mentioned. One thing we've done a lot of work in is using large language model and then adding a rag approach to it. you know where you kind of link it to your trusted data set. and then some people have added kind of a knowledge graph on top of the rag so it becomes like knowledge graph rag LLM.

21:05 >> Yeah. >> You know what's your experience on on that kind of area because one issue we all face in in financial markets is we need to know our sources and everything kind of has to ideally be auditable and you know reliability and equity is super super important. so rag approaches have been you know you know the the the path many people have taken. although there's a debate now whether the context windows are so large you need rag or not. but it would be great to hear your your opinion.

21:33 >> Yeah. Yeah. Exactly. Rag is dead you know. So there was this kind of I mean I think the general so obviously hallucinations etc are a major issue. I think we probably already discussed this three years ago. so it's a known issue and it's been it's it's been not resolved but addressed and mitigated you know by much better by a much improved ability to really demonstrate provenence of claims right so so rack obviously is useful in the sense that you have specific documents that you know make it into the into the LLM's response you know or the agent's work right can be just you know one short kind of conversation or an ongoing workflow. so it's useful to infuse that information either just to make to keep the model and the responses up to date or to ground it you know and then in addition what you want wherever you get the information from you ultimately really want to literally pin down the text passage it comes from right because any decision maker and that's in finance as well as elsewhere right anybody that really takes an important decision based on LLM input ultimately wants to have the ability to trace it to Where does this all come from? And now in practice, you're probably going to do this initially a lot and at some point when you gain trust in the system, that goes down a little bit and you're probably not going to check everything. You're still going to spot check. You can also automate that process, you know, but I think the ability technically to do that has increased substantially and you can of course have the LLM reasoning processes have itself verify that these things actually exist. So that altogether mitigates that. The question whether large lar larger context windows make this all obsolete. I'm a little skeptical to be honest. I mean the haste finding etc clearly has improved but long context windows they in my experience reliability is a little wobbly you know beyond the 100 200k.

23:37 and many tasks are ultimately require more context than that you know which I think in my and that goes back to the use of coding agents and generally this is one of the big weaknesses still of AI generally that many tasks in practice go beyond the here's a complicated question answer it you know it's more like here's a big project that we've been working on for 18 months and we'll continue on who knows maybe forever and it keeps growing and humans work and they build knowledge and memory as they work on it. LLMs don't do that. This is not something you can naturally resolve with just providing more context, right? if the weights of the model don't absorb all this information and start automatically incorporating this. So, so this is I think where where rack and all these things hit their limits basically because the ultimate is the whole quadratic cost of transformers and so that drives all this right but back to the knowledge graph just being able to structure information that is relevant in a useful way that relates different entities to each other companies and their suppliers you know who holds all these securities etc and do that in a reliable way of course allows for other types of queries and for more complex information retrieval ultimately, right? So having the ability to organize data in that way is great and having the cost of doing that come down substantially through LLM is of course a major win >> and and you know one of the buzzwords of late has been agent harnesses which in essence is is kind of the envelope around the agentic process. I mean first of all I mean in your mind how do you define a harness and then what what's the right harness or what you know in finance is there specific things we need to keep an eye out on in terms of how we get the agents to interact with each other?

25:41 >> Well so yeah so the agent harness is sort of it's literally a harness that the agent wears you know as it as it as it executes its tasks. And agents do a ton of things, right? They use tools. They use all sorts of tools. They search the internet. They look through your documents. if you did the open crawl thing, it literally is in your bank account. Maybe better not, but it spins up virtual machines to execute code. so there's a lot of things that the agent can do. And the major gains that we've seen in the last and one of the main drivers I think of the explosion of coding agents especially around in this starting with cloud code but now of course more more broadly is that the efficiency of tool use dramatically improved which means lower token use more accuracy you choose the right tools the output of the tools is well formatted the agent knows how to interpret this correctly take the next steps because they take many steps in this in this execution, right? So errors compound quickly. So the harness is is responsible in large part for increasing the accuracy. So interpreting agent results. So I'm I don't know search the web, right? I get all these results back. How do I interpret this correctly? Right? So you need instructions for that similar to what I earlier mentioned with skills, right?

27:03 Skills that define how to take certain actions and steps correctly. So you can infuse all this in agent in in in in in the agent which is driven by an LLM that wasn't necessarily trained on the specific workflow you wanted to operate on like doing research on on companies right doing research on obscure companies or on distra distress depth or real estate or what have you know so the the harness kind of guides this and of course the coding agent harness is focused on well you know software projects so you can envision that hm H maybe I want a better harness that actually guides us in the specific in a fundamental research process or as a macro researcher right so there probably also things that you can say hm you know there are certain there's certain logic that I want to u to imbue maybe internal knowledge right that as a firm you have acquired how to do research properly so you can kind of embed that in in in a harness this is one of the inputs you know the other is simply the the workflow what are my tools that I have available how do I choose among them etc. and all these things. So very important and more of the gains that we're seeing on that front is driven by O training and harness improvements than sort of the underlying models getting better themselves probably >> and actually that's that's one of the threads throughout your book actually that and this is not just AI these AI harnesses is is just more generally models that come up with alpha is one thing but actually your workflow as a whole from the start of alpha generation to testing implementation post trade of the trading strategy that that whole workflow is super super important and often people don't spend enough time on that. So can you talk more at kind of the apps at the higher level around you know the workflow of of building a trading strategy and implementing it and and I think you have something called the ML4T machine learning for trading workflow yeah that you talk about in your book. Yeah, it was driven by the I mean all of this goes back when I was teaching data science in New York over 10 years ago or general assembly and in New York we always have people from from hedge funds right there were students from Millennium Bridgewater etc and I I was I was a partner at investment firm at the time doing things of this nature and so really there's no real domain specific introduction to machine learning and it really matters because finance is like other domains, right? It's domain specific. So the data is has its own context, things you have to know about it to interpret them correctly. But then also the application of model outputs is very domain specific as elsewhere, right? If you're in pharmaceuticals, you know, your models output something, you have to know how what to do with it. So in finance and this is kind of the idea just of this workflow that ultimately you always have to at least either think from or incorporate the ultimate application of what the machinery model does which in trading you know is okay we're going to build some sort of trading strategy around this which maybe will predict returns maybe predict volatility you know and now you have models that predict end toend portfolio allocations right but as you do all this you're operating in a market so you have to take into account all the things that make markets what they are, right? So there are costs, there's market impact, what can you trade, what are the risks, how do you handle all this, what are tools to mitigate risk. All of that are inputs into the trading strategy that ultimately influence whether what you do on the machine learning side will be profitable or not. So the workflow is the idea to simply describe all these things lay all of lay out all of these things see where machine learning or AI can actually help as I you know said initially you know there are multiple steps beyond just training model to predict returns and then iterate through the process. So the book what is very new about this book compared to before is that we have nine case studies. So there are like nine case studies that go from the idea of or from they that go from the development of a hypothesis or an idea of a trading strategy tied to some data set be that ETFs or crypto or FX etc. and then go through the entire workflow, right? So, okay, you know, if I if I'm if I'm in this market and this is what the return structure looks like, these are the costs that I will be facing in my situation as a trader. So, what is kind of a holding period that I'm looking at, right? if I have high cost, can I have a five minute holding period?

31:35 Probably not. You know, not going to work. So, you know, so you have things that inform the model design. You're probably not going to predict five minutes returns if you're holding for at least a day, right? So, so there are kind of implications of taking into the market context into account of how you design all this you know then there of course methodological things about just how you do machine learning the whole cross validation process you know there are time series data so you have to apply certain certain a certain rigor and certain methods to it there's the whole statistical machinery of good now I have my results how do I interpret them correctly what kind of a haircut do I have to apply because I've already run 100,000 models instead of just one and you know and then how do I do this historical simulation of a trading strategy correctly by taking into account market reality. which if you come from the machine learning world you know you may not be super familiar with just as if you come from finance you may not be familiar with all the details of of machine learning models. Maybe you've run linear regressions, you know, but now you have more complex models and you have a more industrial approach to this because machine learning as a sort of tool or discipline has matured. And so part of this process is then also infrastructure, you know, like since I said m many times if I run a lot of models, I have to be able to account for those. So you have to be able to actually count your trials. So how do you set that up, right? right? You're not going to just have a pen and paper on the side on the side and kind of do a you know jot down a bar for everything you ran. So you have to automate and store this in a way that's kind of reproducible, countable so that you can frame the tests correctly etc. And then ultimately there's the whole question of goods and now now we researched that's not an end in itself. So how do we actually go to production? So what's also new in the book is that we now talk about how do you actually go live? You know, how do you connect to to brokers? So there's new software that does that. and then once you're in production, how do you monitor the strategy, right? Things change. When do you actually start figuring out that this was not just a bad day, but it's actually starts to be to be evidence that our initial hypothesis is maybe no longer valid.

33:49 and we should maybe dial it down a little bit you know in terms of exposure etc. So you have this kind of end to end a story literally from idea research simulation ultimately deployment production and then monitoring you know hopefully it works forever but you know we know how things go. >> Yeah. Yeah. I mean one of the challenges I've always found is that when I've hired computer scientists they don't seem to be as familiar with time series and non-stationary time series. That's been a huge huge challenge you know because non-stationary time series brings a whole world of pain when you're doing testing and back testing. So that's been one of the challenges. Now in your book you do talk about you know the alphaactory which I assume is linked to this workflow you know rather than because the risk is you just end up with a bunch of notebooks and you're just kind of you know knitting them together and kind of hoping that's some kind of robust process. So, so you know is is the alpha factory this whole workflow implemented is that what you you know what you think?

34:53 >> Yeah, it is kind of this idea ultimately crystallize in code you know >> so many of these things are driven by configurations. Now this is one thing where you don't have this one sizefits all you know so it's not like a factory that you can download. In the book we illustrate one way of setting this up you know workflows are very idiosyncratic I always find you know which is great for you know autonomous agents because they can adapt you know but you cannot take kind of this is this is the ML4 quant workflow you know you got to follow it and here's the recipe you know there are conceptual stages and there are various ways of implementing them so for instance we have like one version of in of implementing a kind of a model registry and a trial registry for back tags I mean there's a bunch of different ways that you could do this and I'm sure that depending on your personal preferences you would place more emphasis on one aspect on the other and then you create it differently but the idea is the same you know so the the the the logic is that you know you should start with some idea of what you're trying to accomplish you don't have to super specifically specify that it's going to be the three month momentum with a little bit of a volatility kind of flavor around it you know you can look more broadly But you should be prepared to probe you know these things for for an existing mechanism. These are all steps that you would be taking in that factory kind of style. The factory then includes that you know depending on maybe you only run 10 trials if you are really kind of very focused. That's rare but more likely going to be thousands of trials you know. So there comes the whole filtering process. you ultimately the design of your simulation will depend on your personal trading situations. you know, maybe you have very low cost if maybe you're on crypto. Maybe maybe you're somewhere in an exotic emerging market.

36:46 You know, all of that shapes what you ultimately built in order to replicate that world historically, but that doesn't change the concepts that you have to obey or like the boxes that you kind of have to tick. So, so that is kind of the the idea, you know, to make it systematic, to make sure that you cover all your bases and to ultimately to build your own workflow in a way that's reproducible, faster, that you automate what you can automate and use the tools that help you automate, including coding agents, you know.

37:17 >> Yeah. Yeah. Absolutely. That makes sense. Now in terms of more sort of experimental areas as applied to finance at least there's some kind of areas that people have been looking at and have struggled with some extent like reinforcement learning is one you know do do you think that's still kind of like an academic thing or does RL work for finance? Yeah. So the second edition which so six years ago 2020 still had a deep Q network to learn how to trade stocks. So that's gone.

37:52 >> so similar to the idea generative AI is going to make me money by trading in the stock market. Reinforcement learning seems to be made for that. Right? You look at Alpha Go, right? if I can win at go why can't I win at the stock market right but these things don't transfer the environment is so different etc etc that this promise of reinforcement learning I think very few people are pursuing that today now if you read Sebastian Malaby's book you know about like deep deep minds history and demis and you think you know with a lot of resources in 2026 could you build something that might get there somehow maybe would that be something that lasts more than a month. I'm not sure, you know. So, is it worth it? I don't know.

38:39 So, I think that idea of reinforcement learning as a trading sort of agent, I think that is hard. However, reinforcement learning for I think even longer than that has been successfully used for execution, right? I mean JP Morgan went live with this in 2017. That is a proper dynamic control problem. So, we have three examples in in the book. instead of the stock trading one is about execution which is sort of the main stay right so how do you slice orders over time so dynamic control here's your x number of shares that you want need to get out how do you place the orders limit markets whatever you know like what are what are the options that you have and how do you ideally sequence them so that works market making you now holding inventory etc works somewhat can probably work in practice the the smaller examples that we use in the book are not that super successful. And then hedging, you know, dynamic hedging is is also quite u successful and and accepted, you know, as another dynamic control problem, you know, where sort of the the positions, you know, the optional positions that you that you take in order to hedge, etc. sensible and and so that that kind of seems to work which is so it makes sense conceptually and I think that is where it has reinforcement learning really has found a a very solid foothold you know but the original fantasy of train my little bot and it just runs for me and ding ding ding slot machine you know not yet another kind of experimental area is world world models you know Yanukun has been you know advocating for world models as the real path to AGI FA as well spatial intelligence. I mean they're kind of applying it more to robotics and the physical world but their kind of idea is that with kind of multi-ensory inputs not just language and text and then also working where you kind of abstract states of the world is more efficient and then make predictions about the next state of the world. I mean do you think that's a possible pathway for financial a financial market use case there?

40:52 I think so I'm I'm very skeptical you know which goes back to at at this stage right I mean who knows what will be possible in 10 years given the speed of development so I wouldn't make any predictions about that robotics is very different you know it's like with self-driving cars you can start generating synthetic data about the world you have a very different kind of data situation that allows to train these embeddings you know you need substantial amount of data which in finance you don't really have to the same extent So to me it seems that the interactive sort of multiplayer world at scale and finance combined with the relative shortness of history you know it's a lot of data tick data is large but you compare it to other domains it's limited I think raised the bar substantially. I think it's a great idea you know word models it makes a lot of sense you know to incorporate additional senses into into the perception of agents and it's may well be necessary I mean it's a big debate right like how how how much content and how much learning can you extract from language alone you know so I think it's a it's a very useful and valid research direction obviously the funding speaks for itself and and their experience. But I don't think it transfers from robotics very easily to to financial market. It's a little bit like this reinforcement learning Yeah. idea. You know, obviously Deep Mind was extremely successful and they went well beyond the Atari games and go for sure. but still, you know, it's >> yet another leap into actual financial markets, I think.

42:29 >> Yeah. And and actually in terms of the the the real general intelligence humans, I mean, what do what do you think is the role of humans in the next 5 to 10 years? is I mean what what can we do better than than machines so to speak. >> so I think we come up with the questions and the design of the goals you know and evaluations ultimately whether something is useful. I think it's very complimentary and I do think if you work intensely with coding agents the this relationship becomes very very evident.

43:08 it is sometimes a struggle you know to find the balance because of certain idiosyncrasies you know agents to be helpful right product manager design them they always want to be helpful which you know helps them which you know leads them to do all sorts of mischievous things which they interpret as being getting us closer to the goal. So monitoring these things you know first of all deciding what to do you know I think is something that AI on its own is not necessarily very good at once the goal is clearly defined and for now at least humans because of all the pass knowledge the experiential knowledge and all these things that models cannot learn because you never may forget how much information in the world is not really recorded and as of yet accessible to models Right? so how much learning by living really humans absorb in their in in their brain that they can provide as context to a model that models simply for now don't have access to. So that role is absolutely critical and for now I don't see models getting there. Now can you record all these things could could run around all the time with microsone and sensors and sure in some futuristic world I think you can construct that but I think in reality we're quite a bit bit away from that. So I think that role is critical deciding deciding what to do often how to go about this correctly you know if these are processes that are not just written down in some manual which many things are not right like why are certain people experts because they have learned something that wasn't learnable before just by reading a book they either discovered it developed it themselves so they know it and and so forth right so I think that role is is critical a lot of the execution in between I models will be able to learn and certain in some domains more than others again depending on like in the early example with machine learning and finance it's surprising how many mistakes I still encounter in day-to-day you know as opposed to building a website you know you build a website piece of cake you know design build deployed hands off you know so so it varies what the execution contribution is of agents as for now but that's growing very rapidly right? Because the incentive to kind of make all these things accessible, bro. So I think that so it will be us managing multiple agents in the future. you know with a lot of ADHD developed the constant context switching in between these various workflows that we'll have to manage. I think at least if if coding and this kind of world is a is a harbinger of what to come I think that is where we're heading at least for the near and medium term. I think I'm sure this will this will further evolve you know with midter layers of agents managing agents and all that.

46:08 >> Yeah. Yeah, I mean one one area I've certainly found is that it's kind of current state of AI is very good at building demos but then when you move to production maintaining the productionized output is >> oh yeah >> AI is it really struggles with that you know you know often even with the demo there's a lot of technical debt or vibe coded you know there's bloat code bloat so when you productionize then agents I find struggle a bit you know that's where you kind of an experienced hand definitely helps you know on that side.

46:41 >> Yeah, I think you always when you drill down into these kind of failures, you almost always find that there there's critical context that's missing. and once you start looking at that you realize just how much context you know solving a a task that has a lot of diversity you know how much context that really requires which is why people humans take a long time to develop both as kids you know to become adults but also on the job right to become proficient at at some activity it's nothing that you do in in a week right it often takes years and years and years so you just and then and this is that something that we do every day and it's not like every day is the same. So you accumulate a lot of information and once you realize, you know, that ultimately that information which isn't really tangible, you know, you absorb it, but it's it's real. It exists. you realize how important that is when you see agents failing at these tasks and not incorporating things that you think, yeah, of course that's kind of obvious, you know, why why don't you apply the convention? Well, because they don't know, you know. So, so you have a lot of these these things still and you just realize I think it's it's marvelous how complex and sophisticated humans are in their ability, you know, through lifelong learning not by reading books but living and doing things you know how much knowledge they we accumulate and and how hard despite the amazing progress right I mean you look at LLM and I would just say I don't know if you've used the Fable yet you know the latest model I mean it's It's very impressive what it produced. the latest cloud iterated the down sort of the public version of mitos right u very impressive and still and still it seems to be quite a quite a journey to truly replicate humans you know so it's a bit like cognitive dissonance you know you have insane progress nobody would have expected it and then you have spectacular failures at the same time you know you kind of need to need to accept both of these as real >> and before we we talk about your book final question. you know, we do have some young people listening to the the podcast as well and many of them will be graduating and joining the the job market after the summer.

48:57 many of them are quite frightened about job prospects. What advice would you give them about entering the job market in in the world of AI in in the face of AI that seems to be easing up lots of junior jobs? >> Yeah, it's it's really challenging and I I will not pretend that I kind of know how to do this, right? I think as a young person and I was surprised sometimes I I teach young kids I do some boot camps etc. I was surprised when I heard of this anxiety which was like there is this incentive to do things using LLM because I'm faster you know and the others are doing it but that means I'm not learning you know and I think that conflict is quite real but then at the same time you're learning a lot of other things you know you're learning how to solve task using LLM I don't know and I think it's very domain specific what the right balance is I also think that some of these things they will settle because it will become obvious that at certain tasks you will not succeed by simply just chinging your way out of everything right I mean you cannot deliver I don't know you want to be an equity analyst you cannot just ch your way out of this but by being young having the time and the flexibility to use it a lot you may become a lot better in figuring out where you can use it right and where you cannot use it you know and also much probably much more open to tracking over time how these things evolve, you know. So, so I think it's always daunting to be young and step into the drug market. I think an anxiety at that front is nothing entirely new. I would look at these advantages and just try to be very very offensive in adopting these tools and not just the chatbot but definitely get into the coding agent type of world co-work and and all these things that are more agentic in nature. I think getting on top of that very early and actively figuring out how they can help in your work but solving real tasks with them I think is going to be very very useful. may also make work more fun down the line because you can just get rid of some of the boring stuff. So there's a lot of positives.

51:09 >> That's fantastic. Now your book this is you know it looks like a almost a rewrite of a book you wrote a number of years ago machine learning for trading. Can you just talk a bit about the book you know what's how you would describe it and also when's when it's going to be published and how people could get hold of it? Yeah. So, we're less than a month away. late June, early July. it'll be out on Amazon and packed, etc. So, the book is yes, it's it's a complete rewrite obviously sort of same topic, machine learning for trading. The structure is new in that we have these nine case studies. The book itself contains no code anymore. The second edition was still like a bunch of code examples in there. Instead, we have a lot more code outside of the book. So there's like these kind of chapter specific notebooks instead of I don't know I think the second edition had like 150 or so notebooks. The repo was super popular. I think we're almost at 20,000 stars now.

52:09 and so we have 150 notebooks in the second. Now we have 250 or the 27 chapters plus another I don't know almost 200 covering the case studies. and so there's a much there's much more emphasis on covering these steps of you know this workflow that I've described a few times much more systematically. The second edition was like well here's gradient boosting. Okay so you know here's a data set ETFs let's just build a model that uses gradient boosting to predict returns and then let's back test something. So it was very very simple you know now you have all of this systematically all the way through what if I apply risk management what if I apply cost sensitivity analysis what what if I vary the model right instead of linear regression I use gradient boosting I use deep learning I use latent factor models what if I what what happens if I apply causal inference you know what does it tell me about the validity of the features that I'm using and the stability of the relationships you know so it it goes into much more depth much more systematically compares this across strategies which is or different asset classes. So we cover US equities both intraday and longer holding periods. There's crypto of course.

53:25 there's FX. there's futures, ETFs. I think that's about it. And so nine case studies, five or six asset classes. there's six libraries that come with the book. that is of course test to monitor the productivity of coding agents that cover everything from data sources to kind of feature engineering and testing to statistical diagnostics of machine learning models and strategies. there's a models library that embeds or that allows you to much more easily apply models that are only published in research you know like more recent latent vector models or some endto-end portfolio learning models and then as a new back testing library I used to maintain this zipline back testing library that you know Ctopian was a crows hedge fund they unfortunately closed down three months after I published second edition and it used their tools so I maintained that for a while but that was very old but you have that and then you have a library that takes everything live via interactive brokers or pakani. So there's kind of an end to- end workflow there with supporting tools. So that is new. There will be new educational offerings. So there are courses on Maven one is and so we cover genai too, right?

54:38 So there's stuff about retrieval augmented generation knowledge graphs autonomous agent the forecasting agent. We have an agent sort of that tries to implement quant research. Right? So there the idea is that we have this structured workflow with well- definfined sort of artifacts that come out of this you know like model results back test results etc that agents can interpret because they're standardized then they have access to standardized tools you know which are these libraries that execute all these things much more deterministically. So you're not subject to the vagaries oh is the agent going to run the test correctly it just calls the tools that has the test already coded right. So, so you learn how to build something like that which allows you to iterate on these strategies because obviously the book only interprets or the book only sort of illustrates a basic implementation you know like well you know if you get first started you take these features and these labels and these models etc but there's a lot more of course that you can do to make it profitable. So there's all that and so the educational offerings are kind of there's like going to be a workshop on how to build such agents and there's a much more in-depth hands-on course on how to take all these case studies develop them further or develop your own trading strategies that's going to be on Maven. So it's a much bigger package because obviously content generation has become easier these days and it was in part initially I was wondering you know like when I embarked on this like 6 months or so ago today in 2026 you know why would you still write a book and not just say provide a curated set of prompts right because you know the the specifics you know are readily available but then of course you still have you like what is the role of humans? You know, you have the the benefit of curation and once you try to do that with LLMs, you realize how difficult it is for them to operate at that scale. The book has 750 pages, you know, and to kind of tie these different pieces together coherently is a major challenge for LLMs, which I would not have expected to be honest. So, that was actually quite an interesting experiment. So, so that it's it's new.

56:50 It uses the technology but with substantial human touch in in between and as I said it's agent friendly. The libraries are agent friendly so they have all the agent coding agent documentation in them and it comes with these coding scripts. So it tries to be a lot of things in 2026 the book. >> No that's fantastic. I mean I've seen an advanced copy of the book. It's it's really really good. The libraries are excellent as well. So I'd urge everybody to get hold of the book. I'm g I'm going to give it to everyone in my team as well so that we kind of implement best practices. so so congratulations once again on writing such a such an excellent book and I think it's one of the only ones as far as I can tell in this in this space that's so practical. so so well done on that and thanks again for coming on this podcast and and good luck with all your endeavors.

57:39 >> Thank you so much for having me. All the best to you. >> Thanks for listening to the episode. Please subscribe to the podcast show on Apple, Spotify, or wherever you listen to podcast, leave a fivestar rating, a nice comment, and let other people know about the show. We'll be very, very grateful. Finally, sign up for our free newsletter at macroive.com/free. We'll be back soon, so tune in

Summary

Stefan Yansen, founder and CEO of Applied AI, discusses the complexities of applying AI and machine learning in trading compared to general business applications. He emphasizes the challenges of predicting market behavior due to competition, data limitations, and the need for rigorous testing and validation of models. Yansen also introduces his upcoming book, which provides a comprehensive workflow for integrating machine learning into trading strategies, alongside practical case studies and tools.

- AI in trading is more challenging than in general business due to market competition and data limitations.
- Effective sample sizes in finance are smaller, making it harder to validate predictive models.
- Overfitting is a significant risk; rigorous testing and validation are essential.
- The book outlines a systematic workflow for machine learning in trading, covering hypothesis generation to deployment.
- It includes nine case studies across various asset classes, emphasizing practical applications.
- The book features libraries for data handling, model testing, and live trading integration.
- Yansen highlights the importance of human oversight in AI processes, especially in defining goals and evaluating outcomes.
- Upcoming educational offerings will provide hands-on training in developing trading strategies and using coding agents.

Questions Answered

What updates are there regarding MacroHive's new services?

MacroHive has been acquired by the BGC group, leading to the launch of MacroHive Markets, which offers execution services for macro institutional investors, combining strategy insights with global liquidity access.

How is AI defined in the current landscape?

AI is often seen as a moving target, defined by tasks that machines have yet to solve. It encompasses machine learning, large language models, and reasoning capabilities, ultimately aiming to replicate human-like intelligence in various tasks.

Why is applying AI in trading more complex than in general business applications?

AI in trading faces unique challenges due to the competitive nature of financial markets, rapid information incorporation, and the difficulty of predicting returns in a thin-margin environment. The data limitations and noise-to-signal ratio further complicate the application of AI.

How can one address the issue of overfitting in AI models?

Approaching overfitting requires humility and honesty about model performance. It involves using statistical tools to adjust for multiple testing, validating results through forward testing, and ensuring that models are robust against noise and chance.

Is synthetic data useful for financial modeling?

While synthetic data generation techniques have advanced, they struggle to accurately replicate the idiosyncrasies of financial data. The challenge lies in capturing the unique characteristics of financial time series, making synthetic data less reliable for training models.

What is the role of SHAP values in AI model explainability?

SHAP values provide a method to understand individual feature contributions to model predictions, offering insights into model behavior. However, they can be misleading if features are correlated, making it essential to interpret results cautiously.

How can large language models (LLMs) be applied in trading?

LLMs can assist in generating hypotheses, enhancing idea generation, and processing unstructured data. They are not designed to make trading decisions but can provide valuable insights and support throughout the trading process.

What is the significance of a structured workflow in developing trading strategies?

A structured workflow is crucial for integrating machine learning into trading strategies, ensuring that all aspects, from hypothesis generation to risk management, are systematically addressed. This approach enhances the likelihood of developing profitable strategies.

What advice is there for young people entering the job market in AI?

Young professionals should embrace AI tools, actively learn how to use them effectively, and balance their learning with practical applications. Engaging with coding agents and understanding their capabilities will enhance their skills and job prospects.

What can readers expect from the new edition of the book on machine learning for trading?

The new edition features a complete rewrite with a focus on systematic workflows, nine case studies, and extensive libraries for practical application. It aims to provide a comprehensive guide for integrating machine learning into trading strategies.

© transcribe · For agents Built with care and craft by Gokul Rajaram