I slaved for 12 years in the mines of this blog, toiling night and day, for all three of my readers. My now ex gf during five of those years once accused me of loving retirement finance and my computer more than her ;-) something which I can neither confirm nor deny, then or now.
Recently, just for fun and to see how it would go, I spent a couple hours recreating and recasting five or six of what I consider my sufficiently important or interesting coding projects into AI prompts <dramatic eye roll on all those wasted years>. I maybe should have waited for the advent of AI and saved myself at least some of those 11.999 years where I maybe didn't have to do anything. Or gone to a bar. Or traveled. Whatever, I thought I would share some of the prompts and projects here. To wit (each will be a separate post):
- GPT Prompt 01 - Spending Strategy Comparisons [this post]
- GPT Prompt 02 - Lifetime Probability of Ruin (LPR)
- GPT Prompt 03 - Dynamic Programming / HJB
- GPT Prompt 04 - Portfolio Longevity Heat Map
- GPT Prompt 05 - Perfect Withdrawal Rate (PWR)
- GPT Prompt 06 - Stochastic Present Value (SPV)
Some caveats first:
- The prompting process seems unstable for each re-prompt and yields varying results and is also conditional on the platform. I used ChatGPT's $20/month platform "Plus." Fwiw, I also save a physical copy so that I can re-force AI to more or less start from scratch each time rather than trusting it to remember stuff. Note that I actually had to re-prompt this after not looking at it for 6 months because it literally did not work after it had worked 50 times the last time I worked on it. Beware.
- AI's hallucinate and you have to take output carefully and/or with a grain of salt,
- Chat may evolve and obsolete the prompts,
- It helps to know the underlying theory and methods to second guess what it is doing. Otoh, one can have a dialogue now to figure it out,
- There are certain tasks it will NOT do. For example, it said once that it could do HJB on 2-asset allocation optimization and then when I said "ok, now run it," it said "sorry, bro, can't; it's too hard and will time out." It later created an acceptable work around but one needs to know what it can and can't do. It probably just want's me to pay more,
- I did this more or less "seat of the pants" so there might be assumptions Chat used for me during the many iterations that won't be resident in memory for you if you test drive. No idea...
- These are fairly trimmed down and focus more on simple versions of the theory. No fine tuning for fees or taxes or investor idiosyncrasies etc but those are probably easy enough to retrofit,
- Rigorous testing against a previously coded model has NOT been done. I guarantee I have probably mis-prompted somewhere in here and I don't even know it. The adjustment I just made to mortality for this post I have not rationalized, I just trusted Chat because I somehow got in an infinite loop and didn't want to think too hard, yet,
- This is titled "spending strategies" but is articulated below for comparing portfolios. It is trivial to swap to just one portfolio and use multiple spending strategies. Not shown. Maybe later. For the one of the three readers that care.
GPT Prompt 01 - Spending Strategy Comparison
Description
Rather than asking whether a retirement plan merely “avoids ruin,” this framework evaluates spending strategies by the lifetime well-being they actually deliver. Each candidate rule—fixed withdrawal rates, flexible rules, or utility-based spending—produces a stochastic path of real consumption over time, which is then evaluated using expected lifetime utility, weighting consumption by survival probabilities and (optionally) modest time discounting:
where is typically a CRRA utility function. Because raw utility is not directly interpretable, results are translated back into dollars via certainty-equivalent consumption: the constant real spending level that would yield the same lifetime utility. This approach captures the economic reality that early-life consumption, spending stability, and downside protection matter far more than late-life volatility or rare tail survival, and it frequently shows that conservative, floor-oriented spending policies can deliver higher lifetime welfare than mechanically “safe” withdrawal rules—even when those rules technically succeed.
[I let AI write the description so the narrative overview here pretty much sucks. Basically the model does a simulation to generate the expected discounted utility of lifetime consumption (EDULC) along a bunch of sim consumption paths. ie one may compare EDULC (or its certainty equivalents) for different portfolios or spending strategies and do some comparisons... Do you know or have you ever used MaxFi? This is the same thing except I am handing it out for free. Plus it is infinitely flexible...but way less sophisticated on things like taxes and social security and location buckets...but that'd be easy enough to fix I'd wager. This is my partial gift to you in other words because why pay for stuff we can get for free and especially when there are diminishing returns to marginal complexity ;-)]
The Prompt (which may or may not work anytime it is run)
Notes
If it won't run it, you might have to tell it to "Run this as a reproducible Monte Carlo now."
This sometimes takes a while. No doubt there are ways to speed this up
Follow-on analysis and charting and changes are fairly straight forward (not shown)
Sensitivity analysis for different spend rates? just ask. Guardrails? prompt
Output Example (when the prompt actually works)
No comments:
Post a Comment