DEV Community

Cover image for Stock Financial Analysis (Report Generation) using Generative AI - Gemini 1.5 Flash vs LLama 3.2 8b Model
Mr.Shah
Mr.Shah

Posted on

Stock Financial Analysis (Report Generation) using Generative AI - Gemini 1.5 Flash vs LLama 3.2 8b Model

Introduction

As I approached my final year of college, I found myself pondering a challenge that many investors face daily. Picture this: You're interested in investing in a company, but you're handed a 50-page report filled with complex financial jargon and endless data tables. 🤯 Sound familiar? This was the puzzle I wanted to solve. 🤔

I've been passionate about finance and investing for over three years. In college, I saw investors—experts and beginners alike—struggling with the time-consuming task of analyzing company reports. This led me to develop the idea of using artificial intelligence to streamline the process.💡

My "Stock Report Generator" acts as your personal financial analyst, quickly summarizing complex company reports. Imagine getting clear, concise answers about a stock's investment potential in a fraction of the usual time—minutes instead of hours.

This powerful tool provides a comprehensive report that includes: a company's strengths and weaknesses; global market sentiment; 10-year growth analysis; 5-year company goals; an overall stock rating (0-1); competitive analysis; industry trends; potential risks and opportunities; and a detailed valuation assessment.

The result is a simple, easy-to-understand report, empowering you to make informed investment decisions quickly and efficiently.

This project compares two top-tier AI language models in a real-world financial analysis challenge: Google's Gemini 1.5 Flash and Meta's Llama 3.2 8b. We pitted these powerful AI "analysts" against each other, evaluating their performance on a crucial task: generating comprehensive stock reports.

