I Analyzed My Finance With Local LLMs
TLDRIn this insightful video, the creator shares their annual financial review process, which includes analyzing bank transactions to understand income and expenses better. Inspired by someone else's income and expense breakdown, they decide to use a local, open-source large language model (LLM) to categorize expenses from their bank statements. They explore different frameworks like Lama CPP and GPT for running LLMs locally on their laptop, which is both secure and free. After experimenting with various models, they find Llama 2 to be effective for categorizing expenses. The creator then customizes Llama 2 with a model file for better task performance and uses Python to automate the process of classifying transactions. The result is a detailed personal finance dashboard created with Plotly Express and Panel, showcasing income and expense breakdowns for 2022 and 2023, as well as monthly earnings and expenditures. The video concludes with a note on the importance of considering assets in personal finance and an encouragement to experiment with open-source LLMs for personal projects.
Takeaways
- ๐ฐ Money is not everything, but it's important to review your financial transactions regularly.
- ๐ The speaker was inspired to create an income and expense breakdown, leading to a personal finance analysis project.
- ๐ Privacy is a concern when uploading bank statements to online services, so the speaker chose to use a local large language model (LLM).
- ๐ The use of open-source LLMs like LLaMa 2 was explored to classify expenses without relying on internet APIs or third-party services.
- ๐ป Frameworks like LLaMa CPP and AMA facilitate running large language models locally, offering security and cost benefits.
- ๐ The project involved installing and running an LLM, classifying expenses, analyzing data, and creating visualizations using Python.
- ๐ ๏ธ The speaker encountered issues with basic arithmetic tasks using LLMs, highlighting the need for caution in their use for quantitative tasks.
- ๐ฆ The LLM was used to categorize bank statement transactions, with varying success, and a custom model was created for better performance.
- ๐ The speaker shared the code on GitHub for others to replicate or learn from the project.
- ๐ A personal finance dashboard was created using Plotly Express and Panel to visualize income and expense breakdowns for 2022 and 2023.
- ๐ค The importance of considering assets alongside expenses and income for a complete financial overview was discussed.
Q & A
Why does the speaker review their bank transactions periodically?
-The speaker reviews their bank transactions to analyze their income and expenses, which they find important for managing their finances effectively, despite acknowledging that money is not everything.
What inspired the speaker to create an income and expense breakdown?
-The speaker was inspired to create an income and expense breakdown after coming across someone else's breakdown, which motivated them to do the same.
Why did the speaker decide not to use an online API service to process their financial data?
-The speaker was concerned about the privacy and security of their sensitive financial information, which could be stored by the API service for up to 30 days, hence they chose to use a local, open-source large language model.
What are the two main benefits of using frameworks like LLMa and Lama CPP for running large language models locally?
-The two main benefits are quantization, which reduces the memory footprint of the model weights, and improved efficiency for the user, making it easier to utilize the models.
How does the speaker plan to use the local large language model for their bank transactions?
-The speaker plans to use the local large language model to classify their expenses from bank transactions into appropriate categories and analyze the data to gain insights into their spending habits.
What is the speaker's experience with the arithmetic capabilities of the large language model?
-The speaker found that while the large language model provided an elaborate response to a basic arithmetic question, it did not accurately calculate the product of two large numbers, indicating that out-of-the-box, these models may not be the best for basic arithmetic.
How did the speaker address the issue of the large language model providing different answers to the same question?
-The speaker acknowledges the randomness in the model's responses and suggests that for specific use cases, one can customize the language model by specifying a model file with desired parameters and a custom system message.
What is the process the speaker uses to classify their bank transactions using the large language model?
-The speaker uses a for loop to process their transactions in batches of 30 to avoid exceeding the token limit of the model. They then use a custom function to validate and format the model's output into categories for each transaction.
How does the speaker handle the task of creating a personal finance dashboard?
-The speaker creates a personal finance dashboard using Plotly Express for visualizations and Panel for organizing the dashboard. They include pie charts for income and expense breakdowns and bar charts for monthly income and expenses for the years 2022 and 2023.
What is the speaker's final step in processing their financial data?
-The final step is to clean up the dataframe, merge it with the main transaction dataframe, and ensure all transactions are categorized correctly to use in the personal finance dashboard.
What is the speaker's perspective on the future use of large language models?
-The speaker believes that in the future, it will become a norm to use and run large language models locally on personal devices like laptops for various applications, including personal finance management.
Outlines
๐ผ Personal Finance Management with AI
The speaker discusses the importance of managing personal finances and how they review their bank transactions annually. Inspired by someone else's income and expense breakdown, they decide to use an open-source large language model (LLM) to categorize expenses from their bank statements. They mention the privacy concerns of uploading sensitive financial data to a third-party service and choose to run the LLM locally on their laptop. The video also introduces the process of installing and running an LLM, such as LLaMa 2, and using it to classify expenses into categories like groceries, rent, and travel. The speaker provides a GitHub link for the code used in the project and discusses the frameworks available for running LLMs locally, such as LLaMa CPP and GPT for.
๐งฎ Testing LLMs for Expense Classification
The speaker tests the ability of LLMs to perform basic arithmetic and classify expenses from bank statements. They find that while LLMs can provide elaborate answers, they may not be the best for basic math. The speaker then focuses on classifying expenses using the Mistro and LLaMa 2 models. They find that LLaMa 2 performs better in categorizing expenses as expected. The speaker also discusses creating a custom model file for further customization of the LLM to a specific use case, such as a financial assistant.
๐ Analyzing Bank Transactions with Python
The speaker outlines the process of using Python to analyze bank transaction data. They mention installing the Lang chain community library to access language models through LLaMa and discuss reading transaction data, handling token limits, and creating a loop to process transactions in batches. The speaker uses a custom function to format the output from the LLM and a validation check to ensure the correct format. They also mention using the pandas library for data manipulation and the creation of a DataFrame to store categorized transactions.
๐ Creating a Personal Finance Dashboard
The speaker describes the process of creating a personal finance dashboard using Plotly Express and Panel. They read in transaction data and create functions to generate pie charts for income and expense breakdowns and bar charts for monthly income and expense histograms. The speaker then combines these charts into a dashboard using a Panel template, providing an overview of income and expenses for the years 2022 and 2023. They conclude by noting that while they cannot retire soon, they hope the project inspires viewers to experiment with open-source LLMs and manage their personal finances.
Mindmap
Keywords
Bank Transactions
Expense Classification
Large Language Model (LLM)
Local Installation
Data Analytics
Visualization
GitHub
Personal Finance Dashboard
Plotly Express
Panel
Open-Source
Highlights
The importance of reviewing personal finances regularly is emphasized, with the author comparing money to 'almost everything'.
The author shares their method of downloading bank transactions to analyze income and expenses.
Inspired by someone else's income and expense breakdown, the author decides to create their own.
Classifying expenses into appropriate categories is identified as the most challenging part of the process.
Due to privacy concerns, the author opts to use a local large language model (LLM) instead of uploading bank statements to a website.
The author discusses the limitations of using open APIs, including data storage concerns.
The decision to run an open-source LLM locally on a laptop for privacy and cost benefits is detailed.
Installing and running an LLM like LLaMa 2 locally is shown as a secure and free alternative to third-party services.
Frameworks like Lama CPP and GPT for are used to run open-source language models locally, with quantization and efficiency benefits.
The author guides viewers on how to download and install the LLM framework 'Orama' for Mac or Linux.
Windows users are shown how to run LLMs through Docker Desktop.
The process of installing a language model locally through the command line is demonstrated.
The author tests the LLM's ability to perform basic arithmetic and categorize expenses from bank statements.
Llama 2 is found to be more effective at classifying expenses than the Mistro model.
Customizing LLMs with a model file allows for a more tailored approach to specific use cases.
The author demonstrates creating a custom model file named 'expense analyzer' with specific parameters.
Interacting with LLMs through Python and Jupyter Notebook is shown to be more convenient than using the terminal.
The author's method for handling large amounts of transaction data to avoid token limit issues is explained.
A for loop is used to process transactions in batches, optimizing the interaction with the LLM.
The author discusses the use of the 'pandas' library for data validation and handling different output formats from the LLM.
A personal finance dashboard is created using Plotly Express and Panel to visualize income and expense data.
The dashboard provides an income and expense breakdown for 2022 and 2023, as well as monthly earnings and expenditures.
The author acknowledges that the financial overview provided is not complete without considering assets.
The project serves as an inspiration for others to experiment with open-source language models for personal finance management.