great-ai/docs/index.md

7.8 KiB

Overview of GreatAI

Sonar line coverage Sonar LoC Test PyPI version Downloads Docker Pulls

Applying AI is becoming increasingly easier but many case studies have shown that these applications are often deployed poorly. This may lead to suboptimal performance and to introducing unintended biases{ target=_blank }. GreatAI helps fixing this by allowing you to ==easily transform your prototype AI code into production-ready software==.

??? quote "Case studies" "There is a need to consider and adapt well established SE practices which have been ignored or had a very narrow focus in ML literature." — John et al.{ target=_blank }

"Finally, we have found that existing tools to aid Machine Learning development do not address the specificities of different projects, and thus, are seldom adopted by teams." — [Haakman et al.](https://link.springer.com/article/10.1007/s10664-021-09993-1){ target=_blank }

"Because a mature system might end up being (at most) 5% machine learning code and (at least) 95% glue code, it may be less costly to create a clean native solution rather than re-use a generic package." — [Sculley et al.](https://www.researchgate.net/profile/Todd-Phillips/publication/319769912_Hidden_Technical_Debt_in_Machine_Learning_Systems/links/61e716d68d338833e37a7fd6/Hidden-Technical-Debt-in-Machine-Learning-Systems.pdf){ target=_blank }

"For example, practice 25 is very important for “Traceability", yet relatively weakly adopted. We expect that the results from this type of analysis can, in the future, provide useful guidance for practitioners in terms of aiding them to assess their rate of adoption for each practice and to create roadmaps for improving their processes.  — [Serban et al.](https://dl.acm.org/doi/abs/10.1145/3382494.3410681?casa_token=uCFz0dtDR6gAAAAA:4_8OMJ-5njwopYkB1KSGAu9JfbNq4nfa8LRE0fj84ckjfo-GgtcYQivZTGxal3M4haoA8r_xwpw){ target=_blank }

Features

  • Save prediction traces of each prediction including arguments and model versions
  • Save feedback and merge it into a ground-truth database ➡️ quasi-shadow deployment
  • Version and store models and data on shared infrastructure (MongoDB GridFS, S3-compatible storage, shared local-volume)
  • Automatically scaffolded custom REST API (and OpenAPI schema) for easy integration
  • Input validation
  • Sensible cache-policy
  • Seamless support for both synchronous and async inference methods
  • Easy integration with other remote GreatAI instances
  • Built-in parallelisation (with support for multiprocessing, async, and mixed modes) for batch processing
  • Well-tested utilities for common NLP tasks (cleaning, language-tagging, sentence-segmentation, etc.)
  • A simple, unified configuration interface
  • Fully-typed API for Pylance{ target=_blank } and MyPy{ target=_blank } support
  • Auto-reload for development
  • Docker support for deployment
  • Deployable Jupyter Notebooks
  • Dashboard for high-level overview and analysing traces
  • Support for direct file input
  • Support for PostgreSQL

Hello world

pip install great-ai
from great_ai import GreatAI

@GreatAI.create  #(1) 
def hello_world(name: str) -> str:  #(2) 
    return f"Hello {name}!"
  1. @GreatAI.create wraps your hello_world function with a GreatAI instance. The function will behave very similarly but:

    1. its return value becomes a Trace[str],
    2. it gets a process_batch method for supporting parallel execution,
    3. and it can be deployed using the great-ai command-line tool.
  2. Typing functions{ target=_blank } is recommended in general, however, not required for GreatAI to work.

??? note In practice, hello_world could be an inference function of some AI/ML application. But it could also just wrap a black-box solution of some SaaS. Either ways, it is imperative to have continuos oversight of the services you provide and data you process.

great-ai hello-world.py

Navigate to localhost:6060 in your browser.

![](media/hello-world-dashboard.png){ loading=lazy }

{ loading=lazy }

!!! success Your GreatAI service is ready for production use. Many of the SE4ML best-practices{ target=_blank } are configured and implemented automatically. To have full control over your service and to understand what else you might need to do in your use case, continue reading this documentation.

Why is this GREAT?

scope of GreatAI

GreatAI fits between the prototype and deployment phases of your (or your organisation's) AI development lifecycle. This is highlighted with blue in the diagram. Here, a number of best practices can be automatically implemented aiming to achieve the following attributes:

  • General: use any Python library without restriction
  • Robust: have error-handling and well-tested utilities out-of-the-box
  • End-to-end: utilise end-to-end feedback as a built-in, first-class concept
  • Automated: focus only on what actually requires your attention
  • Trustworthy: deploy models that you and society can confidently trust

Why GreatAI?

There are other, existing solutions aiming to facilitate this phase. Amazon SageMaker{ target=_blank } and Seldon Core{ target=_blank } provide the most comprehensive suite of features. If you have the opportunity use those, do that because they're great.

However, research indicates that professionals rarely use them. This may be due to their inherent setup and operating complexity. GreatAI is designed to be as simple to use as possible. Its clear, high-level API and sensible default configuration makes it extremely easy to start using. Despite its relative simplicity over Seldon Core, it still implements many of the SE4ML best-practices{ target=_blank }, and thus, can meaningfully improve your deployment without requiring prohibitively large effort.

[:fontawesome-brands-python: Find it on PyPI](https://pypi.org/project/great-ai){ .md-button .md-button--primary }

:fontawesome-brands-docker: Find it on DockerHub{ .md-button .md-button--primary }

Production use

GreatAI has been battle-tested on the core platform services of ScoutinScience{ target=_blank }.

ScoutinScience logo{ loading=lazy } ScoutinScience logo{ loading=lazy }