Lurker News
Hi HN,

Today we’re launching GPT-4 answers on Phind.com, a developer-focused search engine that uses generative AI to browse the web and answer technical questions, complete with code examples and detailed explanations. Unlike vanilla GPT-4, Phind feeds in relevant websites and technical documentation, reducing the model’s hallucination and keeping it up-to-date. To use it, simply enable the “Expert” toggle before doing a search.
GPT-4 is making a night-and-day difference in terms of answer quality. For a question like “How can I RLHF a LLaMa model”, Phind in Expert mode delivers a step-by-step guide complete with citations (https://phind.com/search?cache=0fecf96b-0ac9-4b65-893d-8ea57...) while Phind in default mode meanders a bit and answers the question very generally (https://phind.com/search?cache=dd1fe16f-b101-4cc8-8089-ac56d...).
GPT-4 is significantly more concise and “systematic” in its answers than our default model. It generates step-by-step instructions over 90% of the time, while our default model does not.
We’re particularly focused on ML developers, as Phind can answer questions about many recent ML libraries, papers, and technologies that ChatGPT simply cannot. Even with ChatGPT’s alpha browsing mode, Phind answers technical questions faster and in more detail.
For example, Phind running on “Expert” GPT-4 mode can concisely and correctly tell you how to run an Alpaca model using llama.cpp: (https://phind.com/search?cache=0132c27e-c876-4f87-a0e1-cc48f...). In contrast, ChatGPT-4 hallucinates and writes a make function for a fictional llama.cpp.
We still have a long way to go and would love to hear your feedback.

Comments (414) 162 threads

Earlier comments
Lerc1 reply#
It couldn't find the answer to my question but the response contained enough supplementary information to show that I wasn't going to find it easily by googling either. That in-itself is a massive timesaver.

Q: What is the token window size of the Alpaca model?
It understood the question and knew what Alpaca was. So it passes the recent information test.

dcow#
This is nuts: https://www.phind.com/search?cache=30e24cdb-ff4b-4f4d-a748-4.... It understands how to convert between two similar but ultimately incompatible types. It's mostly spot on. The status code conversion to u16 is unnecessary but it does work. There's a more concise way to get a HeaderName from a String: `HeaderName::try_from(string)`, and ultimately the code is more simple and straightforward when using the ResponseBuilder type, but the code works using only the types involved in the query.

What's crazy about this is that it's not a trivial problem. The engine correctly identifies that it's converting http responses and that for the conversion to be meaningful you need to copy the status code, headers, and body. It also correctly identifies that adding multiple headers of the same value is semantically the same as a header with multiple values. I'm pretty sure this example does not appear anywhere in the source material (these are lesser-known crates, not the popular http ones). This is really neat!

koito171 reply#
On Expert mode, I decided to ask it a simple question but in a niche language, to see how well it can scour the internet.

  How do I emit JS object literals in a ClojureScript macro?
Instead I was given an answer to a completely unrelated question and it cited some "Learn ClojureScript" website. In short, it provided the following example.

  (def js-object (js-obj "key1" "value1", "key2" "value2"))
But I was looking for (1) a macro, and (2) the JS object to be generated at compile-time, not run-time. Also, the stray comma is very weird, but thankfully commas are ignored. Concretely, I was expecting something like this

  (defmacro mac []
    (let [js-vector (JSValue. [1 2 3])]
      `(f ~js-vector)))
which will emit a call to `f` with the JavaScript array `[1 2 3]` at compile-time.

I know what the response will be to this comment: either "Clojure is a niche language, who cares?" or "get better at prompting." But otherwise, this is on-par with ChatGPT Plus, even when presented with the possibility to crawl Clojurians Slack archives, Stack Overflow, a bunch of blog posts, etc.

koito171 reply#
Your prompt definitely takes GPT-4 on the right path. Unfortunately, CLJS is still too niche (and/or the answer is buried too deeply in search results) that its suggested macro does not work.

Here is the suggested code.

  (defmacro create-js-object
    [k1 v1 k2 v2]
    `#js {~k1 ~v1 ~k2 ~v2})
It wants to unquote, presumably because macros are processed by the compiler, which exists in Clojure world, not JavaScript world, so the #js literal does not exist there, but unquoting will let us emit code that CLJS is happy with. Unfortunately, the tag doesn't actually do anything!

Here is how I'd revise the example code.

  (defmacro mac [k1 v1 k2 v2]
    (cljs.tagged-literals/->JSValue {k1 v1 k2 v2}))
Now let's compare results in a REPL...

  cljs.user> (type (create-js-object "foo" 1 "bar" 2))
  cljs.core/PersistentArrayMap
  cljs.user> (type (mac "foo" 1 "bar" 2))
  #object[Object]
We get double confirmation by comparing the compiled output of functions making use of the macro.

  (str (fn [] (create-js-object "foo" 1 "bar" 2)))
  ;; => "function (){\nreturn new cljs.core.PersistentArrayMap(null, 2, [\"foo\",(1),\"bar\",(2)], null);\n}"

  (str (fn [] (mac "foo" 1 "bar" 2)))
  ;; => "function (){\nreturn ({\"foo\": (1), \"bar\": (2)});\n}"
With all of that said, this is a VERY niche question, but it does not involve any macro magic whatsoever, and I'm sure most Clojure novices don't even know doing this is possible. It essentially requires two bits of knowledge: (1) macros run at compile-time, and (2) JSValue is an object container for native JS arrays and maps.

It's still impressive that GPT-4 was able to make a guess that looks right until you decide to experiment at the REPL.

agileAlligator#
Admittedly I am not very well versed in Clojure, I can understand only a little of what you are saying. But it seems to me that throwing more training data at the model should fix the issue.
weird-eye-issue1 reply#
I always test with a query about Django "not equal" filtering and it always hallucinates, same thing here (the "ne" lookup doesn't exist and has never existed):

To do a “not equal” comparison in a Django queryset filter, you can use the __ne lookup type. For example, if we have a model called MyModel with a field called field, we could filter out all instances where the field field is not equal to ‘value’ with the following code

rushingcreek2 replies#
Did you try Expert mode?
weird-eye-issue#
Same problem

For some reason this seems to be trained deep into the GPT model. Even when you tell it in the prompt it doesn't exist sometimes it will contradict itself. That's why it can be an interesting test case

weird-eye-issue#
Btw it does some weird escaping for JavaScript string literals, also the regex was wrong:

  const htmlString = '';
 const regex = /]*?src\s*=\s*['"]([^'"]+?)['"][^>]*?(?:alt\s*=\s*['"]([^'"]*?)['"])?[^>]*?>/gi;

  let match;
  while ((match = regex.exec(htmlString)) !== null) {
    const src = match[1];
    const alt = match[2] || null;
    console.log(`src: \${src}, alt: \${alt}`);
  }

Load more comments