Hacker News new | past | comments | ask | show | jobs | submit login
Bard coding update with Colab exporting (blog.google)
169 points by alphabetting on April 21, 2023 | hide | past | favorite | 86 comments



Tried it and love it. This is still not at par with ChatGPT 3.5. I use ChatGPT all the time, and will increase use of Bard from now.

Good that Bard is aware of latest version of software (eg. NextJS). Helps when APIs of a software evolves quickly.

I use a lot of Google products and really hope that they manage to nail it as at least #2 player in the space. As a company, they have not proven to come back and take the lead from behind.


GPT-4 has a lot of problems with recent versions of APIs. Working with Cloudflare workers was initially painful because of the dated code it would generate. The code would be valid, it just didn't work with the initial scaffolding wrangler generated.

I've found copying and pasting chunks of the API context into the prompt solves 99% of it. I'm now able to get it to generate modern workers just fine. You can copy an example method signature, some docs, etc. and it picks up on that fairly reliably. I've even just copy-and-pasted an entire worker implementation (100+ LoC) at the beginning of a prompt and that worked.


Would you mind sharing 1 example how you do it? Or any web link?

I have spent a lot of time reading through prompt engineering, but coding examples to adapt to latest versions are rare to find.


I don’t bother much with prompt engineering. I just treat ChatGPT as a pair programmer who can’t see my editor. I tell it where files are, what I’m using, copy and paste relevant code in, and it just works.

The big “breakthrough” for me was unlearning all of my search engine habits of thinking I need to be precise and talk to it like a machine. I use compliments like “that’s great” and it seems to reinforce good answers well enough.

Just treat it like a human on the other side of the screen and adjust as necessary.

Also pay the $20 - GPT-3.5 is not good, GPT-4 is junior engineer good. Most of my time is now spent describing problems to it and code reviewing what it does.

Edit: I do use prompt engineering when I’m building AI enabled products to help keep things on the rails. But for my personal use of ChatGPT I just let ‘er rip.


But with that type of usage don’t you hit the message cap on gpt4?

Have you tried and compared phind.com?


Remember you are not an AI. You are a human, so it takes you significantly more time to read a response and produce another query. 25 messages every 3 hours is a lot when you're doing what parent described. When I'm programming, I also do other things too. 3 hours goes by fast.


They gave an example of this in the launch live stream, about 12 minutes in: https://www.youtube.com/live/outcGtbnMuQ


Have you tried phind.com ? It scrapes sites so it can get additional context


Try bing then, gpt-4 but up to date.


I've found that the bugs that GPT-4 and GPT-3.5 make are actually... somehow more nefarious because it understands enough to make very complex bugs.

The complexity of the bugs you get are usually 10x as complex as the code's main logic you wrote. So you need to write very simple code.

Unfortunately, these GPT models are very complex. The bugs they produce will take an order of magnitude better model to fix.


Nothing it produces is that many lines. How is that not debuggable? If you can’t, you’re having it do things you don’t even understand and blindly implementing and seems like a user issue. Additionally, take the code and ask it to write tests and validation scripts with your expectations.


> If you can't, you're having it do things you don't even understand and blindly implementing

Today's programming is not SICP in scheme, it is more plumbing between very large bodies of code. Using GPT is a great way to short cut needing to learn lots of details about code bases you only need for one specific feature. Recently though, by integrating two pieces of code I do know a lot about, I lost a lot of confidence in GPT coding.

For example, I asked it to implement a small script in emacs that would loop through org text files in emacs, and run some commands based on keybindings. That's it.

It messed up the usage of recursive-edit (which is a complicated feature itself), it produced many bugs in how Org utilizes indirect buffers, it sends windows around instead of buffers in the variables, and it wrote lots of contradictory code.

I understand how all these features work, and I went through and started fixing all the bugs. I would tell it about each bug, but it was producing so many subtle bugs with org-mode, inventing functions that didn't exist and it couldn't define... I gave up and just re-implemented it myself.

So no, I do not understand 100% of all code I refer to when I write code, that's why APIs actually exist.


Good that Bard is aware of latest version of software (eg. NextJS). Helps when APIs of a software evolves quickly.

This alone will help Google destroy the competition.


It's pretty cool that it will cite open source if it quotes code from an open source project, unlike ChatGPT and Copilot.


But copilot actually outputs code into your project, do you really want citations there? I prefer to just enable the setting for it to not reproduce code verbatim from other projects.


Isn't it normal to copy code with citations into your project? It also helps document what's going on.


