Pondhouse Data AI - Edition 4

Use-Cases and Tips & Tricks from Data and AI

Hey there,

We’re excited to bring you the 4th edition of our Pondhouse AI newsletter — your go-to for all things artifical intelligence. Whether you want to learn about AI concepts, use AI tools effectively, or see inspiring examples, we’ve got you covered.

Let’s get started!

Cheers, Andreas & Sascha

In todays edition:

  • News: Google releases Gemma 2, a high-performance model

  • Tutorial: Extract data from documents using LLMs

  • Tip of the Week: Add AI capabilities to PostgreSQL with ‘pgai’

  • Tool of the Week: Extract tables from PDFs with ‘pdfplumber’

Find this Newsletter helpful?
Please forward it to your colleagues and friends - it helps us tremendously.

Top News

Google Releases Gemma 2

Google has introduced Gemma 2, the newest addition to their open AI models. Aimed at researchers and developers, Gemma 2 comes in two versions: 9 billion (9B) and 27 billion (27B) parameters, offering improved performance and efficiency. The updated design includes key safety improvements and cost-effective usage, even on single GPUs or TPUs. Gemma 2 works smoothly with major AI frameworks and is available under a business-friendly license.

Key Features:

  • Sliding Window Attention: Combines local and global attention layers for balanced quality and efficiency.

  • Soft-Capping: Controls the growth of logits for stable training.

  • Knowledge Distillation: Utilizes a larger teacher model to boost the 9B model's performance.

  • Performance Metrics:

Deployment and Access:

  • Model weights available on Kaggle and Hugging Face.

  • Deployment on Vertex AI starts next month, with options for Google AI Studio and local environments using Gemma.cpp.

Safety and Evaluation:

Includes thorough safety measures like data filtering and comprehensive testing to reduce biases and risks.

For more details, read the full announcement here.

Tutorials & Use Cases

Extract Data from Documents Using Large Language Models

Learn how to use Large Language Models (LLMs) to extract data from complex documents with varied layouts. This approach effectively handles text, tables, and technical content.

Overview of the extraction process

Steps:

  1. Setup:

    Install necessary libraries: Pillow (for image processing), torch and torchvision (for deep learning), transformers and sentencepiece (for handling the LLM), and pymupdf (for working with PDFs).

  2. Model and Tokenizer:

    Use the MiniCPM-Llama3-V2.5 model from Hugging Face. This model is well-suited for handling various document structures and extracting relevant data accurately.

  3. Document Conversion:

    Convert PDF pages to images using PyMuPDF. This allows the model to process each page as an image, facilitating the extraction of text and other elements.

  4. Text Extraction:

    Apply the model to extract and format text. The model processes the images, detects text blocks, and extracts the content, ensuring that the information is retrieved accurately from different document layouts.

For a comprehensive guide, read the full tutorial here.

Also in the news

pgvector Now as Fast as Pinecone at 75% Less Cost

Timescale recently announced that pgvector, an extension for PostgreSQL, now matches Pinecone's speed while being 75% more cost-effective. This enhancement significantly boosts performance for AI and machine learning applications that require efficient vector similarity searches. By integrating seamlessly with PostgreSQL, pgvector provides an accessible and affordable solution for developers and businesses looking to optimize their database operations.

For more details, read the full article here.

Apple Releases 4M Framework

Apple has unveiled 4M, a scalable and open-source framework for training any-to-any multimodal foundation models. This innovative framework supports the integration of various data types, enhancing the flexibility and efficiency of multimodal AI development. With 4M, developers can easily train models that handle diverse inputs, paving the way for more advanced AI applications.

For more details, explore the 4M GitHub page.

Groq Runs Whisper Large-v3 at 164x Speed

Groq recently announced that their hardware can run Whisper Large-v3 at a 164x speed factor, as confirmed by new Artificial Analysis benchmarks. This significant speed improvement highlights Groq's capabilities in accelerating AI workloads, offering substantial performance benefits for large-scale AI applications. This advancement demonstrates Groq's potential to redefine efficiency in AI processing.

For more details, read the full article here.

Tip of the week

Integrate AI Directly from Your Database

Enhance your PostgreSQL database with AI capabilities using the pgai extension. Perform tasks like text analysis and sentiment classification without needing separate AI infrastructure. Simply install pgai, set up with your OpenAI API key, and start running AI queries directly from your database.

For a detailed guide, check out the full tutorial here.

Tool of the week

pdfplumber

pdfplumber is a Python package designed to extract text, tables, and other content from PDF files with precision. This tool is ideal for anyone who needs to handle and analyze PDF data programmatically.

Why pdfplumber?

  • Text Extraction: Accurately extracts text from PDFs, including complex layouts.

  • Table Extraction: Efficiently extracts tables and presents them in a structured format.

  • Visual Content: Captures images and other visual elements from PDFs.

  • Customization: Offers detailed control over the extraction process, allowing for tailored outputs.

How it Works

  1. Installation: Install pdfplumber using pip.

  2. Basic Usage: Open a PDF and extract text or tables using simple commands.

  3. Advanced Features: Utilize pdfplumber’s advanced functions to fine-tune extraction, handle complex documents, and integrate with other data processing workflows.

For more information and examples, visit the pdfplumber GitHub page.

We hope you liked our newsletter and you stay tuned for the next edition. If you need help with your AI tasks and implementations - let us know. We are happy to help