Think of it as getting opinions from two top financial analysts with distinct approaches. Gemini 1.5 Flash, accessed via its API, represents a cutting-edge commercially available solution. In contrast, Llama 3.2 8b leveraged the processing power of a high-end college computing server(Intel Xeon Gold Processor - can't recall the exact configuration), offering a different perspective on the same data.

This comparative analysis allowed me to assess the strengths and weaknesses of each AI model in generating accurate and insightful stock reports. By comparing their outputs, I could determine which model provided more reliable and valuable investment insights.

The goal was to identify the most effective AI for producing comprehensive and dependable financial analyses, ultimately improving the accuracy and efficiency of my Stock Report Generator.

Comparison

A detailed, 11-point financial analysis of HomeFirst Finance. We monitored their performance in real-time, focusing not only on the quality of their output, but also on the efficiency of their analysis. This wasn't just a theoretical exercise—it was a test of their practical application in a demanding financial setting.

Our evaluation wasn't one-dimensional. We used multiple key metrics to compare the two models. Accuracy and relevance of the reports were critical, naturally. But we also measured processing speed, resource consumption (how much computing power each model used), and ultimately, cost-effectiveness.

Google's Gemini 1.5 Flash, a cloud-based powerhouse, utilizes Google's enterprise-grade servers, engineered for speed and readily accessible via a user-friendly API.

In contrast, Llama 3.2 8b takes a different route, offering an open-source, locally deployable architecture. This 8-billion parameter model requires self-hosting, providing more control and customization but demanding more technical expertise to set up and maintain.

Both models tackled the same challenging task: a comprehensive financial analysis. This wasn't a simple task, it required a deep dive into several key areas of financial assessment. The AI had to dissect various facets of a company's financial health, providing insights across a broad spectrum.

The analysis components themselves were rigorous and comprehensive: First, a clear company overview was essential, laying the groundwork for subsequent analysis. This was followed by a thorough financial performance review, scrutinizing key metrics and trends.

Next, both models had to gauge market sentiment—understanding investor perception and its impact on the company's prospects. This was followed by an evaluation of prevailing industry trends, assessing both current conditions and future possibilities. The AI's also needed to evaluate the company's competitive positioning within its industry, identifying strengths and weaknesses relative to competitors.

Crucially, both models were required to perform a thorough risk assessment, pinpointing potential threats and opportunities. Finally, the ultimate test: generating informed and well-reasoned investment recommendations based on their analysis.

Output Quality Analysis

Critical Findings:

| Quality Metric     | Gemini 1.5 Flash    | LLama 3.2 8b        |
|-------------------|---------------------|-------------------|
| Company Identity  | ✓ Correct          | ✗ Misidentified   |
| Industry Focus    | ✓ Finance Sector   | ✗ Tech Sector     |
| Data Accuracy     | ✓ Precise          | ✗ Incorrect Data  |
| Analysis Depth    | ✓ Comprehensive    | ✗ Superficial     |
Enter fullscreen mode Exit fullscreen mode

Performance Metrics

Response Time & Resource Usage:

| Metric            | Gemini 1.5 Flash | LLama 3.2 8b    |
|------------------|------------------|-----------------|
| Response Time    | 2-3 seconds      | 45-60 seconds   |
| CPU Usage        | Minimal (local)  | High            |
| Memory Required  | <1GB (local)     | >16GB           |
| GPU Dependency   | None (local)     | Required        |
Enter fullscreen mode Exit fullscreen mode

Infrastructure Requirements

Deployment Comparison:

Gemini 1.5 Flash:

  • Internet connectivity
  • API authentication
  • Basic system requirements

LLama 3.2 8b:

  • Dedicated server
  • High-performance GPU
  • Substantial RAM
  • Storage capacity

Cost Analysis

Financial Considerations:

| Aspect           | Gemini 1.5 Flash | LLama 3.2 8b    |
|-----------------|------------------|-----------------|
| Initial Cost    | None            | High            |
| Operating Cost  | Per-call basis  | Fixed           |
| Maintenance     | Included        | Additional      |
| Scaling Cost    | Linear         | Exponential     |
Enter fullscreen mode Exit fullscreen mode

Sample Output Comparison

Company Description:

Gemini 1.5 Flash:

"HomeFirst is an Indian housing finance company specializing in affordable housing loans..."

LLama 3.2 8b:

"HOMEFIRST.NS is a multinational technology company..."

Technical Capabilities

Processing Features:

| Feature          | Gemini 1.5 Flash | LLama 3.2 8b    |
|-----------------|------------------|-----------------|
| Parallel Proc.  | Unlimited       | Hardware Limited|
| Customization   | API Parameters  | Full Access     |
| Updates         | Automatic       | Manual          |
Enter fullscreen mode Exit fullscreen mode

Quality Metrics Dashboard

Scoring Analysis:

| Metric        | Gemini 1.5 Flash | LLama 3.2 8b |
|--------------|------------------|--------------|
| Accuracy     | 9.5/10          | 3.0/10       |
| Relevance    | 9.0/10          | 4.0/10       |
| Structure    | 9.0/10          | 7.0/10       |
| Depth        | 9.0/10          | 5.0/10       |
| Clarity      | 9.0/10          | 6.0/10       |
Enter fullscreen mode Exit fullscreen mode

Use Case Recommendations

Optimal Deployment Scenarios:

Gemini 1.5 Flash:

  • Enterprise applications
  • Time-critical analysis
  • Consistent workloads
  • Scalable operations

LLama 3.2 8b:

  • Privacy-sensitive data
  • Customization requirements
  • Offline processing
  • Research environments

Environmental Impact

Sustainability Considerations:

| Factor           | Gemini 1.5 Flash | LLama 3.2 8b    |
|-----------------|------------------|-----------------|
| Energy Usage    | Optimized       | Variable        |
| Carbon Footprint| Shared          | Individual      |
| Resource Util.  | Efficient       | Hardware Depend.|
Enter fullscreen mode Exit fullscreen mode

SWOT Analysis

Comparative Strengths & Weaknesses:

Gemini 1.5 Flash:

  • Strengths: Speed, accuracy, scalability
  • Weaknesses: Internet dependency

LLama 3.2 8b:

  • Strengths: Control, privacy
  • Weaknesses: Resource intensive

Future Outlook

Development Trajectory:

  • Model improvements
  • Infrastructure evolution
  • Cost optimization
  • Performance enhancements

Detailed Comparison

Artificial Analysis

Quality vs. Context Window, Input Token Price

Context Window

Pricing: Input and Output Prices

Output Speed

Latency

Total Response Time

Conclusions

Overall, Gemini 1.5 flash has outperformed the llama 3.2 8b model in terms of quality output and in respect to many other factors discussed above.

Wanna read the stock report generated?

Follow this link: Generated Report
You will automatically identify the best quality output reading reports generated by both models (Take your time and read the report).

Thanks for reading! 😊 Hope you enjoyed it!

Top comments (0)