Skip to content

August 2024

Evaluating LLM Defense Capabilities Using the Microsoft BIPIA Framework

Last Updated on 2024-08-30 by Clay

Currently, LLM services cover a wide range of fields, and Prompt Injection and Jailbreak threats to LLMs are growing by the day. A few months ago, a customer service LLM even provided incorrect information, leading to a loss of customer rights (although that wasn't caused by a prompt attack).

Microsoft's open-source BIPIA (Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Models) evaluation method, although tested six months ago without significant updates since, remains a simple and convenient testing method for the tasks I have at hand.

Read More »Evaluating LLM Defense Capabilities Using the Microsoft BIPIA Framework

Note Of Newton Polynomial

Last Updated on 2024-08-26 by Clay

Newton's interpolation is a polynomial interpolation method that constructs a set of polynomial functions using multiple data points. A major advantage is that with the addition of new data, Newton's interpolation method does not require recalculations from scratch but can instead expand on the existing function.

Read More »Note Of Newton Polynomial

Using AutoModel.from_pretrained() In Transformers To Load Customized Model Architecture

Last Updated on 2024-08-22 by Clay

To this day, many AI applications and open-source projects are developed based on the HuggingFace transformers package. A large number of models and packages are written to be compatible with the transformers format, and even share the same functions and methods, which makes them more widely accepted.

Under this premise, I came across an open-source training framework that conveniently wraps the automatic reading of Transformer architectures. However, one unavoidable problem is I want to use my custom model for experiments. I tried several solutions, hoping that when using AutoModel.from_pretrained(), by simply providing the local path to my model, I could successfully use my custom model architecture. This article records the method that worked.

Read More »Using AutoModel.from_pretrained() In Transformers To Load Customized Model Architecture

[Solved] RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

Last Updated on 2024-08-21 by Clay

Problem Description

When building deep learning models in PyTorch, adjusting the shapes of layers and input/output dimensions is something every AI engineer has to deal with. However, there is a small but interesting pitfall in the view() method of PyTorch:

RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
Read More »[Solved] RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.