R Rethinking with Retrieval: Faithful Large Language Model Inference - Hangfeng He 2022 - Better performance than Self-consistency!
Paper: https://arxiv.org/abs/2301.00303v1
Abstract:
>Despite the success of large language models (LLMs) in various natural language processing (NLP) tasks, the stored knowledge in these models may inevitably be incomplete, out-of-date, or incorrect. This motivates the need to utilize external knowledge to assist LLMs. Unfortunately, current methods for incorporating external knowledge often require additional training or fine-tuning, which can be costly and may not be feasible for LLMs. To address this issue, we propose a novel post-processing approach, rethinking with retrieval (RR), which retrieves relevant external knowledge based on the decomposed reasoning steps obtained from the chain-of-thought (CoT) prompting. This lightweight approach does not require additional training or fine-tuning and is not limited by the input length of LLMs. We evaluate the effectiveness of RR through extensive experiments with GPT-3 on three complex reasoning tasks: commonsense reasoning, temporal reasoning, and tabular reasoning. Our results show that RR can produce more faithful explanations and improve the performance of LLMs.
https://preview.redd.it/to09kna1jtaa1.jpg?width=640&format=pjpg&auto=webp&s=8dcb8f39aeeed4881e0c32b16e93b4cf0a0cdd7a
https://preview.redd.it/98eucra1jtaa1.jpg?width=1232&format=pjpg&auto=webp&s=67bfa55977883d871f8e2c7a7bcec896dc77d3ab
https://preview.redd.it/cbhq1ra1jtaa1.jpg?width=835&format=pjpg&auto=webp&s=f8ce2233198a9dee80694f69f95051dab59bf009
https://preview.redd.it/ggoowsa1jtaa1.jpg?width=1356&format=pjpg&auto=webp&s=2614cabac91267ba9a8128188f43521074a9567b
/r/MachineLearning
https://redd.it/106ittu
Paper: https://arxiv.org/abs/2301.00303v1
Abstract:
>Despite the success of large language models (LLMs) in various natural language processing (NLP) tasks, the stored knowledge in these models may inevitably be incomplete, out-of-date, or incorrect. This motivates the need to utilize external knowledge to assist LLMs. Unfortunately, current methods for incorporating external knowledge often require additional training or fine-tuning, which can be costly and may not be feasible for LLMs. To address this issue, we propose a novel post-processing approach, rethinking with retrieval (RR), which retrieves relevant external knowledge based on the decomposed reasoning steps obtained from the chain-of-thought (CoT) prompting. This lightweight approach does not require additional training or fine-tuning and is not limited by the input length of LLMs. We evaluate the effectiveness of RR through extensive experiments with GPT-3 on three complex reasoning tasks: commonsense reasoning, temporal reasoning, and tabular reasoning. Our results show that RR can produce more faithful explanations and improve the performance of LLMs.
https://preview.redd.it/to09kna1jtaa1.jpg?width=640&format=pjpg&auto=webp&s=8dcb8f39aeeed4881e0c32b16e93b4cf0a0cdd7a
https://preview.redd.it/98eucra1jtaa1.jpg?width=1232&format=pjpg&auto=webp&s=67bfa55977883d871f8e2c7a7bcec896dc77d3ab
https://preview.redd.it/cbhq1ra1jtaa1.jpg?width=835&format=pjpg&auto=webp&s=f8ce2233198a9dee80694f69f95051dab59bf009
https://preview.redd.it/ggoowsa1jtaa1.jpg?width=1356&format=pjpg&auto=webp&s=2614cabac91267ba9a8128188f43521074a9567b
/r/MachineLearning
https://redd.it/106ittu
D What is the most complete reference on the history of neural networks?
I'm looking for a comprehensive reference on the history of neural networks that covers all significant papers in the field, from the early days up to the current deep learning era, and provides information on their main contributions and inspirations. It would be helpful to have information on how the understanding and perspectives of the research community on neural networks have evolved over time as well.
Do you know of any good references like that?
/r/MachineLearning
https://redd.it/106ixxx
I'm looking for a comprehensive reference on the history of neural networks that covers all significant papers in the field, from the early days up to the current deep learning era, and provides information on their main contributions and inspirations. It would be helpful to have information on how the understanding and perspectives of the research community on neural networks have evolved over time as well.
Do you know of any good references like that?
/r/MachineLearning
https://redd.it/106ixxx
reddit
[D] What is the most complete reference on the history of neural...
I'm looking for a comprehensive reference on the history of neural networks that covers all significant papers in the field, from the early days...
R Greg Yang's work on a rigorous mathematical theory for neural networks
Greg Yang is a mathematician and AI researcher at Microsoft Research who for the past several years has done incredibly original theoretical work in the understanding of large artificial neural networks. His work currently spans the following five papers:
Tensor Programs I: Wide Feedforward or Recurrent Neural Networks of Any Architecture are Gaussian Processes: https://arxiv.org/abs/1910.12478
Tensor Programs II: Neural Tangent Kernel for Any Architecture: https://arxiv.org/abs/2006.14548
Tensor Programs III: Neural Matrix Laws: https://arxiv.org/abs/2009.10685
Tensor Programs IV: Feature Learning in Infinite-Width Neural Networks: https://proceedings.mlr.press/v139/yang21c.html
Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer: https://arxiv.org/abs/2203.03466
In our whiteboard conversation, we get a sample of Greg's work, which goes under the name "Tensor Programs". The route chosen to compress Tensor Programs into the scope of a conversational video is to place its main concepts under the umbrella of one larger, central, and time-tested idea: that of taking a large N limit. This occurs most famously in the Law of Large Numbers and the Central Limit Theorem, which then play a fundamental role in the branch of mathematics known as Random Matrix Theory (RMT). We review this foundational material and then show how Tensor Programs (TP) generalizes this classical work,
/r/MachineLearning
https://redd.it/105v7el
Greg Yang is a mathematician and AI researcher at Microsoft Research who for the past several years has done incredibly original theoretical work in the understanding of large artificial neural networks. His work currently spans the following five papers:
Tensor Programs I: Wide Feedforward or Recurrent Neural Networks of Any Architecture are Gaussian Processes: https://arxiv.org/abs/1910.12478
Tensor Programs II: Neural Tangent Kernel for Any Architecture: https://arxiv.org/abs/2006.14548
Tensor Programs III: Neural Matrix Laws: https://arxiv.org/abs/2009.10685
Tensor Programs IV: Feature Learning in Infinite-Width Neural Networks: https://proceedings.mlr.press/v139/yang21c.html
Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer: https://arxiv.org/abs/2203.03466
In our whiteboard conversation, we get a sample of Greg's work, which goes under the name "Tensor Programs". The route chosen to compress Tensor Programs into the scope of a conversational video is to place its main concepts under the umbrella of one larger, central, and time-tested idea: that of taking a large N limit. This occurs most famously in the Law of Large Numbers and the Central Limit Theorem, which then play a fundamental role in the branch of mathematics known as Random Matrix Theory (RMT). We review this foundational material and then show how Tensor Programs (TP) generalizes this classical work,
/r/MachineLearning
https://redd.it/105v7el
PMLR
Tensor Programs IV: Feature Learning in Infinite-Width Neural Networks
As its width tends to infinity, a deep neural network’s behavior under gradient descent can become simplified and predictable (e.g. given by the Neural Tange...
P searchthearxiv.com: Semantic search across more than 250,000 ML papers on arXiv
I just launched searchthearxiv.com, a simple semantic search engine over virtually all ML papers published on arXiv since 2012. The site uses OpenAI's `text-embedding-ada-002` model to match the embedding of your query against each of the paper embeddings, retrieving the ones with the highest cosine similarity. It also allows you to insert an arXiv link to find similar papers.
This was mostly meant as a fun side project. However, if people find it useful, I'm happy to maintain it and keep the database up-to-date. I'd love to know what you think! ❤️
/r/MachineLearning
https://redd.it/106hxgk
I just launched searchthearxiv.com, a simple semantic search engine over virtually all ML papers published on arXiv since 2012. The site uses OpenAI's `text-embedding-ada-002` model to match the embedding of your query against each of the paper embeddings, retrieving the ones with the highest cosine similarity. It also allows you to insert an arXiv link to find similar papers.
This was mostly meant as a fun side project. However, if people find it useful, I'm happy to maintain it and keep the database up-to-date. I'd love to know what you think! ❤️
/r/MachineLearning
https://redd.it/106hxgk
Searchthearxiv
search the arXiv
A simple semantic search engine for ML papers on arXiv
how can i prevent the display of few views for a particular user ? in Flask-Admin
​
Model Views for User named Admin
​
Model Views for User named Preethi
​
From the image you can see that for both the users (Admin and Preethi) the following ModelViews are visible or displayed : Home, Car, Profile, Username, usertest.
I want to prevent the user named Preethi from being able to see the ModelViews Profile and Username.
I want the user named Preethi to only see the ModelViews: Home,Car,usertest.
how do I implement that. I tried user based access and if statements to create these models based on the roles or username, but the model views are created at the program run and not when the form is submitted or when the post request gets fulfilled. Please help me with this.
/r/flask
https://redd.it/106uayl
​
Model Views for User named Admin
​
Model Views for User named Preethi
​
From the image you can see that for both the users (Admin and Preethi) the following ModelViews are visible or displayed : Home, Car, Profile, Username, usertest.
I want to prevent the user named Preethi from being able to see the ModelViews Profile and Username.
I want the user named Preethi to only see the ModelViews: Home,Car,usertest.
how do I implement that. I tried user based access and if statements to create these models based on the roles or username, but the model views are created at the program run and not when the form is submitted or when the post request gets fulfilled. Please help me with this.
/r/flask
https://redd.it/106uayl
Seeking suggestions in order to implement two features to complete my django final year project
1. Live onsite group discussion (kinda live chatroom)
2. Ai based movie recommendation system
So Im about 6 months into Django development.
Currently doing my final year web project. And I was instructed to add these two features on my user based rating recommendation website.
Im totally clueless and paranoid right now.
I just need to know. From where should I start? Any resources that you guys can suggest? I just need to know the correct approach & things I need to learn.
Thank you so much.
/r/django
https://redd.it/106jwca
1. Live onsite group discussion (kinda live chatroom)
2. Ai based movie recommendation system
So Im about 6 months into Django development.
Currently doing my final year web project. And I was instructed to add these two features on my user based rating recommendation website.
Im totally clueless and paranoid right now.
I just need to know. From where should I start? Any resources that you guys can suggest? I just need to know the correct approach & things I need to learn.
Thank you so much.
/r/django
https://redd.it/106jwca
reddit
Seeking suggestions in order to implement two features to complete...
1. Live onsite group discussion (kinda live chatroom) 2. Ai based movie recommendation system So Im about 6 months into Django development....
Hhow much of the source code could I reuse?
Hello!
I am new to Django, I have made a desktop system programmed with Python 3 + PostgreSQL + wxPython, I am thinking of creating its web version, I would like to know how much of the source code could I reuse? taking into account that the business logic, data layer and the GUI are logically separated.
Mario
/r/django
https://redd.it/106ru2n
Hello!
I am new to Django, I have made a desktop system programmed with Python 3 + PostgreSQL + wxPython, I am thinking of creating its web version, I would like to know how much of the source code could I reuse? taking into account that the business logic, data layer and the GUI are logically separated.
Mario
/r/django
https://redd.it/106ru2n
reddit
Hhow much of the source code could I reuse?
Hello! I am new to Django, I have made a desktop system programmed with Python 3 + PostgreSQL + wxPython, I am thinking of creating its web...
What are some free website to host aagi django application ?
I want to use websockets. Pythonanywhere doesn't work. Heroku is now paid.
/r/django
https://redd.it/106pvt6
I want to use websockets. Pythonanywhere doesn't work. Heroku is now paid.
/r/django
https://redd.it/106pvt6
reddit
What are some free website to host aagi django application ?
I want to use websockets. Pythonanywhere doesn't work. Heroku is now paid.
Contact users via email
How do you send emails to your users with Django, be it account activation, information about upcoming maintenance work, news?
/r/django
https://redd.it/106gwis
How do you send emails to your users with Django, be it account activation, information about upcoming maintenance work, news?
/r/django
https://redd.it/106gwis
reddit
Contact users via email
How do you send emails to your users with Django, be it account activation, information about upcoming maintenance work, news?
edit multiple rows
i have a template in django which displays lets say some info abut a book in a tabular form.lets say there are 3 books,can i edit these book's info by clicking an edit button.remember this is to edit multiple values simultaneously much like a bulk edit.
/r/django
https://redd.it/106lukv
i have a template in django which displays lets say some info abut a book in a tabular form.lets say there are 3 books,can i edit these book's info by clicking an edit button.remember this is to edit multiple values simultaneously much like a bulk edit.
/r/django
https://redd.it/106lukv
reddit
edit multiple rows
i have a template in django which displays lets say some info abut a book in a tabular form.lets say there are 3 books,can i edit these book's...
(Taggit Library) - Adding a foreign key to taggittag model. Should I create a new table, or extend Tag?
Hey!
Right now taggit\tag comes with two fields:
​
Can anyone suggest ways of doing this? I think I need to make my own model that extends taggit-tag, with the same name and add the extra field. I can then also extend the
Something like this:
​
But I could be waaaay off. Can anyone provide insights to this?
/r/django
https://redd.it/106eh9x
Hey!
Right now taggit\tag comes with two fields:
name and slug. This means all tags added to my application are global and can't be separated by the account that's using it. Therefore I'd like to add a foreign key to the model;account = models.ForeignKey("Account", on_delete=models.CASCADE)​
Can anyone suggest ways of doing this? I think I need to make my own model that extends taggit-tag, with the same name and add the extra field. I can then also extend the
save() method to ensure an account_id is being added (which I can derive from the object I'm tagging) .Something like this:
from django.db import models from taggit.models import Tag class Tag(Tag): account = models.ForeignKey("Account", on_delete=models.CASCADE) super() ​
But I could be waaaay off. Can anyone provide insights to this?
/r/django
https://redd.it/106eh9x
reddit
(Taggit Library) - Adding a foreign key to taggit_tag model....
Hey! Right now taggit\_tag comes with two fields: `name` and `slug`. This means all tags added to my application are global and can't be...
Pip Install Plotly-Dash | Top 10 Useful Resources for building dashboards on Flask
https://youtu.be/1LqFL2536QI
/r/flask
https://redd.it/106k89u
https://youtu.be/1LqFL2536QI
/r/flask
https://redd.it/106k89u
YouTube
Pip Install Plotly-Dash | Top 10 Useful Resources
Dash by Plotly: Dash is an open-source framework for building analytical web applications with Python. It allows users to create interactive dashboards, charts, and graphs using Python's data visualization libraries.
1. Dash User Guide: The Dash User Guide…
1. Dash User Guide: The Dash User Guide…
How to avoid circular reference to SQLAlchemy.db.Model?
I have a module "resources" that facades access to my SQLAlchemy db. It has an "open" function that assigns a global db variable (simplified):
db = None
def open():
global db
db = SQLAlchemy(app)
I also have a module "models" defining my models, which includes code like:
class thing(resources.db.Model):
__tablename__ = "thing_table"
...
When I run the code, I get an error because before the open() function is called, db = None, so resources.db.Model is undefined.
> AttributeError: 'NoneType' object has no attribute 'Model'
How can I get the references right?
/r/flask
https://redd.it/106wiqi
I have a module "resources" that facades access to my SQLAlchemy db. It has an "open" function that assigns a global db variable (simplified):
db = None
def open():
global db
db = SQLAlchemy(app)
I also have a module "models" defining my models, which includes code like:
class thing(resources.db.Model):
__tablename__ = "thing_table"
...
When I run the code, I get an error because before the open() function is called, db = None, so resources.db.Model is undefined.
> AttributeError: 'NoneType' object has no attribute 'Model'
How can I get the references right?
/r/flask
https://redd.it/106wiqi
reddit
How to avoid circular reference to SQLAlchemy.db.Model?
I have a module "resources" that facades access to my SQLAlchemy db. It has an "open" function that assigns a global db variable (simplified): ...
Deployed gunicorn flask app to Render.com but slow startup
Normally, it is pretty quick to load the website. But whenever I don’t access the website in awhile, the workers exit, and so when I try to access the website again, the workers have to boot up again and it takes much longer. Is this normal? How do I make it so the load time after inactivity is quicker?
/r/flask
https://redd.it/106uz8g
Normally, it is pretty quick to load the website. But whenever I don’t access the website in awhile, the workers exit, and so when I try to access the website again, the workers have to boot up again and it takes much longer. Is this normal? How do I make it so the load time after inactivity is quicker?
/r/flask
https://redd.it/106uz8g
reddit
Deployed gunicorn flask app to Render.com but slow startup
Normally, it is pretty quick to load the website. But whenever I don’t access the website in awhile, the workers exit, and so when I try to access...
Datatype bug when trying to update database
Hello,
I am trying to make a route that will update my database. However, the data is somehow being changed into a tuple instead of being a string. The stored data is a string. The data from the form is a string. However, when I go to update the existing data it is somehow a tuple?
@app.route("/character/<int:characterid>/edit-core-details", methods=["GET", "POST"])
def editcorecharacterdetails(characterid):
campaigns = Campaign.query.all()
requestedcharacter = Character.query.get(characterid)
form = forms.EditNameRaceClass()
if form.validateonsubmit():
print("Before")
print(type(requestedcharacter.name))
requestedcharacter.name = form.name.data,
print("After")
print(type(requestedcharacter.name))
print("form data")
print(form.name.data)
/r/flask
https://redd.it/106cv2n
Hello,
I am trying to make a route that will update my database. However, the data is somehow being changed into a tuple instead of being a string. The stored data is a string. The data from the form is a string. However, when I go to update the existing data it is somehow a tuple?
@app.route("/character/<int:characterid>/edit-core-details", methods=["GET", "POST"])
def editcorecharacterdetails(characterid):
campaigns = Campaign.query.all()
requestedcharacter = Character.query.get(characterid)
form = forms.EditNameRaceClass()
if form.validateonsubmit():
print("Before")
print(type(requestedcharacter.name))
requestedcharacter.name = form.name.data,
print("After")
print(type(requestedcharacter.name))
print("form data")
print(form.name.data)
/r/flask
https://redd.it/106cv2n
reddit
Datatype bug when trying to update database
Hello, I am trying to make a route that will update my database. However, the data is somehow being changed into a tuple instead of being a...
Monday Daily Thread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/106yoak
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/106yoak
reddit
Monday Daily Thread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with...
Fixing Python's "Cachetools" Library
"Cachetools" has become a cornerstone of Python cacheing libraries, but it has a few issues:
# 1. cachetools.LFUCache
Slow insertion times when the cache is full. When the cache is at capacity and a new item is inserted, the cache automatically handles eviction of the least frequently used item. Under the hood, cachetools uses a `Collections.Counter` object as it's interface to track item usage frequencies. When an item is evicted, Cachetools calls the `Counter.most_common()` API to retrieve the least frequently used item. This method creates a copy of the original underlying dictionary and sorts it by-key. Python uses `Timsort`, which is a O(n*logn) operation plus copy overhead. When the cache is large, this results in concerningly slow insertion times. With a cache size of 16384, median insertion times are \~0.6 microseconds (1e-6). When the cache is full, P90 and P99 insertion times are 540 and 600 microseconds (1e-6), a \~90,000% and \~100,000% increase from the median, respectively.
To solve this, `cacheing` implements an LFUCache API with O(1) insertions, deletions, and gets using a doubly linked list in the backend. This reduced P90 and P99 insertion times by \~45,000% and \~50,000%, respectively.
# 2. cachetools.TTLCache
This is a great time aware cache implementation. The issue is
/r/Python
https://redd.it/1077q6z
"Cachetools" has become a cornerstone of Python cacheing libraries, but it has a few issues:
# 1. cachetools.LFUCache
Slow insertion times when the cache is full. When the cache is at capacity and a new item is inserted, the cache automatically handles eviction of the least frequently used item. Under the hood, cachetools uses a `Collections.Counter` object as it's interface to track item usage frequencies. When an item is evicted, Cachetools calls the `Counter.most_common()` API to retrieve the least frequently used item. This method creates a copy of the original underlying dictionary and sorts it by-key. Python uses `Timsort`, which is a O(n*logn) operation plus copy overhead. When the cache is large, this results in concerningly slow insertion times. With a cache size of 16384, median insertion times are \~0.6 microseconds (1e-6). When the cache is full, P90 and P99 insertion times are 540 and 600 microseconds (1e-6), a \~90,000% and \~100,000% increase from the median, respectively.
To solve this, `cacheing` implements an LFUCache API with O(1) insertions, deletions, and gets using a doubly linked list in the backend. This reduced P90 and P99 insertion times by \~45,000% and \~50,000%, respectively.
# 2. cachetools.TTLCache
This is a great time aware cache implementation. The issue is
/r/Python
https://redd.it/1077q6z
reddit
Fixing Python's "Cachetools" Library
"Cachetools" has become a cornerstone of Python cacheing libraries, but it has a few issues: # 1. cachetools.LFUCache Slow insertion times when...
CodeGPT: The VSCode Extension with ChatGPT-Like Functionalities
https://medium.com/geekculture/codegpt-the-vscode-extension-with-chatgpt-like-functionalities-783323a916c3
/r/Python
https://redd.it/1075wqe
https://medium.com/geekculture/codegpt-the-vscode-extension-with-chatgpt-like-functionalities-783323a916c3
/r/Python
https://redd.it/1075wqe
Medium
CodeGPT: The VSCode Extension with ChatGPT-Like Functionalities
GPT-3 inside VSCode using the official OpenAI API.
Thoughts on nested / inner functions in Python for better encapsulation and clarity?
Been loving Python for 7+ years not and still going strong. I recently found myself writing more and more inner functions to encapsulate logic easier and make otherwise rather polluting/dead functions stick out less.
I like it, because it allows me to write way cleaner and less bloated code – clustering helper-functions to only where they need to be. Also decreases cognitive load considerably by not having to keep track on where a helper function is being used.
But it has gotten to a point where I'm genuinely concerned, because I have also started defining lambdas in inner-functions too! I know lambda shouldn't be used and PEP checker complains too, but it's so handy when combined with list comprehensions…
What are your thoughts on this?
Do you use nested functions yourself or do you consider it bad practice? Where else do you put helpers?
---
An example would be the following code:
def sendmail(
*,
subject: str,
bodyplain: str,
sendto: Union[List[str], str, List[User], User],
sendcc:
/r/Python
https://redd.it/106rsv8
Been loving Python for 7+ years not and still going strong. I recently found myself writing more and more inner functions to encapsulate logic easier and make otherwise rather polluting/dead functions stick out less.
I like it, because it allows me to write way cleaner and less bloated code – clustering helper-functions to only where they need to be. Also decreases cognitive load considerably by not having to keep track on where a helper function is being used.
But it has gotten to a point where I'm genuinely concerned, because I have also started defining lambdas in inner-functions too! I know lambda shouldn't be used and PEP checker complains too, but it's so handy when combined with list comprehensions…
What are your thoughts on this?
Do you use nested functions yourself or do you consider it bad practice? Where else do you put helpers?
---
An example would be the following code:
def sendmail(
*,
subject: str,
bodyplain: str,
sendto: Union[List[str], str, List[User], User],
sendcc:
/r/Python
https://redd.it/106rsv8
reddit
Thoughts on nested / inner functions in Python for better...
Been loving Python for 7+ years not and still going strong. I recently found myself writing more and more inner functions to encapsulate logic...