AI (Artificial Intelligence)

I suspect some plugin code will look different by then (check demos):

(But currently training data only up to September 2021, i. e. KiCad 5.1 bindings… Maybe make sure KiCad and plugins have active mirrors on GitHub since they use it for training data.)


Hmm…, people could now understand what my code does…

Input:

# Python 2 
try:
    from functools import cache
except ImportError:
    def cache(function):
        from functools import wraps
        from collections import defaultdict
        class cachedict(defaultdict):
            def __missing__(self, key):
                self[key] = val = self.default_factory(*key)
                return val
        cache = cachedict(function)
        @wraps(function)
        def wrapper(*args):
            return cache[args]
        wrapper.cache_clear = cache.clear
        return wrapper

# Explanation of what the code in the exception clause does

Output:

# The cache decorator is a memoization decorator. It caches the return value of the decorated function.
# The first time the function is called, the return value is cached.
# The next time the function is called with the same arguments, the cached value is returned.
# This is useful for expensive functions that are called repeatedly with the same arguments.

# The code in the exception clause is a reimplementation of the cache decorator.
# It uses a defaultdict to cache the return values of the decorated function.
# The defaultdict is initialized with the decorated function.
# The __missing__ method of the defaultdict is overridden to call the decorated function with the missing key.
# The return value of the decorated function is stored in the defaultdict and returned.
# The cache is cleared by calling the cache_clear method of the wrapper function.

# The cache decorator is available in Python 3.2 and later.
# The code in the exception clause is a reimplementation of the cache decorator.
# It is compatible with Python 2.6 and later.
# It is not compatible with Python 3.2 and later.
# It is not compatible with Python 3.2 and later because the cache decorator is available in Python 3.2 and later.

AI???
Doesn’t someone/s still write a programme and the computer just does as it’s told?

Interesting topic. Gotta see it keeping some time in hand. Thanks.

Isn’t it interesting to do it yourself? Draw Board Create Code? Use the Internet as a tool for information and not make it a means of work?)

Ha, maybe someday AI will design boards and the unit fanatics will have to find some other cause to espouse. :rofl:

1 Like

I gotta wonder if I am the only one just cringing at the idea of AI design? I love circuit design, pcb layout, programming… – because it is all challenging, engaging, interesting and satisfying. I’ve loved it since first getting the bug in the 70s (so full disclosure on being an old fart). Now we have a generation of engineers programming the robots so subsequent generations of engineers will just be doing what the robots tell them to do, as they float around in their wall-e chairs.

Ahh well, progress I suppose. Pardon the rant. I need some time on my wood lathe where the only automation is a 2HP motor, and I will delight in nothing but human knowledge.

1 Like

Wonder no more. This other old fart is also cringing.
I also wonder just how much information AI is attempting to glean from all those Youtube videos. :face_with_spiral_eyes:

As a result we have the developer of electronics who isn’t able to solder) the Driver who isn’t able to drive without computer and to a toilet all amicably go on a dedicated line to speeds of provider… Sadly

1 Like

I got started in electronics in the early 70’s. I lived through the transition from rubylith to CAD, from assembly to compiled languages (yes, that was also a contentious issue back then), and from machining to 3D printing. Only one thing has remained constant, and that’s the question that’s always in your head: How do I do this to get what I want?

Whether you’re cutting on a photomask with an xacto knife, nudging a trace on a screen, or prompting an AI to generate some HDL, it always comes down to “How do I do this? How do I get closer to my goal?” We are always trying to solve a puzzle.

The issue with AI is that it seems to take agency from us, as if we only need to express our desires and the solution will be delivered to us on a platter. It’s feels like we are not needed. Like we are the indolent Eloi who are seemingly served by the Morlocks, but are actually their cattle. And nobody wants to be cattle. Because they get eaten.

But that issue has been with us for a long time. Compilers generate optimized code in seconds that most of us couldn’t write in hours (if at all). The same with DRC/ERC checks across millions of potentially interacting components. But we’ve gotten used to these tools and we (simplistically) think we know how they work, so they don’t challenge our position as the one who’s in charge.

But we also kinda know how this AI works: lots of simple neurons, even more interconnections, and gigatons of data. The thing we don’t know is why this human-like ability to generate meaningful sentences emerges from it. But we already have lots of experience with emergent systems, such as our economy. And we can deal with AI the same as we do with the economy: nudge, cajole, beg, threaten. The challenge is the same in either case: How do I get the system to do what I want? whether that’s getting food and clothing to a population or removing a 60 Hz hum from a power supply.

You can see some of that in my interactions with ChatGPT/GPT4: “Do this. No, that’s not quite right. Change this to that. Better, now try again.” It’s a different way of working, just like using a lathe differs from whittling a branch with a knife. Different tools, same objective.