Sounds like a codebase filled with the ghosts of programmer past. Just put the code in and own maintaining it. Anyone can do a git blame and find the history of its implementation, and also see the original PR which should have described what it was doing, and provided far more context to the reviewers than a code comment.

And if an architecture decision is so significant, retain a repository of architecture decision records.


I think you misunderstood what I mean. I'm talking about:

    // Credit Foo Project per MIT license
    // See <https://github.com./foo/project/path/to/file

    fn some_foo_fn() {

This has nothing to do with git history.


To comply with GPL, it would have to automatically re-license your project as GPL too, right?


If you use GPL code, you may have to relicense your project.

Bard can share with you any code that it is licensed to distribute (which includes GPL).


At least Google seems to respect open source unlike OpenAI: "If Bard quotes at length from an existing open source project, it will cite the source."


That's also likely a better way to exploit open source.

Microsoft and OpenAI got a lot right but also a lot wrong, I think. This could have held Copilot back, not making proper composite projects.


So... does that imply that it simply fails to cite where it's quoting from closed source projects?


Just did a comparison of Bard vs GPT-4 with a coding question I came up with:

> I have a 3 dimensional black bitmap (voxel map) with a white straight line drawn in it. The 3d bitmap is saved as a bunch of tiff files by layer eg. layer_347.tif Write me python code to load this data and return the x,y,z location of each end of the line. The bitmap is too big to load all of it into RAM at once. Use a binary search to avoid loading unnecessary files.

Bard came up with a solution which was close but didn't follow the instructions (it just loaded all the data). It also assumed layer_9 sorted before layer_10.

GPT-4 came up with a solution which followed the instructions, but had a buggy binary search implementation, and a suboptimal O(n).

The GPT-4 solution was closer to what I was after, but there wasn't much in it. Neither implementation handled edge cases like missing files or had tests or anything.


> Neither implementation handled edge cases like missing files or had tests or anything.

Did you tell them to do those things after they came up with the solution?


I'm sorry for the confusion. Here's a version that handles edge cases:

```

// Basically still not handling edge cases

```


It's really fast! That is very important. Also it provides 3 variation drafts. I see this as a winner


The Copilot VSCode extension does 10 drafts


Both can be made to give more drafts by just asking the same question again...

I don't see more drafts as a real differentiator.


UX is a feature


> I don't see more drafts as a real differentiator.

Well the person I replied to did..


it spits out 3 drafts in 1 go. without the need to wait. It is simply way faster than GPT4


I wonder how much of that has to do with TPUv4 vs the hardware used for GPT4?

Google has invested in custom AI hardware for some time now and does not run their workloads on nvidia cards


Neural networks are really parallelizable. If I scale up my AI service to handle double the number of users by buying double the number of GPU's, it is theoretically possible to also serve each user in half the time.

To do so, you need to split the matrix multiplies across the new machines. You also need more inter-machine network bandwidth, but with GPT-3 that works out to 48 kilobytes per token predicted collected from every processing node and given to every processing node. Even if Bard is 100x as big, that is still very doable within datacenter scale networking.

However, OpenAI doesn't seem to have done this - I suspect an individual request is simply routed to one of n machine clusters. As they scale up, they are just increasing n, which doesn't give any latency benefit for individual requests.


Yup, the TPUv4 pod is highly optimized

They are claiming to be the first to achieve >50% saturation during training. Pretty sure I recall Midjourney is using TPUv4 pods too

https://cloud.google.com/blog/products/ai-machine-learning/g...

https://cloud.google.com/tpu/docs/system-architecture-tpu-vm


I just gave Bard a try. It's still nowhere near as good at coding as chatGPT (and GPT4 specifically). I asked it to write a Python program to solve the Traveling Salesman Problem using ACO. The code GPT4 gave me for this prompt runs out of the box which is pretty impressive. The Bard code, on the other hand, has errors like forgetting to pass an argument to a function, or calling a method on a class that hasn't been defined on that class. When I point out the error to Bard it presents code that it says solves the problem, but often doesn't. In some cases when it fixes a problem in one area it reintroduces a previously fixed bug elsewhere.

Also, chatGPT always goes the extra mile and includes instructions on compiling/running the code it provides (including sample data). Bard does not.

Bard still has a ways to go to catch up.


I've been using it extensively and never once found ChatGPT to produce working code when the ask is just above basic. It might have to do with subject matter. It usually is close enough but my experience has been what you've found with Bard - missing arguments, phantom methods, etc.

Haven't bothered with Bard at all.


did you try with GPT4? I was able to run one GPT4 query/day for free on poe.com

Yeah, given the random nature of these LLMs it's possible that I won the lottery in that particular case.


In my experience, GPT-4 does get lots of textbook/common problems right in common languages on first try. But when I tried to solve a just mildly complex problem (finding a ring of cells in a Godot GridMap using GDScript), it produced nonsense: Solved the problem wrong, called functions that don't exist and so on. It did correct some of the mistakes after I pointed them out, but I couldn't get something working without manual editing. Then I asked it to optimise the solution and got nonsense again. For simple data wrangling in Python it worked a lot better.

I have a suspicion there might be some... showmanship at work where all kinds of test problems and common tasks are made sure to work well.

Also it generates code slower than I would type (if I know what to write), which makes me mad for some reason.


I think it has a lot to do with how common code examples in the language are. I bet if you tried with languages detailed here you will get a lot better results than more obscure languages (like GDscript)

https://octoverse.github.com/2022/top-programming-languages


"But did you try with GPT4?" is becoming a bit of a refrain for me when talking about this with people. I can get GPT-4 to produce working code from agile user stories surrounded by a well-crafted prompt.


> I just gave Bard a try. It's still nowhere near as good at coding as chatGPT (and GPT4 specifically)

Because its a much smaller model IMO. Its like comparing a car with 2.0 engine, with a car with 3.0 engine. Also ChatGPT made a lot of errors in code just a few months ago. Google seems to be catching up.


Worth noting that Google i/o is next month and many are expecting announcements related to Bard. There is that rumor floating around that they are training a very large (30T) model


The only source I can find is a reddit post from April fool's day, do you have a better one by chance?

There's almost no way they make a 30T model that's useful at least? That's over 60TB of memory at 16bit, 15TB at 4 bit. That's 15TB that have to go through either VRAM or TPU Memory (TPUv4 is 32GB I think?). Yes you could distribute it and chunk it, but that would be insanely slow/expensive to run for anything more then a research demo.

GPT-4 is most likely 1~2T from what I've heard, and they've been struggling to run that profitably/quickly judging by the crazy pricing and 25messages/3hours if you pay for premium chatgpt.

EDIT: The only way this is possible is if they've pulled off some crazy optimization, which is definitely possible, but a lot of the research from them such as their own Chinchilla scaling suggest smaller models that are more fully trained are better.

According to their chinchilla paper they would need over 330TB of training data for that, and an absurd amount of training time.



I've found that GPT4 does very well for problems that have examples on the web, but I have yet to make it display a 3d cube using opengl (any version) in linux using c++ or python.

So it depends heavily on the task and how much it has stored from the training.

Now if you ask them to do a teapot, it sometimes do it since there are so many examples of that, even if you often have to tinker a bit to get it to compile and run, at least it is a teapot and not some weird random geometrical object.

I have yet to try it with bard, will test when I get home to a proper computer.


It actually got much faster and much better at code. Impressive!


I am using it right now to debug some of my Go and SQL code and it's works great.


That is a very good idea. I expect Google to keep coming out new features and my expectation is also that they will follow OpenAI's lead and prioritize features for developers.

I think there will be a settling in period over the next year where providers will take the time fix problems. I have been playing around with AutoGPT on my laptop and that is a very different experience because it exhaustively searches for useful material on the web, saves it to local text files, then works with these local files to finish up preparing text for the user. I don't expect Bard and Bing+ChatGPT to be so explorative and iterative, but they might be when inference technology and specialized hardware architectures get better.


ChatGPT directly into Jupyter Notebook with Notebookgpt by Noteable, notebookgpt.com as a plugin: http://notebookgpt.com/


Just gave Bard a try and was able to browse the google/google internal repository as well as some internal YouTube repos. I have since reached out and got the flaw fixed but this proves that google is reacting and not innovating. Also data security is at risk considering what you train on (see the earlier post on copilot emitting GPL code).

Twitter post coming soon, I will share with HN when it’s live


Doesn't work for this simple prompt -- maybe it's not fully rolled out yet?

> Can you write a <HTML> file that POSTs a form with firstName, lastName to some other URL?

> I'm a language model and don't have the capacity to help with that.


Reworded the prompt and it seemed to work, I entered yours and it didn't work but the below did: how would you send a post html request with firstName, lastName as inputs to a url

To send a POST HTML request with firstName and lastName as inputs to a URL, you can use the following steps:

1. Create an HTML form with two input fields, one for firstName and one for lastName. 2. Set the method of the form to "POST". 3. Set the action of the form to the URL you want to send the request to. 4. Submit the form.

The following is an example of an HTML form that you can use to send a POST request with firstName and lastName as inputs:

```html <form method="POST" action="https://example.com/api/v1/users"> <input type="text" name="firstName" /> <input type="text" name="lastName" /> <input type="submit" value="Submit" /> </form> ```

When you submit this form, the server will receive the firstName and lastName values as POST request parameters. You can then use these values to perform whatever actions you need to do on the server.


It's probably just confused that you're asking it to "write a file" and not tell you the contents of what the file should be


I'm experimenting with using Bard to generate Prolog code. I have this idea that if I can synthesize Prolog and a LLM, I can do some very clever planning work.


Could someone ask Bard how to bypass its region-lock?


I used a VPN.


Something I am just now noticing is that Barb is able to view the contents of a pdf that I provided a link to.

Could be making it up but need to test further...


I've asked bard some coding questions around winapi that I've asked ChatGPT the last few weeks. So far not only does it give incorrect answers, it seems super confident in telling me the wrong thing.

E.g, does SendInput send to a background window? It told me not only does it but it is the only way to do it and then gave me examples where it got a handle to a window but then didn't even use it.

A few months ago this would be super impressive but after using ChatGPT there is no reason that I've found why I'd want to use an inferior AI.


FWIW your example seems to work for me.

https://i.imgur.com/1sWc2WR.png


https://imgur.com/a/qmjVPJ5

Same question with a different answer.

This is interesting. This version of the question is better than the original answer I got but still not as good as your answer.


Show me the API.


Not available in your country. Well poop.


It's not available in my country yet.


Is there any way of trying Bard from an "unsupported" country without using a VPN or something like that?


[flagged]


I think this is fine, the problem is that they aren't calling it a beta/preview which would temper people's expectations.


It's labelled as "Experiment" in the titlebar, it says that it has limitations and that feedback will help improve, and it says that it may display inaccurate information. I think that covers it all pretty well.


nice, missed that on the bard site.


> Bard is still an early experiment, and may sometimes provide inaccurate, misleading or false information while presenting it confidently. When it comes to coding, Bard may give you working code that doesn’t produce the expected output, or provide you with code that is not optimal or incomplete. Always double-check Bard’s responses and carefully test and review code for errors, bugs and vulnerabilities before relying on it.


Also this nonsense geoblock that still exists. I've already joined waitlist via Tor and then I was granted access. Yet when I visit bard.google.com without Tor I'm still informed that bard isn't supported in my country.


I have full access to Bing Chat in Canada, but not to bard. Disappointing.


I like not being able to sign up because I'm under 18. Preferably in hexadecimal. https://www.reddit.com/r/ChatGPT/comments/11ydh2y/im_trying_...


I don’t really see why anyone would use this unless they’ve been in a coma for the past few months and never heard of ChatGPT.


Bard seems to use current data whereas Chatgpt stops at 2021. Bard is also significantly faster at returning responses.


Being trained on more up to date data and being faster are irrelevant when returning responses that aren’t as useful. Google has catching up to do.


I try to glance at both, but because I do that I know that ChatGPT has severe availability problems, whereas Bard so far has not failed for me. And Bard is much faster even though superficially it can seem slower because ChatGPT blurts out the first word more quickly.


It's good to have more competition in the space. An AI space race between Google and OpenAI could be really interesting.


Competitions have winners and losers.


Well right now it's just another website you have to go to with intent to use it like ChatGPT, but if Google built it into search it would get a ton of organic use from people doing things like googling error messages.

I'm not sure if this is what is planned of course, but that would be far more widely used than an otherwise siloed website you have to visit specifically.

Also remember that most people have at least never used ChatGPT, and most probably still haven't heard of it. We live in a tech bubble – none of my family had heard of it a few weeks ago. They all use Google search on a daily basis.


Think of ChatGPT as Breaking Bad and Bard as Better Call Saul.


Why does competition exist ever? I think there are trade offs for everyone to consider before they blindly assume one will be the better option for every use case forever


I wouldn't touch anything that Google(The eyes and ears of advertisers) offers, with a 10 foot pole. Specially if is work related. Chat GPT software development answers get better with warm up questions. I don't shoot questions point blank but do a 3-4 related questions first.


You do realize that ChatGPT is owned partially by another ad gint Microsoft who is also hell bent on showing ads in start menu


Yeah, I wouldn't touch MS Windows or Bing either. Is Duckduck Go and Linux for me. If ChatGPT starts charging for basic service, I might pay.


But but MS owns 49% of OpenAI... My head is exploding here


And Github is owned by MS too but MS did not invented it and Github remains an okay service. ChatGPT was not invented by MS and it could be that it remains a good service. Money matters aside.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: