forked from Archives/langchain
[searx-search] update notebook examples
This commit is contained in:
parent
3a9fd229d9
commit
8edf20b570
@ -1,198 +1,617 @@
|
|||||||
{
|
{
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"jukit_cell_id": "DUXgyWySl5"
|
"jukit_cell_id": "DUXgyWySl5"
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"# SearxNG Search API\n",
|
"# SearxNG Search API\n",
|
||||||
"\n",
|
"\n",
|
||||||
"This notebook goes over how to use a self hosted SearxNG search API to search the web."
|
"This notebook goes over how to use a self hosted SearxNG search API to search the web.\n",
|
||||||
]
|
"\n",
|
||||||
},
|
"You can [check this link](https://docs.searxng.org/dev/search_api.html) for more informations about Searx API parameters."
|
||||||
{
|
]
|
||||||
"cell_type": "code",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "OIHXztO2UT"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"from langchain.utilities import SearxSearchWrapper"
|
|
||||||
],
|
|
||||||
"outputs": [],
|
|
||||||
"execution_count": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "4SzT9eDMjt"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"search = SearxSearchWrapper(searx_host=\"http://127.0.0.1:8888\")"
|
|
||||||
],
|
|
||||||
"outputs": [],
|
|
||||||
"execution_count": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "gGM9PVQX6m"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"search.run(\"Who is the current president of the united states of america?\")"
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"text/plain": [
|
|
||||||
"'In all, 45 individuals have served 46 presidencies spanning 58 full four-year terms. Joe Biden is the 46th and current president of the United States, having assumed office on January 20, 2021.'"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"execution_count": 1,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"execution_count": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "jCSkIlQDUK"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"For some engines, if a direct `answer` is available the warpper will print the answer instead of the full search results. You can use the `results` method of the wrapper if you want to obtain all the results."
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "OHyurqUPbS"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"# Custom Parameters\n",
|
|
||||||
"\n",
|
|
||||||
"SearxNG supports up to [139 search engines](https://docs.searxng.org/admin/engines/configured_engines.html#configured-engines). You can also customize the Searx wrapper with arbitrary named parameters that will be passed to the Searx search API . In the below example we will making a more interesting use of custom search parameters from searx search api."
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "n1B2AyLKi4"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"In this example we will be using the `engines` parameters to query wikipedia"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "UTEdJ03LqA"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"search = SearxSearchWrapper(searx_host=\"http://127.0.0.1:8888\", k=5) # k is for max number of items"
|
|
||||||
],
|
|
||||||
"outputs": [],
|
|
||||||
"execution_count": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "3FyQ6yHI8K"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"search.run(\"large language model \", engines='wiki')"
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"text/plain": [
|
|
||||||
"'Large language models (LLMs) represent a major advancement in AI, with the promise of transforming domains through learned knowledge. LLM sizes have been increasing 10X every year for the last few years, and as these models grow in complexity and size, so do their capabilities.\\n\\nGPT-3 can translate language, write essays, generate computer code, and more \u2014 all with limited to no supervision. In July 2020, OpenAI unveiled GPT-3, a language model that was easily the largest known at the time. Put simply, GPT-3 is trained to predict the next word in a sentence, much like how a text message autocomplete feature works.\\n\\nAll of today\u2019s well-known language models\u2014e.g., GPT-3 from OpenAI, PaLM or LaMDA from Google, Galactica or OPT from Meta, Megatron-Turing from Nvidia/Microsoft, Jurassic-1 from AI21 Labs\u2014are...\\n\\nLarge language models are computer programs that open new possibilities of text understanding and generation in software systems. Consider this: ...\\n\\nLarge language models (LLMs) such as GPT-3are increasingly being used to generate text. These tools should be used with care, since they can generate content that is biased, non-verifiable, constitutes original research, or violates copyrights.'"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"execution_count": 2,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"execution_count": 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "d0x164ssV1"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"## Obtaining results with metadata"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "pF6rs8XcDH"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"In this example we will be looking for scientific paper using the `categories` parameter and limiting the results to a `time_range` (not all engines support the time range option).\n",
|
|
||||||
"\n",
|
|
||||||
"We also would like to obtain the results in a structured way including metadata. For this we will be using the `results` method of the wrapper."
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "BFgpPH0sxF"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"search = SearxSearchWrapper(searx_host=\"http://127.0.0.1:8888\")"
|
|
||||||
],
|
|
||||||
"outputs": [],
|
|
||||||
"execution_count": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"metadata": {
|
|
||||||
"jukit_cell_id": "r7qUtvKNOh"
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"search.results(\"Large Language Model prompt\", num_results=5, categories='science', time_range='year')"
|
|
||||||
],
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"text/plain": [
|
|
||||||
"[{'snippet': '\u2026 on natural language instructions, large language models (\u2026 the prompt used to steer the model, and most effective prompts \u2026 to prompt engineering, we propose Automatic Prompt \u2026',\n",
|
|
||||||
" 'title': 'Large language models are human-level prompt engineers',\n",
|
|
||||||
" 'link': 'https://arxiv.org/abs/2211.01910'},\n",
|
|
||||||
" {'snippet': '\u2026 Large language models (LLMs) have introduced new possibilities for prototyping with AI [18]. Pre-trained on a large amount of text data, models \u2026 language instructions called prompts. \u2026',\n",
|
|
||||||
" 'title': 'Promptchainer: Chaining large language model prompts through visual programming',\n",
|
|
||||||
" 'link': 'https://dl.acm.org/doi/abs/10.1145/3491101.3519729'},\n",
|
|
||||||
" {'snippet': '\u2026 can introspect the large prompt model. We derive the view \u03d50(X) and the model h0 from T01. However, instead of fully fine-tuning T0 during co-training, we focus on soft prompt tuning, \u2026',\n",
|
|
||||||
" 'title': 'Co-training improves prompt-based learning for large language models',\n",
|
|
||||||
" 'link': 'https://proceedings.mlr.press/v162/lang22a.html'},\n",
|
|
||||||
" {'snippet': '\u2026 With the success of large language models (LLMs) of code and their use as \u2026 prompt design process become important. In this work, we propose a framework called Repo-Level Prompt \u2026',\n",
|
|
||||||
" 'title': 'Repository-level prompt generation for large language models of code',\n",
|
|
||||||
" 'link': 'https://arxiv.org/abs/2206.12839'},\n",
|
|
||||||
" {'snippet': '\u2026 Figure 2 | The benefits of different components of a prompt for the largest language model (Gopher), as estimated from hierarchical logistic regression. Each point estimates the unique \u2026',\n",
|
|
||||||
" 'title': 'Can language models learn from explanations in context?',\n",
|
|
||||||
" 'link': 'https://arxiv.org/abs/2204.02329'}]"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"execution_count": 3,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"execution_count": 3
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"anaconda-cloud": {},
|
|
||||||
"kernelspec": {
|
|
||||||
"display_name": "python",
|
|
||||||
"language": "python",
|
|
||||||
"name": "python3"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
{
|
||||||
"nbformat_minor": 4
|
"cell_type": "code",
|
||||||
}
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "OIHXztO2UT"
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import pprint\n",
|
||||||
|
"from langchain.utilities import SearxSearchWrapper"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "4SzT9eDMjt"
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"search = SearxSearchWrapper(searx_host=\"http://127.0.0.1:8888\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "jCSkIlQDUK"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"For some engines, if a direct `answer` is available the warpper will print the answer instead of the full list of search results. You can use the `results` method of the wrapper if you want to obtain all the results."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "gGM9PVQX6m"
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"'Paris is the capital of France, the largest country of Europe with 550 000 km2 (65 millions inhabitants). Paris has 2.234 million inhabitants end 2011. She is the core of Ile de France region (12 million people).'"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 1,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"search.run(\"What is the capital of France\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "OHyurqUPbS"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"# Custom Parameters\n",
|
||||||
|
"\n",
|
||||||
|
"SearxNG supports up to [139 search engines](https://docs.searxng.org/admin/engines/configured_engines.html#configured-engines). You can also customize the Searx wrapper with arbitrary named parameters that will be passed to the Searx search API . In the below example we will making a more interesting use of custom search parameters from searx search api."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "n1B2AyLKi4"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"In this example we will be using the `engines` parameters to query wikipedia"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "UTEdJ03LqA"
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"search = SearxSearchWrapper(searx_host=\"http://127.0.0.1:8888\", k=5) # k is for max number of items"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 2,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "3FyQ6yHI8K"
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"'Large language models (LLMs) represent a major advancement in AI, with the promise of transforming domains through learned knowledge. LLM sizes have been increasing 10X every year for the last few years, and as these models grow in complexity and size, so do their capabilities.\\n\\nGPT-3 can translate language, write essays, generate computer code, and more — all with limited to no supervision. In July 2020, OpenAI unveiled GPT-3, a language model that was easily the largest known at the time. Put simply, GPT-3 is trained to predict the next word in a sentence, much like how a text message autocomplete feature works.\\n\\nA large language model, or LLM, is a deep learning algorithm that can recognize, summarize, translate, predict and generate text and other content based on knowledge gained from massive datasets. Large language models are among the most successful applications of transformer models.\\n\\nAll of today’s well-known language models—e.g., GPT-3 from OpenAI, PaLM or LaMDA from Google, Galactica or OPT from Meta, Megatron-Turing from Nvidia/Microsoft, Jurassic-1 from AI21 Labs—are...\\n\\nLarge language models (LLMs) such as GPT-3are increasingly being used to generate text. These tools should be used with care, since they can generate content that is biased, non-verifiable, constitutes original research, or violates copyrights.'"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 2,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"search.run(\"large language model \", engines=['wiki'])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "SYz8nFkt81"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"Passing other Searx parameters for searx like `language`"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "32rDh0Mvbx"
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"'Aprendizaje profundo (en inglés, deep learning) es un conjunto de algoritmos de aprendizaje automático (en inglés, machine learning) que intenta modelar abstracciones de alto nivel en datos usando arquitecturas computacionales que admiten transformaciones no lineales múltiples e iterativas de datos expresados en forma matricial o tensorial. 1'"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 3,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"search = SearxSearchWrapper(searx_host=\"http://127.0.0.1:8888\", k=1)\n",
|
||||||
|
"search.run(\"deep learning\", language='es', engines=['wiki'])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "d0x164ssV1"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"# Obtaining results with metadata"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "pF6rs8XcDH"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"In this example we will be looking for scientific paper using the `categories` parameter and limiting the results to a `time_range` (not all engines support the time range option).\n",
|
||||||
|
"\n",
|
||||||
|
"We also would like to obtain the results in a structured way including metadata. For this we will be using the `results` method of the wrapper."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "BFgpPH0sxF"
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"search = SearxSearchWrapper(searx_host=\"http://127.0.0.1:8888\")"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 4,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "r7qUtvKNOh"
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[{'snippet': '… on natural language instructions, large language models (… the '\n",
|
||||||
|
" 'prompt used to steer the model, and most effective prompts … to '\n",
|
||||||
|
" 'prompt engineering, we propose Automatic Prompt …',\n",
|
||||||
|
" 'title': 'Large language models are human-level prompt engineers',\n",
|
||||||
|
" 'link': 'https://arxiv.org/abs/2211.01910',\n",
|
||||||
|
" 'engines': ['google scholar'],\n",
|
||||||
|
" 'category': 'science'},\n",
|
||||||
|
" {'snippet': '… Large language models (LLMs) have introduced new possibilities '\n",
|
||||||
|
" 'for prototyping with AI [18]. Pre-trained on a large amount of '\n",
|
||||||
|
" 'text data, models … language instructions called prompts. …',\n",
|
||||||
|
" 'title': 'Promptchainer: Chaining large language model prompts through '\n",
|
||||||
|
" 'visual programming',\n",
|
||||||
|
" 'link': 'https://dl.acm.org/doi/abs/10.1145/3491101.3519729',\n",
|
||||||
|
" 'engines': ['google scholar'],\n",
|
||||||
|
" 'category': 'science'},\n",
|
||||||
|
" {'snippet': '… can introspect the large prompt model. We derive the view '\n",
|
||||||
|
" 'ϕ0(X) and the model h0 from T01. However, instead of fully '\n",
|
||||||
|
" 'fine-tuning T0 during co-training, we focus on soft prompt '\n",
|
||||||
|
" 'tuning, …',\n",
|
||||||
|
" 'title': 'Co-training improves prompt-based learning for large language '\n",
|
||||||
|
" 'models',\n",
|
||||||
|
" 'link': 'https://proceedings.mlr.press/v162/lang22a.html',\n",
|
||||||
|
" 'engines': ['google scholar'],\n",
|
||||||
|
" 'category': 'science'},\n",
|
||||||
|
" {'snippet': '… With the success of large language models (LLMs) of code and '\n",
|
||||||
|
" 'their use as … prompt design process become important. In this '\n",
|
||||||
|
" 'work, we propose a framework called Repo-Level Prompt …',\n",
|
||||||
|
" 'title': 'Repository-level prompt generation for large language models of '\n",
|
||||||
|
" 'code',\n",
|
||||||
|
" 'link': 'https://arxiv.org/abs/2206.12839',\n",
|
||||||
|
" 'engines': ['google scholar'],\n",
|
||||||
|
" 'category': 'science'},\n",
|
||||||
|
" {'snippet': '… Figure 2 | The benefits of different components of a prompt '\n",
|
||||||
|
" 'for the largest language model (Gopher), as estimated from '\n",
|
||||||
|
" 'hierarchical logistic regression. Each point estimates the '\n",
|
||||||
|
" 'unique …',\n",
|
||||||
|
" 'title': 'Can language models learn from explanations in context?',\n",
|
||||||
|
" 'link': 'https://arxiv.org/abs/2204.02329',\n",
|
||||||
|
" 'engines': ['google scholar'],\n",
|
||||||
|
" 'category': 'science'}]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"results = search.results(\"Large Language Model prompt\", num_results=5, categories='science', time_range='year')\n",
|
||||||
|
"pprint.pp(results)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "2seI78pR8T"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"Get papers from arxiv"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "JyNgoFm0vo"
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[{'snippet': 'Thanks to the advanced improvement of large pre-trained language '\n",
|
||||||
|
" 'models, prompt-based fine-tuning is shown to be effective on a '\n",
|
||||||
|
" 'variety of downstream tasks. Though many prompting methods have '\n",
|
||||||
|
" 'been investigated, it remains unknown which type of prompts are '\n",
|
||||||
|
" 'the most effective among three types of prompts (i.e., '\n",
|
||||||
|
" 'human-designed prompts, schema prompts and null prompts). In '\n",
|
||||||
|
" 'this work, we empirically compare the three types of prompts '\n",
|
||||||
|
" 'under both few-shot and fully-supervised settings. Our '\n",
|
||||||
|
" 'experimental results show that schema prompts are the most '\n",
|
||||||
|
" 'effective in general. Besides, the performance gaps tend to '\n",
|
||||||
|
" 'diminish when the scale of training data grows large.',\n",
|
||||||
|
" 'title': 'Do Prompts Solve NLP Tasks Using Natural Language?',\n",
|
||||||
|
" 'link': 'http://arxiv.org/abs/2203.00902v1',\n",
|
||||||
|
" 'engines': ['arxiv'],\n",
|
||||||
|
" 'category': 'science'},\n",
|
||||||
|
" {'snippet': 'Cross-prompt automated essay scoring (AES) requires the system '\n",
|
||||||
|
" 'to use non target-prompt essays to award scores to a '\n",
|
||||||
|
" 'target-prompt essay. Since obtaining a large quantity of '\n",
|
||||||
|
" 'pre-graded essays to a particular prompt is often difficult and '\n",
|
||||||
|
" 'unrealistic, the task of cross-prompt AES is vital for the '\n",
|
||||||
|
" 'development of real-world AES systems, yet it remains an '\n",
|
||||||
|
" 'under-explored area of research. Models designed for '\n",
|
||||||
|
" 'prompt-specific AES rely heavily on prompt-specific knowledge '\n",
|
||||||
|
" 'and perform poorly in the cross-prompt setting, whereas current '\n",
|
||||||
|
" 'approaches to cross-prompt AES either require a certain quantity '\n",
|
||||||
|
" 'of labelled target-prompt essays or require a large quantity of '\n",
|
||||||
|
" 'unlabelled target-prompt essays to perform transfer learning in '\n",
|
||||||
|
" 'a multi-step manner. To address these issues, we introduce '\n",
|
||||||
|
" 'Prompt Agnostic Essay Scorer (PAES) for cross-prompt AES. Our '\n",
|
||||||
|
" 'method requires no access to labelled or unlabelled '\n",
|
||||||
|
" 'target-prompt data during training and is a single-stage '\n",
|
||||||
|
" 'approach. PAES is easy to apply in practice and achieves '\n",
|
||||||
|
" 'state-of-the-art performance on the Automated Student Assessment '\n",
|
||||||
|
" 'Prize (ASAP) dataset.',\n",
|
||||||
|
" 'title': 'Prompt Agnostic Essay Scorer: A Domain Generalization Approach to '\n",
|
||||||
|
" 'Cross-prompt Automated Essay Scoring',\n",
|
||||||
|
" 'link': 'http://arxiv.org/abs/2008.01441v1',\n",
|
||||||
|
" 'engines': ['arxiv'],\n",
|
||||||
|
" 'category': 'science'},\n",
|
||||||
|
" {'snippet': 'Research on prompting has shown excellent performance with '\n",
|
||||||
|
" 'little or even no supervised training across many tasks. '\n",
|
||||||
|
" 'However, prompting for machine translation is still '\n",
|
||||||
|
" 'under-explored in the literature. We fill this gap by offering a '\n",
|
||||||
|
" 'systematic study on prompting strategies for translation, '\n",
|
||||||
|
" 'examining various factors for prompt template and demonstration '\n",
|
||||||
|
" 'example selection. We further explore the use of monolingual '\n",
|
||||||
|
" 'data and the feasibility of cross-lingual, cross-domain, and '\n",
|
||||||
|
" 'sentence-to-document transfer learning in prompting. Extensive '\n",
|
||||||
|
" 'experiments with GLM-130B (Zeng et al., 2022) as the testbed '\n",
|
||||||
|
" 'show that 1) the number and the quality of prompt examples '\n",
|
||||||
|
" 'matter, where using suboptimal examples degenerates translation; '\n",
|
||||||
|
" '2) several features of prompt examples, such as semantic '\n",
|
||||||
|
" 'similarity, show significant Spearman correlation with their '\n",
|
||||||
|
" 'prompting performance; yet, none of the correlations are strong '\n",
|
||||||
|
" 'enough; 3) using pseudo parallel prompt examples constructed '\n",
|
||||||
|
" 'from monolingual data via zero-shot prompting could improve '\n",
|
||||||
|
" 'translation; and 4) improved performance is achievable by '\n",
|
||||||
|
" 'transferring knowledge from prompt examples selected in other '\n",
|
||||||
|
" 'settings. We finally provide an analysis on the model outputs '\n",
|
||||||
|
" 'and discuss several problems that prompting still suffers from.',\n",
|
||||||
|
" 'title': 'Prompting Large Language Model for Machine Translation: A Case '\n",
|
||||||
|
" 'Study',\n",
|
||||||
|
" 'link': 'http://arxiv.org/abs/2301.07069v2',\n",
|
||||||
|
" 'engines': ['arxiv'],\n",
|
||||||
|
" 'category': 'science'},\n",
|
||||||
|
" {'snippet': 'Large language models can perform new tasks in a zero-shot '\n",
|
||||||
|
" 'fashion, given natural language prompts that specify the desired '\n",
|
||||||
|
" 'behavior. Such prompts are typically hand engineered, but can '\n",
|
||||||
|
" 'also be learned with gradient-based methods from labeled data. '\n",
|
||||||
|
" 'However, it is underexplored what factors make the prompts '\n",
|
||||||
|
" 'effective, especially when the prompts are natural language. In '\n",
|
||||||
|
" 'this paper, we investigate common attributes shared by effective '\n",
|
||||||
|
" 'prompts. We first propose a human readable prompt tuning method '\n",
|
||||||
|
" '(F LUENT P ROMPT) based on Langevin dynamics that incorporates a '\n",
|
||||||
|
" 'fluency constraint to find a diverse distribution of effective '\n",
|
||||||
|
" 'and fluent prompts. Our analysis reveals that effective prompts '\n",
|
||||||
|
" 'are topically related to the task domain and calibrate the prior '\n",
|
||||||
|
" 'probability of label words. Based on these findings, we also '\n",
|
||||||
|
" 'propose a method for generating prompts using only unlabeled '\n",
|
||||||
|
" 'data, outperforming strong baselines by an average of 7.0% '\n",
|
||||||
|
" 'accuracy across three tasks.',\n",
|
||||||
|
" 'title': \"Toward Human Readable Prompt Tuning: Kubrick's The Shining is a \"\n",
|
||||||
|
" 'good movie, and a good prompt too?',\n",
|
||||||
|
" 'link': 'http://arxiv.org/abs/2212.10539v1',\n",
|
||||||
|
" 'engines': ['arxiv'],\n",
|
||||||
|
" 'category': 'science'},\n",
|
||||||
|
" {'snippet': 'Prevailing methods for mapping large generative language models '\n",
|
||||||
|
" \"to supervised tasks may fail to sufficiently probe models' novel \"\n",
|
||||||
|
" 'capabilities. Using GPT-3 as a case study, we show that 0-shot '\n",
|
||||||
|
" 'prompts can significantly outperform few-shot prompts. We '\n",
|
||||||
|
" 'suggest that the function of few-shot examples in these cases is '\n",
|
||||||
|
" 'better described as locating an already learned task rather than '\n",
|
||||||
|
" 'meta-learning. This analysis motivates rethinking the role of '\n",
|
||||||
|
" 'prompts in controlling and evaluating powerful language models. '\n",
|
||||||
|
" 'In this work, we discuss methods of prompt programming, '\n",
|
||||||
|
" 'emphasizing the usefulness of considering prompts through the '\n",
|
||||||
|
" 'lens of natural language. We explore techniques for exploiting '\n",
|
||||||
|
" 'the capacity of narratives and cultural anchors to encode '\n",
|
||||||
|
" 'nuanced intentions and techniques for encouraging deconstruction '\n",
|
||||||
|
" 'of a problem into components before producing a verdict. '\n",
|
||||||
|
" 'Informed by this more encompassing theory of prompt programming, '\n",
|
||||||
|
" 'we also introduce the idea of a metaprompt that seeds the model '\n",
|
||||||
|
" 'to generate its own natural language prompts for a range of '\n",
|
||||||
|
" 'tasks. Finally, we discuss how these more general methods of '\n",
|
||||||
|
" 'interacting with language models can be incorporated into '\n",
|
||||||
|
" 'existing and future benchmarks and practical applications.',\n",
|
||||||
|
" 'title': 'Prompt Programming for Large Language Models: Beyond the Few-Shot '\n",
|
||||||
|
" 'Paradigm',\n",
|
||||||
|
" 'link': 'http://arxiv.org/abs/2102.07350v1',\n",
|
||||||
|
" 'engines': ['arxiv'],\n",
|
||||||
|
" 'category': 'science'}]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"results = search.results(\"Large Language Model prompt\", num_results=5, engines=['arxiv'])\n",
|
||||||
|
"pprint.pp(results)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "LhEisLFcZM"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"In this example we query for `large language models` under the `it` category. We then filter the results that come from github."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "aATPfXzGzx"
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[{'snippet': 'Guide to using pre-trained large language models of source code',\n",
|
||||||
|
" 'title': 'Code-LMs',\n",
|
||||||
|
" 'link': 'https://github.com/VHellendoorn/Code-LMs',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Dramatron uses large language models to generate coherent '\n",
|
||||||
|
" 'scripts and screenplays.',\n",
|
||||||
|
" 'title': 'dramatron',\n",
|
||||||
|
" 'link': 'https://github.com/deepmind/dramatron',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'}]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"results = search.results(\"large language model\", num_results = 20, categories='it')\n",
|
||||||
|
"pprint.pp(list(filter(lambda r: r['engines'][0] == 'github', results)))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "zDo2YjafuU"
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"We could also directly query for results from `github` and other source forges."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"metadata": {
|
||||||
|
"jukit_cell_id": "5NrlredKxM"
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[{'snippet': \"Implementation of 'A Watermark for Large Language Models' paper \"\n",
|
||||||
|
" 'by Kirchenbauer & Geiping et. al.',\n",
|
||||||
|
" 'title': 'Peutlefaire / LMWatermark',\n",
|
||||||
|
" 'link': 'https://gitlab.com/BrianPulfer/LMWatermark',\n",
|
||||||
|
" 'engines': ['gitlab'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Guide to using pre-trained large language models of source code',\n",
|
||||||
|
" 'title': 'Code-LMs',\n",
|
||||||
|
" 'link': 'https://github.com/VHellendoorn/Code-LMs',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': '',\n",
|
||||||
|
" 'title': 'Simen Burud / Large-scale Language Models for Conversational '\n",
|
||||||
|
" 'Speech Recognition',\n",
|
||||||
|
" 'link': 'https://gitlab.com/BrianPulfer',\n",
|
||||||
|
" 'engines': ['gitlab'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Dramatron uses large language models to generate coherent '\n",
|
||||||
|
" 'scripts and screenplays.',\n",
|
||||||
|
" 'title': 'dramatron',\n",
|
||||||
|
" 'link': 'https://github.com/deepmind/dramatron',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Code for loralib, an implementation of \"LoRA: Low-Rank '\n",
|
||||||
|
" 'Adaptation of Large Language Models\"',\n",
|
||||||
|
" 'title': 'LoRA',\n",
|
||||||
|
" 'link': 'https://github.com/microsoft/LoRA',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Code for the paper \"Evaluating Large Language Models Trained on '\n",
|
||||||
|
" 'Code\"',\n",
|
||||||
|
" 'title': 'human-eval',\n",
|
||||||
|
" 'link': 'https://github.com/openai/human-eval',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'A trend starts from \"Chain of Thought Prompting Elicits '\n",
|
||||||
|
" 'Reasoning in Large Language Models\".',\n",
|
||||||
|
" 'title': 'Chain-of-ThoughtsPapers',\n",
|
||||||
|
" 'link': 'https://github.com/Timothyxxx/Chain-of-ThoughtsPapers',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Mistral: A strong, northwesterly wind: Framework for transparent '\n",
|
||||||
|
" 'and accessible large-scale language model training, built with '\n",
|
||||||
|
" 'Hugging Face 🤗 Transformers.',\n",
|
||||||
|
" 'title': 'mistral',\n",
|
||||||
|
" 'link': 'https://github.com/stanford-crfm/mistral',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'A prize for finding tasks that cause large language models to '\n",
|
||||||
|
" 'show inverse scaling',\n",
|
||||||
|
" 'title': 'prize',\n",
|
||||||
|
" 'link': 'https://github.com/inverse-scaling/prize',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Optimus: the first large-scale pre-trained VAE language model',\n",
|
||||||
|
" 'title': 'Optimus',\n",
|
||||||
|
" 'link': 'https://github.com/ChunyuanLI/Optimus',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Seminar on Large Language Models (COMP790-101 at UNC Chapel '\n",
|
||||||
|
" 'Hill, Fall 2022)',\n",
|
||||||
|
" 'title': 'llm-seminar',\n",
|
||||||
|
" 'link': 'https://github.com/craffel/llm-seminar',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'A central, open resource for data and tools related to '\n",
|
||||||
|
" 'chain-of-thought reasoning in large language models. Developed @ '\n",
|
||||||
|
" 'Samwald research group: https://samwald.info/',\n",
|
||||||
|
" 'title': 'ThoughtSource',\n",
|
||||||
|
" 'link': 'https://github.com/OpenBioLink/ThoughtSource',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'A comprehensive list of papers using large language/multi-modal '\n",
|
||||||
|
" 'models for Robotics/RL, including papers, codes, and related '\n",
|
||||||
|
" 'websites',\n",
|
||||||
|
" 'title': 'Awesome-LLM-Robotics',\n",
|
||||||
|
" 'link': 'https://github.com/GT-RIPL/Awesome-LLM-Robotics',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Tools for curating biomedical training data for large-scale '\n",
|
||||||
|
" 'language modeling',\n",
|
||||||
|
" 'title': 'biomedical',\n",
|
||||||
|
" 'link': 'https://github.com/bigscience-workshop/biomedical',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'ChatGPT @ Home: Large Language Model (LLM) chatbot application, '\n",
|
||||||
|
" 'written by ChatGPT',\n",
|
||||||
|
" 'title': 'ChatGPT-at-Home',\n",
|
||||||
|
" 'link': 'https://github.com/Sentdex/ChatGPT-at-Home',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Design and Deploy Large Language Model Apps',\n",
|
||||||
|
" 'title': 'dust',\n",
|
||||||
|
" 'link': 'https://github.com/dust-tt/dust',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Polyglot: Large Language Models of Well-balanced Competence in '\n",
|
||||||
|
" 'Multi-languages',\n",
|
||||||
|
" 'title': 'polyglot',\n",
|
||||||
|
" 'link': 'https://github.com/EleutherAI/polyglot',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'Code release for \"Learning Video Representations from Large '\n",
|
||||||
|
" 'Language Models\"',\n",
|
||||||
|
" 'title': 'LaViLa',\n",
|
||||||
|
" 'link': 'https://github.com/facebookresearch/LaViLa',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'SmoothQuant: Accurate and Efficient Post-Training Quantization '\n",
|
||||||
|
" 'for Large Language Models',\n",
|
||||||
|
" 'title': 'smoothquant',\n",
|
||||||
|
" 'link': 'https://github.com/mit-han-lab/smoothquant',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'},\n",
|
||||||
|
" {'snippet': 'This repository contains the code, data, and models of the paper '\n",
|
||||||
|
" 'titled \"XL-Sum: Large-Scale Multilingual Abstractive '\n",
|
||||||
|
" 'Summarization for 44 Languages\" published in Findings of the '\n",
|
||||||
|
" 'Association for Computational Linguistics: ACL-IJCNLP 2021.',\n",
|
||||||
|
" 'title': 'xl-sum',\n",
|
||||||
|
" 'link': 'https://github.com/csebuetnlp/xl-sum',\n",
|
||||||
|
" 'engines': ['github'],\n",
|
||||||
|
" 'category': 'it'}]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"results = search.results(\"large language model\", num_results = 20, engines=['github', 'gitlab'])\n",
|
||||||
|
"pprint.pp(results)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"anaconda-cloud": {},
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3 (ipykernel)",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.9.11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 4
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user