Sunday, October 06, 2024

A software mind's eye

I have been writing higher-order functional programming in Python for the last few weekends:

  • hofppy (https://github.com/equational/hofppy) will be a Python library. For the moment it is a collection of Jupyter notebooks.
  • My initial goal was to have a handy FP toolkit which supports applied math with JAX's JIT. Yet I realise that in fact what I am really doing is reimplementing the generic part of a compiler for a reactive (trading) language I wrote in 2010 in F#, while including a few tricks I picked up since then, the primary one being to think of code as implementing a synchronous execution model.
  • There is really very little code like this on the web, therefore why I am doing this open source.

This blog is in part written to mention the above, as already the first JAX JIT supporting monad and comonad models are "nice". Yet this blog is also to bring up the subject of the process of creating new technology.

My recipe to do something new, such as lead a team on a new subject, write software that did not exist before is the following:

  1. Create a "mind's eye" imaginary world of "usage" of the end result.
  2. Imagine how it should work.
  3. Start very quickly to implement features.
  4. Review 1, 2, and 3, as you regularly cycle through them, again, again, and again!
I use the word imagine twice above. For a few reasons...

People are constantly asking me "how do you know?", with regards to client's requirements, technology, design, approach, etc. The reality is that I do not completely know: I know much, I have done much, written hundreds and hundreds of thousands of lines of software. Yet when something is new, no one knows fully how things will look in the end. The reality is the newer it is, the less you know. And... the more you think you know, the more you are fooling yourself. However, just like with poker, the optimal approach is to imagine much and often, and to work as hard as possible to build and maintain a mindful view of "new usage" and "new functioning technology".

The more experience, the better! As your imagination is only as good as the real details it contains. I have tons of real-life learning that I use for this higher-order FP in python. I mention here a few of them:
  • Lazy software design are easier express in code.
    • The most flexible design, is the code that does nothing but accumulates lazily what it could do, until finally because output is expected, it works backwards from output expectations to pull out the desired output.
  • Multi-stack semantics is perfectly normal. 
    • For example, in the project's above monadic code, the free monads have "their" variables, "normal" Python has its variables, and these are carefully kept separate.
    • Multiple flows of causality exist in the real world, stacks of various semantics is the only cheap way to capture these cleanly in software.
  • For every Ying, there is a Yang.
    • If there is more, there is also less; If there are variables, there are constraints, etc.
  • Structure is more important than types.
    • I started in functional programming without the types. Then I embraced types. And yet to understand that the sweet spot is somewhere in between. The reality is that it is much easier to use code to constrain software "just a right level" than to use types.
  • Math is the most powerful structure.
    • Think geometry, topology, and dualities!

 All original content copyright James Litsios, 2024.

Monday, October 30, 2023

The personality of going Infinite

 "A bit shallow" is my short review of Michael Lewis Going Infinite book on the rise and fall of Sam Bankman-Fried (SBF). Still, I don't have an issue with the lack of content, as that reflects the reality of the open legal situation. I do however find the psychological presentation of SBF a bit shallow. 

(Background info is that SBF started his career as a trader at Jane Street Capital, a high frequency trading firm).

When hiring a trader, you are looking for someone that balances drive and analytical thinking (personality state 2 below). You also want a trader that is emotionally connected to their work. In high-frequency trading the software and the math trades, not the person. As a result the trader must have "empathy" for their models, for their algorithms, as these do the trading. These models and algorithms are complicated, and need clear mind to be felt. As a result, when hiring an electronic trader, one might look for people that can "shut out normal emotions" and connect to the "made up emotions" of markets, models and machines. In a previous post this year, I mentioned this "shut out emotions" state as  "preserving a depleted emotional space" state (state 1 below).  

A depleted region in semiconductors, is an area where electrons have been "pushed away". Resulting in a region that needs electrons to be "normal" again. I use here the term depleted emotions in a similar maner: it is a state of mind that lacks emotions, and only becomes active emotionally with an inflow of emotions from others, or by a focused effort of the person. With no inflow, the amount, and the depth of emotions stays minimal.

Let's call "Goal Oriented-Analytical-Preserving emotional Personality" (GOAPP), as person that seeks to balance their personality state of analytical goal orientation with their need to preserve an almost none-emotional (e.g. intellectuel) view of the world.

Most of us react to social moments, many of us buy things. State 4 below captures the balance of the two. Most of us resonate with our emotions (state 3 below). 


There is a "Follower-Consumer-Emotional Personality" (FCEP) which is on the opposite corner of  GOAPP.  These two personalities can co-exist in multiple manners. From a GOAPP perspective:
  1. FCEP might be embraced as the ever elusive normality.
  2. FCEP might be rejected in a form of self-handicapping denial.  
My feeling is that SBF falls into the second category above: A goal-oriented analytical person, that in part denies their emotions, and yet also the emotions of others, as well as denies the normality of others to be part of society, both as consumers and as followers of social trends. This explain in part the crazy interviews: having denied himself the normality of emotions and social belonging, he lived out his fantasy of rational normality, which really does not end up containing much.

All original content copyright James Litsios, 2023. 


Saturday, October 07, 2023

Dark machine learning poem

A recent news on advancements in ML (thank you Andy Gray!) inspired me to open up chat GPT, and ask the following:

  • Can you write a poem inspired by the song I can do better in Annie get your guns. The subject is how machines always end up doing better than people. Finishing with the subject of machine learning.
  • Can you rewrite instead start positive but end darker
  • Can you replace Annie by people and guns by future?

To produce:

In a world where machines shine so bright,

Their prowess, a beacon, in the day and the night.

"I can do better," people declare with delight,

But beneath the surface, a storm brews in the night.


People, forge your future, take your stand,

But machines, they've claimed this new land.

They excel, they conquer, they've taken control,

And the human spirit, it pays a heavy toll.


From factories to homes, they've seized the throne,

In domains where once only people were known.

They learn and adapt, with a relentless drive,

Leaving us to question if we'll ever survive.


In the realm of machine learning, they excel,

In a future that's uncertain, where shadows dwell.

As they grow in power, dark secrets they keep,

And the price of progress, it runs deep and steep.


So, let's tread carefully, my friend, with care,

For this path we're on, it's a perilous affair.

In a world where machines and people unite,

We must be vigilant, for the future may bite.

I have surfed advanced technology, software and math throughout my career. I know enough that it would be silly not to reflect about the darker implications of machine learning. Therefore, this little poem, an artistic self-referencing plagiarism of ML about its darker potentials.

All original content copyright James Litsios, 2023.