local maxima

local maxima

Tomorrow I'm taking the train from Elche to Madrid. Again.

Four days with the team, then back - we do this every month now, last week always in the office. As I pack my bag for the seventh time, I can't shake this feeling: I'm solving for the wrong variable.

Here I am, optimizing my commute between two Spanish cities, when maybe the real question is whether I should be on a different continent entirely.

the optimization problem

In machine learning, we talk about local versus global maxima. You can climb to the top of your current hill - optimize perfectly within your constraints - and still be on the wrong mountain.

That's what these train rides feel like. I've perfected the routine: the 5:30 AM alarm, high-speed train, Madrid-Chamartín station in less than 3 hours. I've optimized locally. But every kilometer closer to Madrid reminds me how far I am from San Francisco.

My colleagues fly to Peru, Mexico, Italy - signing clients, building globally from Spain. We're 6 months old and already international. It works. But "it works" isn't the same as "it's optimal."

always climbing

I grew up wanting to leave Astana.

Every opportunity to travel felt like a door opening to somewhere bigger. I took them all - exchange programs, competitions, any excuse to see what else was out there. Eventually I stopped going back. The city I was born in became a place I visit, not a place I live.

Back then, I thought I was climbing toward the global maximum. Each move felt like progress up the mountain. Higher salary, better opportunities, more interesting problems.

But sometimes when you think you're optimizing globally, you're just finding bigger local maxima. Gothenburg wasn't the peak - it was just a taller hill than Astana. Madrid wasn't the summit either.

Now I wonder if this constant optimization is the trap itself. Maybe the real global maximum isn't a place at all. Maybe it's the ability to build something meaningful regardless of coordinates.

Or maybe that's just what I tell myself on a regional train in Spain.

the pull of the global maximum

I have FOMO about California. There, I said it.

Every Twitter thread or LinkedIn post about someone who "finally made the move" hits different when you're sitting on a regional train in Spain. Every funding announcement from a Bay Area startup in my space. Every story about the conversation at a coffee shop that turned into something bigger.

And I've been told by many friends that "things just happen" in the Bay Area. Everyone is there, communicating, thinking, creating. That multiplies. Serendipity increases.

In Elche or even Madrid, there's no random encounter with another builder at a coffee shop, no overhearing a conversation about LLMs that sparks an idea. I have to explicitly seek these connections online, and that's exhausting in a different way.

I know the counterexamples exist. Shopify from Ottawa. Atlassian from Sydney. Spotify from Stockholm. Mistral building frontier models from Paris. AI development is truly global now and the best models come from everywhere: Hugging Face, DeepSeek, ElevenLabs, Stability AI. Even Kazakhstan has a GenAI unicorn now, Higgsfield.

But knowing the exceptions doesn't eliminate the feeling that I'm playing the game on hard mode for no good reason.

Would moving to the Bay change my trajectory? Absolutely.

what global maxima can cost

Moving to the Bay would mean starting over. Again.

The visa labyrinth, the green card wait, the $5,000 apartment that costs €850 here - those are just numbers. The real cost is what I'd be asking of my family.

We've been in Spain three years now, after moving from Sweden, after moving from Kazakhstan. My wife has rebuilt our life in three countries. My boys are finally settled in school, speaking Spanish like natives, with friends and teachers who know them.

Asking them all to descend one more time, to trust that there's a better peak somewhere in California - when we finally have something that works? What if the global maximum for my career is the local minimum for my family?

To optimize globally for career, I'd have to completely de-optimize for family stability. The very support system that lets me take risks would be the first thing I'd lose. And for what?

The possibility of faster growth.

The chance that proximity unlocks something I can't access from here.

the local maximum isn't so bad

When I'm not spiraling about optimization, I notice what I have here.

I can code until 2 AM when the idea won't let go, then walk to get coffee in five minutes. Have lunch with my kids. The deep work happens in that rhythm - not in one hour commute to an office or in back-to-back meetings optimized for a Bay Area calendar.

Building requires focus time and creativity. Creativity requires time in between to let your ideas work themselves out.

Our monthly convergence in Madrid works. Decisions that would take three Slack threads happen in five minutes over coffee. You catch the doubt in someone's voice, the excitement in their gestures. We get enough of that to move fast, then return home to do the work.

And we're not exactly failing. Our AI agents are talking to candidates in several countries. We're solving real problems for real companies. The work is good, even if the location feels suboptimal.

correct objective

On tomorrow's train, somewhere between Elche and Madrid, I'll think about this again. I always do.

But maybe I'm asking the wrong question. Instead of "am I optimizing correctly?", maybe it is "optimizing for what?":

  • For maximum career velocity? Move to the Bay.
  • For sustainable family life? Stay in Spain.
  • For highest expected value? Depends on your utility function.
  • For actually shipping products? Wherever you can focus.

The global maximum is only optimal if you can actually survive there long enough to benefit.

living with the question

I haven't said this yet: I want to be a founder, not just an engineer.

Right now I'm learning from the inside - how to build agents that work in production, how to navigate early customer conversations, what it takes to go from zero to product-market fit. I'm building the foundation.

But I'm also betting I can do it from here. That when the time comes to start something, the network I've built remotely, the credibility from shipping, the understanding of global markets - that all of this will matter more than the zip code.

For my 21-year-old self in Toulouse, discovering that Europe had many faces, the answer was obvious: go everywhere, optimize for experience.

For me now - building AI agents from Spain, supporting a family of four, working with a distributed team - the calculation is more complex. Every variable I optimize for makes another one worse.

So I take the train to Madrid. I build from Elche. I watch friends move to California and friends succeed from unexpected places. I hold the question without forcing an answer.

Some mornings that feels like strategy. Other mornings it feels like I'm postponing the real risk.

Both are true.

Tomorrow, when I board that train, I'll think about this again. I always do. The landscape will blur past the window - Spanish countryside I know now by heart - while I wonder about valleys I've never seen.

But I'll also open my laptop and code. Because in the end, shipping is the only optimization that matters. And you can ship from anywhere, even from a regional train between two Spanish cities, even when you're not sure it's the right mountain to climb.