And just like a lathe, AI not only helps you do what you’ve always done, but also lets you do new things. Large language models like ChatGPT contain a wealth of knowledge from the entire internet and make it available through a low-friction interface. You can access this knowledge to guide your design, especially in areas outside your expertise. Need information about waveguides or salinity detectors or potential markets for the widget you’re designing? Done. So maybe you can spend less time on grunt work and more on doing interesting stuff that you couldn’t do before while still employing your hard-won skills and years of experience.

And just like KiCad helps make electronic design more accessible to a wider audience, AI will do the same. They’ll be able to build low-performance systems unaided, and get 90% there on more complicated stuff. So maybe you’ll be able to spend less time answering noob questions on this forum and helping them with higher-level issues. Everybody will have more fun!

Read this for a more nuanced view of how AI can help us be better at what we do.

7 Likes

Well fair enough @devbisme – I should learn more about ai to see what all the interest is about. Your analogy about the assembler to compiler transition was on point. I recall the distrust in compilers and balking at larger needs to accommodate them. It’s a brave new world.

I think for all of us it’s important to keep an open mind. Just not so open that stuff starts falling out…

As I understand it we will not need to solve problems, we will only need to define problems to be solved (may be next definition of problems will also be out of us).
But I have read several times that using your brain to solve problems is what delays dementia diseases. I’m not sure if I like such future…

I’ve also been thinking this over for half the day.

The skills and experience are needed to verify the solution because can this glorified search function/filing cabinet always be trusted?

I read your experience regarding interactions with ChatGPT. It seemed you were using your abilities to manipulate the AI to get a correct result. Will that AI learn from its experience with you??? If it does, OK I will consider it AI, if not, it’s still just a filing cabinet.

My biggest concern is not for the skilled and experienced, but for the rest. If this AI relies on the internet for correct solutions well…

A long time ago, we invented agriculture. This meant some people who would have died because they couldn’t recognize poison berries actually survived, and some of them invented numbers and accounting to keep track of all the grain being produced.

But multiplication was always a problem, so eventually somebody invented logarithms and more people could do it because adding and looking stuff up in a table was so much easier.

But then people wanted to do lots of multiplications to figure out stuff they couldn’t figure out before (like how to drop cannonballs on their enemies). So that gave rise to mechanical calculators. Then electronic ones. And finally: computers!

But machine-language programming was hard, so assemblers and then compilers were written. So using computers got easier and more and more people started writing programs for more and more types of things, and computers kept getting better to handle all the new problems they were being tasked to solve.

So now we have AI. Will it make our brains soft and mushy? That’s what they told us about calculators back when I was in college. I don’t think that happened although maybe my brain has become so soft and mushy I can’t tell. But let’s assume for now that didn’t happen.

So just based on extrapolation from the past, improvements in the technology that lets us compute has led us to attempt to solve larger and more complex problems. Smarter, not dumber. Every time.

Will this time be different? I don’t know, but that’s never happened before. But don’t take anybody’s word for it (positive or negative): Go get an account and try some of this stuff. See if you can generate anything that’s useful to you. Then you’ll have some real data to form an opinion.

1 Like

If you look at my second attempt, all I asked for was a circuit to drive a relay from a microcontroller. The AI composed a circuit using a relay, transistor, flyback diode and a resistor with the appropriate connections expressed using SKiDL syntax and got it 95% correct on the first attempt (with explanatory documentation). Its errors were related to part libraries for which there probably isn’t much training data on the internet.

If that seems like a file cabinet, then it’s a file cabinet where you can remove a single sheet of paper and the cabinet says “Oh, I see that’s your 2020 taxes. Here’s your wage and bank account info and I’ve noticed some changes in the regulations that may allow you to re-file and get back an additional $421.35 with negligible chances of triggering an audit.” I may not trust the exact amount, but I will take it as an alert that there might be something to look for. (That’s the way we should treat everything we’re told, whether its from an AI, a SPICE program, or another person.)

When OfficeMax sells a file cabinet like that, then I’ll be down there to buy a dozen.

The AI is based on transformers which have no short-term memory except for what is placed in their input buffers. The solution to that is to place previous output into the input buffer along with new commands to create an output that knows about what the AI previously did. The limitation is that the input buffer is something like 4K - 32K tokens (depending upon how much you want to pay).

For incorporating knowledge long term, you can place the AI’s outputs into the training data and regenerate the neural weights. That’s expensive in time and money so it doesn’t get done too often. I expect this will be actively addressed.

From past topics I’d think there would be more interest in using it for auto routing.

Maybe the AI is still learning the German Language?
Maybe the AI is not proficient at soldering so the AI has decided omitting that step is more prudent than getting it wrong? :rofl:

Or it is so proficient that soldering is self-evident and doesn’t even come to its mind to mention.

If AI was explaining a product design in 1988, it would have sounded kinda like this:
The Rockwell Retro-Encabulator
(the original design of which dates back to the 1940s)

And maybe for placement of the footprints, ignoring the ones you require a specific location of course.