Package: bampe-weights
Can an AI visualizer help us build and audit AI models?Building large AI models has a learning curve, and is both time and resource intensive. Until recently, we thought of a pre-trained AI’s model weights as ambiguous 2d arrays of decimal numbers, but what if there was something more.Today we want to share how we are exploring AI model weights, but first let’s see how we got here.BackgroundWe read these key papersImageNet classification with deep convolutional neural networksAttention Is All You NeedTakeaways / HighlightsTransformers and attention are used for encoding and decoding training dataArchitecture enables making predictions using math and matrices by hosting the weights in memoryEverything needed to reproduce Transformer behaviors are stored and shared as weights in model filesWeights are saved as numerical data in a model file (usually 2d float 32 arrays)Key QuestionsWhat else works with matrices and high resolution float 32 data? (TIFF images)?Graphics / gaming engines / ffmpegBrain image scanning with FMRI / CAT / MEGNasa Earthdata GeoTiffWhy can’t we reuse similar techniques from these systems that have large, high resolution datasets to navigate “the weights” with a different type of iterator? With the current rust and mmap performance loading a 100 GB file on disk, who knows maybe this approach could work without a GPU for smaller models constrained to CPU-only.What technical pieces are missing/required to get started?What do the weights look like?How can we teach AI to learn what weights mean?What can we do with time series training data based on how an AI model’s weights changed over time?ConclusionWhatWe have built a prototype for extracting and hopefully identifying how weights:relate back to the original source training datachange over many training generationsappear to represent a dense 3d field of training knowledge saved as embedded “weights” (unproven but this is our hypothesis based on the techniques that appear to be working)WhyWe wanted to understand why LLMs are special and how the weights fit into this innovative technology.By choosing to spend our time trying to view what LLM weights are, we believe we can apply well-known visualization techniques for analyzing human brain scans to extract, identify, reuse and audit what the weights are.Before large generative AI Transformer weights were widely available, these types of dense, high resolution training datasets were very expensive and not frequently sharedHowWe built this prototype using digital signal processing algorithms (DSP) for volumetric analysis of high resolution data and combined the analysis engine with Blender (an open source visualization tool).We will open source and track how an AI learns from the ground up and use Blender to export and share what the weights look like as we go.By choosing to use Blender to analyze model weights in a 3d volume, we built in animation capabilities that let us design our initial v1 API for capturing a time series training dataset. This training dataset is focused on capturing how an AI foundational model learns through each training phase using high performance weight analysis on volumetric data.We believe we need to share how these models look so we can understand them and train AI’s to build and audit themselves.We want to see what mixtures of experts looks like too (download the newest Dolphin 2.5 Mixtral 8x7B STL/glTF mesh versions below).OverviewThis repository is for profiling, extracting, visualizing and reusing generative AI weights to hopefully build more accurate AI models and audit/scan weights at rest to identify knowledge domains for risk(s).Note: today's version only includes how to profile, extract and visualize existing model weights. Now that we can visualize how AI models learn, foundational model training is next. The training visualization will start by teaching a new AI model about "how thebampe-weights repositoryintegrated numpy, pandas and Blender". We have ~190 python/(task,prompt,answer) files to organize before sharing.What do extracted weights look like?This repository is exploring visualizations of model's learning over time and building training datasets from extracted "weight shapes" to build and predict new AI model weights (hopefully faster than traditional training methods too).Here's what Llama 2 7B Chat GPTQ looks like inside Blender and exported as a gif using this repository:View extracted shapes from Llama 2 7B Chat GPTQ in a 75 MB gif - https://i.imgur.com/9vdATAt.mp4Catalog of Available Generative AI Blender 3D Visualizations in glTF and STL files hosted on Google DriveThe following google drive folders contain the emerging index of large language model glTF and STL visualizations. The files range from ~1 MB to +2 GB.Reach out if you want to see a new model/density!Dolphin 2.5 Mixtral 8x7B GPTQPhind CodeLlama 34B v2 GPTQDeepSeek Coder 34B GPTQMistral 7B OpenOrca GPTQLlama 2 7B Chat GPTQGPT 2Datasets on GitHubViewing STL Files on GitHubIf an STL file is small enough, then GitHub can automatically render the 3d meshes. Note: viewing GitHub STL on mobile is not ideal at the moment, but on a desktop you can zoom into the layers using a mouse wheel in reverse and rotate with the left/right mouse buttons:Dolphin 2.5 Mixtral 8x7bPhind Code Llama 2 34B v2Mistral 7B OpenOrcaGitHub Dataset RepositoryWe try to stay under the 50 MB limit and store assets on ourrepo on GitHub - https://github.com/matlok-ai/gen-ai-datasets-for-bampe-weights/docs/images/blenderUsing Blender to Visualize Generative AI Models the AI Training ProcessViewing Extracted Shapes from AI Model Weights Using a Blender Container ImageSelf-host Blender in a container to help see what generative AI weights look like locally:Blender Demo Container Image with exported STL/GLB files already includedThematlok/blender-ai-demosimage was created from theLinuxServer Blender imageand includes 3D STL and GLB files that you can view in a browser. The blender-ai-demos extracted container image is >4.0 GB on disk and uses about 3 GB ram to process STL or glTF files >40 MB:The demo visualizations are found in this directory inside the container:/config/bampe-visualizationsDockerdocker rm blender; docker-compose -f compose/blender-demos.yaml up -dPodmanpodman rm -t 0 -f blender; podman-compose -f compose/blender-demos.yaml up -dBase LinuxServer imageRun theLinuxServer/docker-blender image (lscr.io/linuxserver/blender:latest)and generate new STL/GLB files that are ready to view using an already-mounted volume between the host and the Blender container (.blenderdirectory). The docker-blender extracted container image is ~3 GB on disk.Dockerdocker rm blender; docker-compose -f compose/blender-demos.yaml up -dPodmanpodman rm -t 0 -f blender; podman-compose -f compose/base.yaml up -dNote: newly-created visual artifacts (STL and glTF glb files) only show up once the container is restarted in this directory inside the Blender container:/config/bampeOpen up Blender in a browserBlender is listening at this url:http://localhost:3000Load a 3D Blender AI Visualization ManuallyOnce Blender is running in the browser, you can import STL or glTF files by clicking these menus:FileImportSTLorglTFFiles are either in the/config/bampeor/config/bampe-visualizationsdepending on the running container versionBlender Navigation Mode TipsNavigation Mode - WalkUseShift + `to enable navigation mode with the mouse and W, A, S, D for first person movement.Holding theShiftbutton will move with turbo speed too.Adjust Navigation Mouse Sensitivity and Walk SpeedOpenEdit->Preferences->Navigation->Fly & Walk->Walk Toggle ArrowAdjustMouse Sensitivity->0.1AdjustWalk Speed->20 m/sViewing AI Models like a Video Game with Blender on the Command LineSetting up a Development EnvironmentThis repository is for researching alternative approaches to building AI using pretrained AI weights. It is a work in progress so please refer to theSetting up a Development Environmentfor more details on running this from the command line.Where else can I view exported glTF and STL files?We can share and view these shapes using online tools.Online glTF viewershttps://gltf-viewer.donmccurdy.com/Online STL viewershttps://stlviewer.kwebpia.netSupported PlatformsThis repository was tested on the following platforms:Windows WSLBlender 3 on Ubuntu 22.04 (apt package) - wsl2 Windows 11 gpuLinux Ubuntu 22.04 Bare MetalBlender 4 on Ubuntu 22.04 (snap package) - hypervisor no gpuBlender Container Image SourcesDemos - matlokai/blender-ai-demosBase - LinuxServer/docker-blender