What does HackerNews think of langchain?

⚡ Building applications with LLMs through composability ⚡

Language: Python

Hallucination is not a vice. It may be a virtue. It depends on the context. Let me explain.

Edward de Bono, the person who coined the term lateral thinking, lists random juxtaposition as one of the tools for spurring creativity. [1], [2]

In his Six Thinking Hats [2], he writes about 6 different modes of thinking coded by colored hats.

- Blue hat: Organizing

- White hat: Information, facts, stats

- Green hat: Creative ideas

- Yellow hat: Benefits and positives

- Black hat: Caution, risks, negatives

- Red hat: Emotions

He asks us (a team) to look at a problem (he calls it Focus. For e.g., Focus: AGI in military use) wearing one hat at a time. So, when we all wear White hat, we bring data, citations, previous relevant work etc., We don't expend energy in evaluating this data at the moment (that comes later when we wear a different hat, i.e., the black hat).

His theory is that we can think better with the Six Thinking Hats method.

So, applying this analogy to LLMs, hallucinations of LLMs can be thought of as the LLM wearing a green hat.

A theorem prover or fact checker can be added to act as a black hat. (LLMs themselves are capable of doing this critical review -- for eg., list 5 points for and against fossil fuels).

Extending this analogy further, we have tools like LangChain [3] that are focused on the organizing bit (blue hat), ChatGPT plugins that provide up-to-date information, run computations or use 3rd party services (white hat).

Green and Yellow hats are out-of-the-box supported by LLMs already.

Red hat is a sentimental analyzer (which is a classic machine learning algorithm) that LLMs already subsume.

So, it is just a matter of time before this gets refined and more useful that we don't have to worry about the hallucination coming in the way.

[1]: https://www.amazon.com/Serious-Creativity-Thoughts-Reinventi...

[2]: https://www.amazon.com/Six-Thinking-Hats-Edward-Bono/dp/0316...

[3]: https://github.com/hwchase17/langchain

But the human mental model is purely internal. For that matter, there is strong evidence that LLMs generate mental models internally. [1] Our interface to motor actions is not dissimilar to a token predictor.

> The mental model we build and update is not just based on a linear stream, but many parallel and even contradictory sensory inputs

So just like multimodal language models, for instance GPT-4?

> as experiences in a world of which we are part of.

> The simple fact that we don't just complete streams, but do so with goals, both immediate and long term, and fit our actions into these goals

Unfalsifiable! GPT-4 can talk about its experiences all day long. What's more, GPT-4 can act agentic if prompted correctly. [2] How do you qualify a "real goal"?

[1] https://www.neelnanda.io/mechanistic-interpretability/othell...

[2] https://github.com/hwchase17/langchain

LLMs certainly can “will” and “do things” when provided with the right interface like LangChain: https://github.com/hwchase17/langchain

See also the ARC paper where the model was capable of recruiting and convincing a TaskRabbit worker to solve captchas.

I think many people make the mistake to see raw LLMs as some sort of singular entity when in fact, they’re more like a simulation of a text based “world” (with multimodal models adding images and other data). The LLM itself isn’t an agent and doesn’t “will” anything, but it can simulate entities that definitely behave as if they do. Fine-tuning and RLHF can somewhat force it into a consistent role, but it’s not perfect as evidenced by the multitude of ChatGPT and Bing jailbreaks.

Prompt engineering is more prompt chaining which is actively being researched so it is a thing. https://github.com/hwchase17/langchain
Maybe this would make more sense if integrated into something like LangChain (https://github.com/hwchase17/langchain).
This is the "Composability" concept being pushed by the people behind LangChain.

https://github.com/hwchase17/langchain

Yes, check out LangChain [0]. It enables you to wire together LLMs with other knowledge sources or even other LLMs. For example, you can use it to hook GPT-3 up to WolframAlpha. I’m sure you could pretty easily add a way for it to communicate with a human expert, too.

[0]: https://github.com/hwchase17/langchain

I am curious if you tried something like langchain[1] it would solve the problem of not remembering previous conversations. In one of the examples people have used an entire company notion database on top of GPT-3 to answer questions specifically from that database.

PS: not tried myself.

[1] https://github.com/hwchase17/langchain

Based on my reading of the docs (I haven't looked at the code), it appears that it uses the existing langchain[1] (which I have used and is excellent) library for constructing longer prompts through a technique known as prompt chaining. So for example, summarizing long documents would involve a map/reduce style effort where you get the LLM to summarize chunks of the document (with some degree of overlap between chunks) and then getting the model to summarize the summaries.

For answering "queries", it appears like it iterates over the documents in the store, i.e., NOT using it like an index, and feeding each document as part of the context into the LLM.

[1] https://github.com/hwchase17/langchain

Libraries such as https://github.com/hwchase17/langchain allow for easy programmatic pipelines of GPT "programs". So you could imagine taking a few hundred of these programs written by humans for various tasks, as are sure to come into existence in the next year or two, then adding those programs to the training data and training a new GPT that knows how to write programs that call itself.