Model Collapse and Generative AI

AI is taking off… to the extent that there are discussions from many think tanks of AI writing its own code and growing exponentially… an idea originally proposed by Ray Kurzweil.

This sci-fi sounding idea brings with it hope and fear for many. What role will developers have if AI can not only code the software we ourselves develop, but also its own programming?

A recent paper details a phenomenon known as “model collapse”:

“A Note on Shumailov et al. (2024): `Al Models Collapse When Trained on Recursively Generated Data” (link in bottom)

The idea is that a Generative AI system, trained on synthetic data, will inevitably lose a basis in reality through the act of degradation of its outputs that it then trains on. Image attached for conceptualizing.

To anyone who develops, we know the inherent nature of feature requests… adding a feature to an existing structure. For developers with enough experience, the flow of the code emerges and much like directing water, we adapt and introduce a new flow alongside the existing flow. Layers emerge and we learn to adapt the new features to the existing ones without breaking.

The inevitable risk of AI taking over this task without human input, is a degradation in code as AI trains itself on the code it generated to add new features. In other words, a degradation of code until the risk of error is high and the whole system breaks.

Model collapse is a feature that this paper suggests is a statistical outcome that is “unavoidable” in generative AI models (e.g. LLMs)

This suggests that developers will benefit from the current type of AI being developed, but AI will need to interact with our minds to create code that doesn’t break.

We are so quick to think our minds are only Computational units, and in so doing, we have lost a great deal of faith in what makes us human and what we are capable of. Have faith in yourself. Have hope in your humanity.

https://arxiv.org/abs/2410.12954

The Chinese Room Problem

Image Made by Meta AI

AI is impacting us daily. We see tools writing literature and creating art as if designed by their favorite authors and poets. We see whole posts being summarized and replied as if by some magician crafting a delicate string of words that was prompted by less than a paragraph of text. It’s for this cause I am deeply reminded of a thought experiment presented in the 1980s.

14 years ago, I took a course that would finish my Psychology minor for my undergraduate degree in Computer Science. The course was titled Psychology of Consciousness and it was a deep dive on the psychological theories surrounding the phenomenon we call consciousness. Concepts including Cartesian dualism, material monism, idealism, as well as many other concepts deeply related to how we experience consciousness.

The Chinese Room argument relates to AI, and it is a deeply needed thought experiment that might help add another layer to an increasingly complex phenomenon.

In the experiment, a man is requested to produce a string of Chinese words despite not knowing or understanding Chinese from a series of prompts that are written in Chinese.

The man is given a series of books in his native language that show how to manipulate and write Chinese to answer the reply. In no way does the man understand the Chinese characters, he has no understanding of the words being provided him. He is simply shown how to move characters around to converse with the prompt. The man effectively replies to Chinese with Chinese, and for all intents and purposes, a conversation took place that was in Chinese.

The thought experiment (prescient from the 1980s) is an argument that shows that (at current) AI produces language through a series of computerized operators that needs no underlying understanding of the meaning of the language, it needs only to understand how to manipulate language to form meaning. Does that mean AI isn’t useful? Certainly it is useful. But we must always consider this argument. We are talking to a system that we have shown how to manipulate strings of text to respond to us, that is no simple feat, but we are still far from creating the kind of Consciousness that will lead to much larger questions. When that day comes, let’s learn the questions we should be asking.

Chronicling my Food Adventures

Many years back, I started chronicling my food adventures not expecting much.

Over those years, as I’ve spent time reflecting on these meals and producing videos, pictures, and reviews, I’ve become acutely aware of the role food plays in our lives, not just to nourish the body… but also to nourish the spirit.

There are many in the world crafting nourishing food that often get missed, including their mission in the world. The last few years I’ve gradually been highlighting the places that I feel have restored my mind and spirit.

In a way, I’ve given thanks to a heritage that dates back to one of my grandmothers making marzipan as well as turnovers filled with rich spinach and feta and another making foods like stuffed peppers and various Bulgarian goodies whenever she visited.

This Labor Day, I produced a YouTube video of me smoking pasture raised meat from a local farm specializing in ethical and sustainably raised cattle. A place dedicated to nourish the Earth, the soil, and the microbiome of their farm. It gained 10,000 views. While my food pictures and videos have gained over 3.5 million views on Google Maps. These number shook me a bit. My passion is getting noticed… a heritage found deep within is being expressed and seen in ways I did not expect.

It is in this observation of self, both externally and internally, that we really discover who we are as people.

In this discovery of self, I have focused on providing visibility of restaurants and farms that have brought to the world a glimmer of beauty that can go unnoticed by the world.

As Jung said, “The privilege of a lifetime is to become who you truly are.” This journey is taken not alone, but by people that we share in hope.

Series: Coffee with Shay – The Fellow Pour Over Set

My wife got me something I’ve been eyeballing for several months for my birthday and I couldn’t be happier.

The Fellow Stagg EKG Pro Series Studio Edition

There are several aspects to pour overs that need to be repeatable to get the perfect cup each time. These are:

  • Coffee Freshness
  • Hardness and mineral composition of water
  • Coffee Grind Size
  • Accurate Measurement
  • Flow Rate of Pour
  • Water Temperature
  • Sequences and Timing of Pours
  • Coffee to Water Ratios

Each one of these can be controlled by a different instrument.

To control mineral composition, you can look for filtered water, or get an RO system

To control coffee freshness, you can get the Fellow Atmos Vacuum Cannister

To control Coarse level of coffee, I cannot recommend any higher the Fellow Ode Gen 2 Grinder. Which features precise control and is engineered perfectly.

To control Flow Rate, the Fellow Stagg EKG Pro Series Studio Edition is a must. The pour rate allows for full coverage blooming, and excellent disturbance to extract a full body cup

And of course, a good kitchen scale will provide the perfect measurements.

When these tools combine, you get yourself a perfect cup each time. With minimal variations between pours.

Series: Coffee with Shay Japanese Iced Coffee (Recipe 2)

This Recipe improves on the previous recipe. It contains a different bloom point, finer grind setting, and much faster brew time

Ingredients

  • 50g Coffee Ground to Setting 5 on Fellow Ode Gen 2 Grinder
  • 400 – 450g of Ice
  • 500g Filtered Water Heated to 200 °F. It helps to add additional water to kettle to preserve heat retention throughout pour
  • Half & Half to taste

Recipe

  • Heat water to 200 °F .
  • Add 400 – 500g of Ice to Bottom Chamber on Chemex
  • Grind 50g of Coffee at Setting 5 on Fellow Ode Gen 2 Grinder
  • Wet Filter
  • Set up Chemex with Filter and Coffee Ground
  • Pour gently 50 – 60g of water to allow coffee to bloom
  • Let sit 30 seconds
  • Add Water to 275 – 300g
  • Wait until water pushes through filter
  • Add Water to 500g
  • Serve with Ice and Half and Half to taste

Coffee with Shay Series: Japanese Iced Coffee with Chemex

The Japanese Iced Coffee:

The Ingredients:

  • 50g of Coffee ground to Setting 6 on the Fellow Ode Gen 2 Grinder
  • Around 450g of Ice added directly to Chemex chamber
  • 500g of water heated to 200 degrees Fahrenheit
  • Heavy Cream to preference

Recipe:

  • Add around 450g of Ice to Chemex Chamber
  • Add filtered water to water kettle and set to 200 degrees Fahrenheit
  • Grind 50g of Coffee to Setting 6 on the Fellow Ode Gen 2 (Medium)
  • Wet filter
  • Add coffee to top chamber on top of filter
  • Add around 150g of water and let “bloom” for 30 seconds
  • Add rest of water in 150g intervals until reaching 500g of water

Enjoy

Series: Coffee with Shay (The Fellow Ode Gen 2)

What can the Fellow Ode Gen 2 teach you about Software Development? You’d be surprised.

Last night I took apart my grinder for maintenance and cleaning and I was blown away by the intricate design. The design was modular and built on itself like an N-Tier application or like the Sitecore Helix Architecture. Each piece was foundational to the level in front of it. Forming an intricate series of layers that each produced a product that has surprisingly delicate consumer facing results.

As I reassembled the machine, I learned more about how each piece was foundational to the overall design. I still have a ton to learn about this grinder, but I’m happy I got the opportunity to disassemble this device.

Series: Coffee with Shay (Oleato Cold Brew Cold Foam)

This is perhaps one of my favorite creations. The Oleato Copy Cat.

Equipment used:

  • Vitamix A3500 Blender with Aer Disc Container
  • Mason Jar Cold Brew Maker
  • Fellow Products Ode Gen 2 Grinder

Ingredients I use:

Cold Brew:

  • 70g Heirloom Coffee Roasters Sugar Phoenix Blend
  • 1500g Filtered Water

Cold Foam:

  • 150g Skim Milk
  • 17g Monin Brown Butter Toffee Syrup
  • 7g Partanna Sicilian Extra Virgin Olive Oil

Recipe

Cold Brew

  1. Grind 70g Coffee to setting 10 (Medium High Coarse) on Fellow Ode Gen 2 Grinder
  2. Add Coffee to Mason Jar Filter
  3. Add 1500g of filtered water to Mason Jar
  4. Submerge filter in water
  5. Close and let sit for 10+ hours in fridge

Cold Foam

  1. Add 150g of Skim Milk to Aer Disc Container
  2. Add 7g Partanna Sicilian Olive Oil
  3. Add 17g Monin Brown Butter Toffee Syrup
  4. Blend on setting 6 for 1 minute

Assemble and Enjoy!

A side-by-side comparison of three Maximum LINQ Aproaches

Let’s perform an analysis on different Methods of attaining the maximum value of a list of elements.

One of the limitations that I’ve encountered of the Max LINQ statement is the inability to handle empty sequences. Usually, what I’ve seen is the use of Order By Descending and First Or Default to grab the maximum value of an array. This sorting algorithm approach, while common, is O(n lg n). The Maximum LINQ query, in comparison is O(n).

But are they substantially better when dealing with possible empty sequences?

Method 1: OrderByDescending
Method 2: DefaultIfEmptyMethod
Method 3: DetectIfEmpty Method
Performance Analysis

From the analysis, the OrderByDescending and FirstOrDefault when benchmarked is on average 27us faster on an array of 5000 elements. But what’s fastest is using the Any Clause and null check. At approximately 20 us and 50 us from Order By Descending and Default If Empty method.

What is interesting is the memory allocation of the Maximum and DefaultIfEmpty LINQ is half of the allocation of the OrderByDescending. But DetectIfEmpty method is right in between the two, at 160 B compared to 105 B for the DefaultIfEmpty and 200 B for the OrderByDescending.

While the Algorithmic complexity of the Max is much better than the Sort Algorithm at O(n) vs O(n lg n). The introduction of the DefaultIfEmpty method and the need for a null check in the Max clause, increases the Algorithmic Complexity. We do see a 50% reduction in Allocated Memory. While not the prettiest, evaluating the query and performing a null check and an any clause to grab the maximum value is a lot more time performant than both methods, although not as space efficient.

A C# Back End Developer’s Dream

In one of my Master classes, a teammate and I were going through the process of pushing API Models into C# for NewtonSoft JSON library through Visual Studio. I began to search online to see if there’s a better way of doing this. After all, Microsoft must have developed a way to mass migrate Models. Sure enough there is. This video details the process: