ChatGPT4 and Engineering

This is largely unrelated, but since so many are doing design work here I thought I’d highlight what the future might hold. Watch this exchange I did with ChatGPT4.0.

First, I asked

What is the noise density of an OPA1612 opamp in non-inverting configuration with a gain of 10 using a 1kohm feedback resistor?

This question is mostly constrained. Note I haven’t specified the frequency for the noise density, but most folks would assume 1 kHz. We can quickly proto this up in TI’s TINA spice software.

image

Since we asked for the gain to be 10 with a feedback resistor of 1K, that means R2 must be 111.

ChatGPT responds:


In a non-inverting amplifier configuration, the gain (A) can be calculated as:

A = 1 + (Rf / Rg)

where Rf is the feedback resistor and Rg is the resistor connected between the inverting input and ground. Given that the gain (A) is 10 and the feedback resistor (Rf) is 1 kΩ, you can find Rg:

10 = 1 + (1000 Ω / Rg)
Rg = 1000 Ω / (10 - 1)
Rg ≈ 111.11 Ω

Now let's find the noise density. The OPA1612 datasheet specifies a voltage noise density of 1.1 nV/√Hz (nano-volts per square root of Hertz) at 1kHz. In a non-inverting configuration, the op-amp noise gain is approximately equal to the closed-loop gain, which is 10 in this case.

The output noise density can be found by multiplying the input noise density by the noise gain:

Output noise density = Input noise density × Noise gain
Output noise density ≈ 1.1 nV/√Hz × 10
Output noise density ≈ 11 nV/√Hz

Thus, the noise density of the OPA1612 op-amp in a non-inverting configuration with a gain of 10 and a 1 kΩ feedback resistor is approximately 11 nV/√Hz. Keep in mind that this is a simplified analysis, and other factors such as resistor noise and current noise can also contribute to the overall noise performance of the circuit.

This is a very, very good first answer. Especially when you look at how clearly it’s laid out. Note that ChatGPT has correctly pulled the noise density from the data sheet, including the pertinent frequency (1 kHz). ChatGPT also correctly figured out the value of the other resistor.

And in the above answer, ChatGPT tells you it has omitted the resistor and current noise. So, let’s ask it to consider the resistor noise:

What is the contribution of the resistors to the noise?

And ChatGPT responds:

To calculate the noise contributions of the resistors, we need to consider the thermal (Johnson) noise generated by the resistors. The noise voltage density of a resistor can be calculated using the following formula:

Vn = √(4 * k * T * R)

where Vn is the noise voltage density, k is Boltzmann's constant (approximately 1.38 × 10^(-23) J/K), T is the temperature in Kelvin (usually assumed to be 300K, or 27°C), and R is the resistance in ohms.

Let's calculate the noise voltage density for both the feedback resistor (Rf = 1 kΩ) and the ground resistor (Rg ≈ 111.11 Ω).

Vn_Rf = √(4 * 1.38 × 10^(-23) J/K * 300 K * 1000 Ω)
Vn_Rf ≈ 4.07 nV/√Hz

Vn_Rg = √(4 * 1.38 × 10^(-23) J/K * 300 K * 111.11 Ω)
Vn_Rg ≈ 1.29 nV/√Hz

Now we need to consider that the noise contributions from the resistors will be multiplied by the noise gain of the circuit (which is 10, as calculated previously). Therefore, the noise contributions at the output would be:

Output noise_Rf = Vn_Rf × Noise gain ≈ 4.07 nV/√Hz × 10 ≈ 40.7 nV/√Hz
Output noise_Rg = Vn_Rg × Noise gain ≈ 1.29 nV/√Hz × 10 ≈ 12.9 nV/√Hz

Finally, to find the total noise contribution from both resistors, we can use the root-sum-square (RSS) method:

Total resistor noise = √(Output noise_Rf^2 + Output noise_Rg^2)
Total resistor noise ≈ √((40.7 nV/√Hz)^2 + (12.9 nV/√Hz)^2)
Total resistor noise ≈ 42.4 nV/√Hz

So, the noise contribution of the resistors in the non-inverting amplifier configuration with a gain of 10, a 1 kΩ feedback resistor, and a 111.11 Ω ground resistor is approximately 42.4 nV/√Hz.

This is another clearly specified answer. But, unfortunately, it’s wrong. ChatGPT took the contribution of each resistor and root summed those. But the correct answer is to consider the equivalent resistance. In the small XLS below you can see the difference in outcome. If you want to know the noise contribution of a 1k and 111 ohm resistor, and you do the root sum of squares on that you’ll get 4.29nV, which, when gained up 10X you get the 42.9nV. But the correct way to look at it is by considering a single R which is the equivalent resistance. That gives us 1.28nV (which would be 12.8nV when gained up 10X).

image

OK, so let’s nudge GPT4:

When computing resistor noise, you should consider the parallel equivalents of the two resistors.

And incredibly, ChatGPT4 suddenly KNOWS it was wrong fixes it:

You are correct, my earlier response did not account for the parallel combination of the resistors, which is necessary to accurately compute the resistor noise. In a non-inverting amplifier configuration, the input-referred noise due to the resistors is determined by the parallel combination of the feedback resistor (Rf) and the ground resistor (Rg).

To find the equivalent parallel resistance, we can use the formula:

Req = (Rf * Rg) / (Rf + Rg)

Given Rf = 1 kΩ and Rg ≈ 111.11 Ω:

Req = (1000 Ω * 111.11 Ω) / (1000 Ω + 111.11 Ω)
Req ≈ 100 Ω

Now we can calculate the noise voltage density for the equivalent parallel resistance using the thermal noise formula:

Vn_Req = √(4 * k * T * Req)
Vn_Req = √(4 * 1.38 × 10^(-23) J/K * 300 K * 100 Ω)
Vn_Req ≈ 1.29 nV/√Hz

The input-referred noise of the parallel equivalent resistors is 1.29 nV/√Hz. To find the output noise, we need to multiply the input noise by the noise gain of the circuit (which is 10, as calculated previously):

Output noise_Req = Vn_Req × Noise gain
Output noise_Req = 1.29 nV/√Hz × 10
Output noise_Req ≈ 12.9 nV/√Hz

Thus, the noise contribution of the parallel equivalent resistors in the non-inverting amplifier configuration with a gain of 10, a 1 kΩ feedback resistor, and a 111.11 Ω ground resistor is approximately 12.9 nV/√Hz.

And then I ask for the combined contribution of opamp and resistor noise:

OK, so if the resistor output equivalent noise is 12.9 nV, and the opamp contribution is 11 nV, what is the combined contribution?

And ChatGPT responds:

To find the combined noise contribution of both the op-amp and the resistors, we need to use the root-sum-square (RSS) method, which combines the individual noise contributions by taking the square root of the sum of the squares of the individual noise densities.

Combined noise density = √(Op-amp noise density^2 + Resistor noise density^2)

Given the op-amp noise density is 11 nV/√Hz and the resistor noise density is 12.9 nV/√Hz:

Combined noise density = √((11 nV/√Hz)^2 + (12.9 nV/√Hz)^2)
Combined noise density ≈ √(121 nV²/Hz + 166.41 nV²/Hz)
Combined noise density ≈ √(287.41 nV²/Hz)
Combined noise density ≈ 16.96 nV/√Hz

Thus, the combined noise contribution of the OPA1612 op-amp and the resistors in the non-inverting amplifier configuration with a gain of 10, a 1 kΩ feedback resistor, and a 111.11 Ω ground resistor is approximately 16.96 nV/√Hz.

And TI’s Tina Spice says

image

Note that the second market is the current meter in the schematic, and that is there to verify the SPICE model correctly models current noise (which it does).

But look at that: With a bit of nudging we have very good agreement between the SPICE model noise (17.12nv/rthz) and GPT4 computed noise (16.96nV/rthz).

OK, so here’s where it gets really impressive:

How would the noise change in the circuit above if we switched to an AD797 opamp?

And ChatGPT responds:

To determine how the noise would change when using an AD797 op-amp instead of the OPA1612 op-amp, we first need to find the noise density of the AD797 op-amp. The AD797 datasheet specifies a typical voltage noise density of 0.9 nV/√Hz.

Since the resistor noise density remains the same at 12.9 nV/√Hz, we can use the root-sum-square (RSS) method again to find the combined noise contribution for the new configuration:

Combined noise density = √(AD797 noise density^2 + Resistor noise density^2)

Combined noise density = √((0.9 nV/√Hz)^2 + (12.9 nV/√Hz)^2)
Combined noise density ≈ √(0.81 nV²/Hz + 166.41 nV²/Hz)
Combined noise density ≈ √(167.22 nV²/Hz)
Combined noise density ≈ 12.93 nV/√Hz

By switching to the AD797 op-amp in the non-inverting amplifier configuration with a gain of 10, a 1 kΩ feedback resistor, and a 111.11 Ω ground resistor, the combined noise contribution is reduced to approximately 12.93 nV/√Hz. This represents a decrease in noise compared to the OPA1612 op-amp, which had a combined noise contribution of approximately 16.96 nV/√Hz.

OK, very helpful. We expecte the number to go down and it did. But let’s get complacent and not scrutinize the math too much. And let’s push some more:

Is there an available opamp that would let the noise density get below 15 nV?

Prepare to be blown away:

My previous response contains an error in the calculation. The noise density for the AD797 op-amp was not multiplied by the noise gain of the circuit, which is 10. Let's correct this and recalculate the combined noise density for the AD797 op-amp.

AD797 output noise density = AD797 input noise density × Noise gain
AD797 output noise density = 0.9 nV/√Hz × 10
AD797 output noise density = 9 nV/√Hz

Now we can recalculate the combined noise density:

Combined noise density = √((9 nV/√Hz)^2 + (12.9 nV/√Hz)^2)
Combined noise density ≈ √(81 nV²/Hz + 166.41 nV²/Hz)
Combined noise density ≈ √(247.41 nV²/Hz)
Combined noise density ≈ 15.73 nV/√Hz

The corrected combined noise density for the AD797 op-amp is approximately 15.73 nV/√Hz, which is closer to the 15 nV target, but not quite below it.

There may be other op-amps with even lower noise characteristics that could achieve a noise density below 15 nV/√Hz when combined with the resistor noise. One example is the LT1028 op-amp, which has an input voltage noise density of around 0.85 nV/√Hz. Keep in mind that it is essential to consider other factors as well, such as the bandwidth, input impedance, input bias current, and power consumption, when selecting an op-amp for a particular application.

Woah! So it decided there was an error in the previous answer! I wonder why the model would continue to contemplate previous answers after it had delivered those answers?

So what is the takeaway here? Well first, ChatGPT 3.5 was pretty bad at this type of interaction. So bad that I thought it would be a long time until something useful could be done with LLMs. But ChatGPT4 has made enormous strides in a very short period of time. And in the hands of an experienced engineer that can guide and check things, it’s extremely useful.

Next, note how ChatGPT4 interacts with you like a coworker that is also skilled in the art. I ask if there’s an opamp that would let the noise density get below 15 nV, and it doesn’t complain about the units not being fully specified as 15nV/rthz.

And in line with the “skilled coworker” comment above, note how good ChatGPT is about significant digits and approximations that don’t impact the outcome, but they do make the verification process very, very easy to read.

Overall, this is very impressive to me. ChatGPT is text-based, which means it doesn’t understand schematics, nor can it create schematics. But can you imagine where things are headed when LLMs understand how to send certain analysis to a SPICE module, and you can interact with the LLM to create and view schematics?

And based on current evolution of things, it could be here sooner than we know.

2 Likes

Very interesting and thanks for sharing. I will have to try that TinaTI marker function next time I use it,

My son told me a friend just asked it to write code for a problem that he had worked on in his ms in computer science and it produced perfectly satisfactory solutions.
A friend who’s a partner at a national law firm said they are experimenting with it creating first drafts of typical documents and I know the major wall street banks are using it in a variety of test environments.
5 years and some form of it will be doing really tough problems. I’m 74 and really excited to see this in my lifetime!

1 Like

I have had contradictory experiences. I asked a simple question: ‘what is the voltage gain in a BJT amplifier configured in common collector?’ The answer, in the first part, was correct stating that the gain is always less than one, but then continued saying that the formula for calculating such gain is -gm*Rc and that the output of such amplifier is located on the collector. Clearly, in continuing the answer, ChatGPT confused the common collector configuration with the common emitter one!

I asked a simple question: ‘what is the voltage gain in a BJT amplifier configured in common collector?’

Hi @Claudio, probably that was with ChatGPT3.5? That was my experience too. Here’s ChatGPT4 on your question:

In a bipolar junction transistor (BJT) amplifier configured as a common collector (also known as an emitter follower), the voltage gain is close to 1. This is because the output is taken from the emitter, which follows the input voltage at the base with a small voltage drop due to the base-emitter junction.

The voltage gain (Av) in a common collector configuration can be expressed as:

Av ≈ 1

The main purpose of a common collector amplifier is not to provide voltage gain, but rather to provide current gain and impedance matching. It has a high input impedance and a low output impedance, making it suitable for use as a buffer or impedance matching stage in an amplifier circuit.

I’m 74 and really excited to see this in my lifetime!

Hi @Moto, yes, this is quite remarkable to watch the evolution play out. Today, the next version of the LLM is created by humans. But once the next version of the LLM is created by the previous version of the LLM it will be a watershed event and the speed of evolution will then be tied to money and time in the data center, not know-how. Seems plausible that could come in 5 or 10 years, but I don’t know.

Did you follow what they did with the AI engine that mastered the game of Go? Essentially similar to your point above, they cloned the engine but made small “genetic” tweaks in each copy. So each had a different style of play. Then then had the copies all play millions of games against each other. Boom. Beat all the humans.
As you said when these LLM’s or some variant of the large language model architecture clones itself and creates mutations of itself to keep from inbreeding, we humans will lose sight of how they even function as in an accelerated version of our lack of understanding of the internal functioning of large neural networks. Not like the good old days of rules based systems.

Hi @Matt. I just asked the question to ChatGPT again and here’s the answer. As you can see, there’s an error on the gain, but also confusion on the units of measurement in the example.


Over 25 years ago, I worked on artificial neural networks. I have both built (very simple) hardware models and also programmed software neural networks that can be trained with various algorithms, including genetic algorithms. At the end of my modest experience, I became convinced that there is not much that is intelligent, as we humans normally understand them: they are fascinating algorithms, but I think it is impossible and impractical to call them truly ‘intelligent’. Of course all this is my personal opinion, probably wrong :slight_smile: