GithubHelp home page GithubHelp logo

rabbidave / serverless-latent-space-monitoring Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 39 KB

A series of serverless functions/resources (and Terraform) for consuming language model inputs and outputs to S3, enriching the data via sentiment analysis and topic modelling, loading to DynamoDB and subsequently monitoring for configurable deviation within the latent vector space.

License: Apache License 2.0

Python 67.65% HCL 32.35%
llmops llmsecurity

serverless-latent-space-monitoring's Introduction

Jimmy Neutron and Serverless Latent Space Monitoring

A series of serverless functions/resources (and Terraform) for consuming language model inputs and outputs to S3, enriching the data via sentiment analysis and topic modelling, loading to DynamoDB and subsequently monitoring for configurable deviation within the latent vector space.

Note: Support for monitoring Text, Vision, and Multimodal Attack Non-Conformity coming soon

♫ The Dream of the 90's ♫ is alive in Portland "a weird suite of Enterprise LLM tools" named after Nicktoons

Jimmy

Description:

Lambda1 (Jimmy Neutron.py)

Initialization: 
    
    * Initializes clients for S3, Comprehend (as data enrichment), and DynamoDB.

State Management:
    
    * Retrieves and updates a state record in a DynamoDB table; tracking state across invocations.

Processing:
    
    * Writes payloads to 'S3Comprehend' and initiates Comprehend jobs for topic and sentiment analysis, with results stored in S3; thereafter loading enriched data to DynamoDB such that new records are streamed to Lambda2 via DBStreams

IAM Permissions:
    
    * The Terraform module grants necessary permissions for S3, DynamoDB, and Comprehend interactions.
   
Note: Ensure the 'DataAccessRoleArn' provided to Comprehend has the appropriate permissions to access S3 buckets.

Lambda2 (Goddard, Compute!.py)

Initialization:
    
    * Initializes S3 (for large vector storage) and SQS (for alerting); identifying and caching the most recent centroid vector from 'S3VectorStore' at initialization for easier processing and alerting via SQS.

Processing:
    
    * Triggered by net-new DynamoDB Stream Records, whereby it encodes items with the 'text' attribute using SBERT and compares them to the cached centroid; recording a new centroid in S3 if the comparison exceeds a predefined threshold which alerts via SQS.

IAM Permissions:
    
    * Permissions for S3, SQS, and DynamoDB interactions are included in the Terraform module's IAM policy.

Terraform Module

Resource Definitions:
    
    * Defines DynamoDB tables, SQS queues, and IAM roles/policies in support of both Lambda functions.

IAM Role Policy:
    
    * Grants access to S3, DynamoDB, SQS and Comprehend.

Security Group and Lambda Configuration:
    
    * Defines a security group for Lambda functions and references 'module.lambda_functions' for Lambda deployment specifics

Forthcoming Changes

Lambda1:
    
    * Better Error Handling, Logging, and Monitoring of AWS Comprehend jobs

Lambda2:
    
    * Better Error Handling, Logging, and retry logic solving for delays in Centroid Vector availability

TF Module:
    
    * Conserved conventions across and support for other components (e.g. input pre-processing, output post-processing, forecasting, etc) of [LatentSpace.Tools](www.latentspace.tools)

serverless-latent-space-monitoring's People

Contributors

rabbidave avatar

Stargazers

Esteban Rodríguez Betancourt avatar  avatar

Watchers

 avatar

Forkers

aruneral01

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.