True ML Talks #16 - خط أنابيب التعلم الآلي @ Digits

Built for Speed: ~10ms Latency, Even Under Load
Blazingly fast way to build, track and deploy your models!
- Handles 350+ RPS on just 1 vCPU — no tuning needed
- Production-ready with full enterprise support
ML Usecases in Digits
Digits is a financial management software company that uses AI to automate accounting tasks for operators. By automating tasks such as transaction classification, outlier detection, and fraud detection, Digits helps operators to double their customer base and improve their response time to customers.
- Customer onboarding: Digits uses AI to help new customers set up their account and connect their bank accounts quickly and easily.
- Transaction classification: Digits uses AI to automatically classify transactions, saving accountants time and ensuring accurate categorization.
- Outlier detection: Digits uses AI to detect outliers in transactions, helping accountants to quickly identify and investigate unusual transactions.
- Reporting: Digits provides accountants with a variety of reports generated using AI to save time and get the insights they need quickly.
ML Models Used by Digits:
- Classification models: Classify transactions into different categories, such as meals, travel, and inventory.
- Prediction models: Predict future outcomes, such as customer churn and fraud.
- Generative models: Generate text, such as questions to ask customers and messages to send to customers.
- Similarity-based models: Find similar patterns in transactions and mimic those patterns.
ML Journey at Digits
Digits needed to move to deep learning and NLP models to address the challenges of accounting subjectivity. Also Digits had a strong foundation in data engineering and Kubernetes, which would be essential for building and scaling a successful ML platform.
The team began by introducing TFX for ML pipeline orchestration and TF Serving for model serving. This allowed Digits to build and deploy ML models in a scalable and reliable way.
Next, The team focused on developing similarity-based pipelines. These pipelines are able to accurately classify transactions and identify outliers, even when the data is ambiguous or incomplete. This is because similarity-based pipelines find similar patterns in transactions and mimic those patterns. This approach is more effective than using global machine learning models, which can give inconsistent results depending on the accountant's interpretation of the data.
Digits' ML pipelines are now used to power a variety of features, including transaction classification, outlier detection, and fraud detection. As a result, Digits is able to provide its customers with valuable insights and help them to automate tasks, improve accuracy, and save money.
Orchestrating ML Training on Kubernetes
Digits' approach to ML training is well-organized and efficient. The use of Kubernetes for orchestration allows Digits to scale its training operations up or down as needed. The use of TensorFlow Transform for preprocessing and the training platform in Google Cloud projects provides Digits with the tools and resources it needs to train complex models quickly and efficiently. The use of a validation set and a model registry ensures that Digits is shipping high-quality models to production.
Digits orchestrates ML training on Kubernetes using the following steps:
- ETL process: Digits uses an ETL process to gather artifacts from around the system and bootstrap datasets on a continuous basis.
- Data validation and schema creation: Digits validates the statistics of the datasets and creates schemas.
- Preprocessing: Digits uses TensorFlow Transform to preprocess the data.
- Training: Digits trains the models in Google Cloud projects using the training platform.
- Evaluation: Digits evaluates the trained models using a validation set.
- Model registry: Digits ships the trained models to a model registry.
- Deployment: Digits uses a CI/CD system to deploy the trained models to production.
Managing GPU Resource Allocation in ML Training at Digits
In the realm of GPU resource allocation for ML training, Digits employs a comprehensive approach involving both manual and automated procedures. This strategy encompasses:
Manual Processes: Digits sets clear GPU usage boundaries for teams and projects to uphold equitable allocation while averting overutilization. Additionally, it champions open communication among ML engineers, fostering resource awareness and mitigating conflicts.
Automated Processes: Digits maintains vigilance through continuous GPU usage monitoring, issuing timely alerts should usage exceed predefined thresholds to facilitate early issue identification and resolution. A queuing system ensures fair GPU allocation, adhering to a first-come-first-served basis.
Best Practices: Digits encourages ML engineers to plan GPU utilization proactively, ensuring resource availability and conflict minimization. Leveraging cloud resources provides flexibility, ensuring adequate GPU access even during periods of high demand. Promoting transparency in GPU utilization nurtures trust and cooperation among team members, ultimately enhancing resource management.
Utilizing TensorFlow Profiler for Training Run Analysis at Digits
At Digits, TensorFlow Profiler takes center stage in the analysis of training runs, providing valuable insights for optimizing ML models:
Digits diligently logs every training run through TensorFlow Profiler, allowing for the tracking of performance trends over time.
Vital metrics including training duration, memory consumption, and accuracy are meticulously tracked, facilitating meaningful performance comparisons across diverse models and configurations.
TensorFlow Profiler equips Digits with the capability to systematically compare the performance of various training runs, thereby assisting in the judicious selection of the most suitable model and configuration to address specific problem domains.
Benefits:
- Improved Performance: TensorFlow Profiler identifies and addresses performance bottlenecks, leading to significant enhancements in training speed and accuracy.
- Cost Reduction: Enhanced training performance reduces the overall cost of ML model training for Digits.
- Increased Transparency: Detailed performance insights provided by TensorFlow Profiler enhance Digits' understanding of ML model training and help identify potential issues early on.
Optimizing Validation Sets for Similarity-Based ML Pipelines
When crafting validation sets for similarity-based ML pipelines, consider these key factors:
- Objective: Define the model's objective—what constitutes similarity between data points? Once this objective is clear, the validation set can be populated with known similar and dissimilar examples.
- Context: The validation set should mirror the model's real-world application. For instance, if the model recommends products to customers, it should include items customers often buy together.
- Size: Strike a balance—your validation set should be statistically significant but manageable. A general guideline is to make it at least 10% of the training set's size.
- Variability: To bolster the model's robustness, ensure your validation set encompasses diverse data points.
- Operators Impact: The number of operators can bias the validation set towards specific industries. To mitigate this, incorporate examples from various verticals and industries.
Challenges and Optimizations of Similarity-Based ML Pipelines
Similarity-based ML pipelines have a number of unique challenges and optimizations, compared to traditional ML pipelines.
Challenges:
- Choosing a loss function: There are a variety of different loss functions that can be used for similarity-based ML models. Choosing the right loss function is important for ensuring the accuracy and reliability of the model.
- Structuring the training data: The way the training data is structured depends on the chosen loss function. It is important to structure the training data in a way that is efficient and effective.
- Optimizing for performance: Similarity-based ML models can be computationally expensive to train. It is important to optimize the training process for performance.
Optimizations:
- Use a GPU: GPUs can significantly accelerate the training of similarity-based ML models.
- Profile the model: Profiling the model during training can help to identify bottlenecks and areas where the training process can be improved.
- Preprocess the data: Preprocessing the data can improve the performance of the model and reduce the training time.
- Reduce the input tokens: If using a language model, reducing the number of input tokens can improve the performance of the model and reduce the training time.
Digits Uses TensorFlow Extended and Vertex AI Pipelines for Similarity-Based ML Pipelines
Digits uses TensorFlow Extended (TFX) and Vertex AI Pipelines for similarity-based ML pipelines. TFX is a Google-developed, open-source end-to-end platform for building, deploying, and managing ML pipelines. Vertex AI Pipelines is a fully managed cloud service for managing ML pipelines.
TFX provides a number of components that are useful for building similarity-based ML pipelines, including:
- TFX Data Validation: Validates the quality and consistency of the training data.
- TFX Transform: يعالج بيانات التدريب مسبقًا، بما في ذلك التعامل مع القيم المفقودة، وتحويل أنواع البيانات، وتوسيع نطاق الميزات.
- TFX Model Analysis: يقيم أداء النماذج المدربة على مجموعة تحقق محجوزة.
- TFX Serving: ينشر النماذج المدربة للإنتاج.
تسهّل مسارات Vertex AI تشغيل وإدارة مسارات TFX على نطاق واسع. توفر مسارات Vertex AI عددًا من الميزات المفيدة لمسارات التعلم الآلي القائمة على التشابه، بما في ذلك:
- التوسع التلقائي: يمكن لمسارات Vertex AI توسيع نطاق الموارد المستخدمة لتشغيل المسارات تلقائيًا، بناءً على الطلب.
- المراقبة والتنبيه: توفر مسارات Vertex AI ميزات المراقبة والتنبيه التي يمكن أن تساعد في تحديد المشكلات وحلها في المسارات.
- التحكم في الإصدارات: توفر مسارات Vertex AI ميزات التحكم في الإصدارات التي تسهل تتبع وإدارة التغييرات في المسارات.
تستخدم Digits نقاط نهاية Vertex لسجل النماذج وTF Serving للإنتاج
تستخدم Digits نقاط نهاية Vertex لسجل النماذج وTF Serving للإنتاج.
Vertex Endpoints هي خدمة سحابية مُدارة بالكامل لنشر وإدارة نماذج التعلم الآلي. توفر عددًا من الميزات التي تجعلها خيارًا جيدًا لسجل النماذج، بما في ذلك:
- الإدارة المركزية: توفر Vertex Endpoints مكانًا مركزيًا لتخزين النماذج وإدارتها.
- التحكم في الإصدارات: توفر Vertex Endpoints ميزات التحكم في الإصدارات التي تسهل تتبع وإدارة التغييرات في النماذج.
- التحكم بالوصول: توفر نقاط نهاية Vertex ميزات التحكم بالوصول التي تسهل التحكم في من يمكنه الوصول إلى النماذج ونشرها.
TF Serving هو نظام خدمة TensorFlow عالي الأداء وجاهز للإنتاج. يوفر عددًا من الميزات التي تجعله خيارًا جيدًا للإنتاج، بما في ذلك:
- أداء عالٍ: يمكن لـ TF Serving خدمة النماذج بإنتاجية عالية وزمن استجابة منخفض.
- قابلية التوسع: يمكن توسيع نطاق TF Serving للتعامل مع أعداد كبيرة من الطلبات.
- الموثوقية: تم تصميم TF Serving ليكون موثوقًا وجاهزًا للإنتاج.
تستخدم Digits CI/CD لأتمتة نشر النماذج إلى نقاط نهاية Vertex. عندما يتم تسجيل نموذج في سجل النماذج، يتم تشغيل نظام CI/CD. يقوم نظام CI/CD بعد ذلك بإنشاء نموذج TF Serving ونشره إلى نقطة نهاية Vertex.
الفوائد:
هناك عدد من الفوائد لاستخدام نقاط نهاية Vertex وCI/CD للإنتاج:
- قابلية التوسع: يمكن لنقاط نهاية Vertex توسيع نطاق الموارد المستخدمة لخدمة النماذج تلقائيًا، مما يسهل التعامل مع أعداد كبيرة من الطلبات.
- الموثوقية: تم تصميم نقاط نهاية Vertex لتكون موثوقة وجاهزة للإنتاج.
- الأتمتة: تعمل CI/CD على أتمتة نشر النماذج، مما يقلل من مخاطر الأخطاء البشرية ويسهل نشر النماذج بشكل متكرر.
كيف تكتشف Digits تلقائيًا متى تحتاج النماذج إلى إعادة التدريب
تستخدم Digits مجموعة من التقنيات لاكتشاف تلقائي متى تحتاج النماذج إلى إعادة التدريب:
- مراقبة تنبؤات النموذج: تراقب Digits تنبؤات النماذج في بيئة الإنتاج. إذا بدأت التنبؤات تصبح غير دقيقة، فقد يكون هذا مؤشرًا على أن النموذج يحتاج إلى إعادة تدريب.
- تتبع مقاييس أداء النموذج: تتتبع Digits عددًا من مقاييس أداء النموذج، مثل الدقة والضبط والاستدعاء. إذا بدأت هذه المقاييس في التدهور، فقد يكون هذا مؤشرًا على أن النموذج يحتاج إلى إعادة تدريب.
- التحقق من مقتطفات البيانات: تتحقق Digits بشكل دوري من مقتطفات البيانات من بيئة الإنتاج. يساعد هذا في تحديد أي انحراف في البيانات قد يحدث. إذا تم اكتشاف انحراف في البيانات، فقد يكون هذا مؤشرًا على أن النموذج يحتاج إلى إعادة تدريب.
- مراجعة مخرجات النموذج: تمتلك Digits منصة مراجعة داخلية حيث يمكن للموظفين مراجعة مخرجات النماذج. يساعد هذا في تحديد أي حالات لا يقوم فيها النموذج بإجراء تنبؤات دقيقة. إذا تم تحديد مثل هذه الحالات، فقد يكون هذا مؤشرًا على أن النموذج يحتاج إلى إعادة تدريب.
بمجرد أن تكتشف Digits أن نموذجًا يحتاج إلى إعادة تدريب، فإنها تستخدم CI/CD لأتمتة عملية إعادة التدريب والنشر. يقوم نظام CI/CD بإنشاء نموذج TF Serving جديد باستخدام أحدث بيانات التدريب وينشره على نقطة نهاية Vertex.
مثال:
فيما يلي مثال لكيفية عمل عملية إعادة تدريب النموذج التلقائية في Digits:
- يقوم نموذج في بيئة الإنتاج بإجراء تنبؤ غير دقيق.
- يكتشف نظام المراقبة الخاص بـ Digits التنبؤ غير الدقيق ويرسل إشعارًا إلى نظام CI/CD.
- يقوم نظام CI/CD بتشغيل مهمة تدريب جديدة.
- تقوم مهمة التدريب بتدريب نموذج جديد باستخدام أحدث بيانات التدريب.
- يقوم نظام CI/CD بنشر النموذج الجديد على نقطة نهاية Vertex.
- يُستخدم النموذج الجديد الآن لإجراء التنبؤات في بيئة الإنتاج.
أهمية التعاون بين مهندسي تعلم الآلة والمصممين
غالبًا ما يعمل مهندسو تعلم الآلة (ML) والمصممون بمعزل عن بعضهم البعض، مما قد يؤدي إلى مشاكل عند محاولة إدخال نماذج تعلم الآلة إلى مرحلة الإنتاج. قد يطور مهندسو تعلم الآلة نماذج دقيقة ولكنها ليست سهلة الاستخدام، بينما قد ينشئ المصممون واجهات جذابة بصريًا ولكنها لا تجمع ملاحظات حول تنبؤات النموذج.
لمعالجة هذه التحديات، من المهم أن يتعاون مهندسو تعلم الآلة والمصممون بشكل وثيق. يمكن تحقيق ذلك من خلال:
- العمل معًا على متطلبات المنتج: يجب أن يعمل مهندسو التعلم الآلي والمصممون معًا لتحديد متطلبات المنتج لنماذج التعلم الآلي. سيساعد هذا في ضمان تطوير النماذج لتلبية احتياجات المستخدمين وأن تصميم الواجهات متوافق مع النماذج.
- تبادل الملاحظات: يجب على مهندسي التعلم الآلي والمصممين تبادل الملاحظات بانتظام مع بعضهم البعض. سيساعد هذا في تحديد أي مشاكل محتملة في النماذج أو الواجهات في وقت مبكر.
- إنشاء حلقات ملاحظات: يجب على مهندسي التعلم الآلي والمصممين إنشاء حلقات ملاحظات لجمع الملاحظات من المستخدمين حول أداء النماذج وسهولة استخدام الواجهات. يمكن استخدام هذه الملاحظات لتحسين النماذج والواجهات بمرور الوقت.
نصائح لبناء منصات التعلم الآلي
- الكفاءة: ركز على بناء مسارات عمل MLOps فعالة للتطبيقات المحددة، مثل تلك التي تتطلب بيانات خاصة أو مستويات عالية من الخصوصية والأمان.
- API أولاً: فكر في استخدام نماذج مدربة مسبقًا من OpenAI و Anthropic و Bard ومقدمي الخدمات الآخرين للمهام العامة.
- الاستشارة: ركز على التشاور مع أعضاء الفريق الآخرين حول كيفية استخدام واجهات برمجة التطبيقات هذه وحل المشكلات المحددة الخاصة بالمجال.
الذكاء الاصطناعي التوليدي في Digits
يمتلك الذكاء الاصطناعي التوليدي القدرة على إحداث ثورة في العديد من الصناعات. فيما يلي بعض حالات الاستخدام للذكاء الاصطناعي التوليدي في Digits:
- تعزيز التواصل بين المحاسبين والمشغلين: يمكن استخدام الذكاء الاصطناعي التوليدي لتوليد تقديرات للأسئلة والأجوبة، مما يوفر الوقت والجهد لكلا الطرفين.
- الاستضافة الداخلية للنماذج اللغوية الكبيرة: تمتلك Digits بنيتها التحتية الخاصة لاستضافة النماذج اللغوية الكبيرة، مما يسمح لها بالقيام بذلك بطريقة آمنة وموجهة نحو الخصوصية.
- استخدام الوصول القائم على واجهة برمجة التطبيقات (API) إلى نماذج الذكاء الاصطناعي التوليدي: هناك إمكانية للجمع بين الوصول القائم على واجهة برمجة التطبيقات (API) إلى نماذج الذكاء الاصطناعي التوليدي والتعلم الآلي القائم على التشابه لتقديم تجربة منتج رائعة.
هناك مخاوف تتعلق بالخصوصية والأمان مرتبطة بالذكاء الاصطناعي التوليدي، ومن المهم معالجة هذه المخاوف بطريقة مسؤولة. يمكننا كمجتمع إيجاد طرق لتطوير واستخدام الذكاء الاصطناعي التوليدي بطريقة آمنة ومفيدة للجميع.
سيتغير مشهد استضافة سجل النماذج والصب بشكل كبير في السنوات القادمة لاستيعاب احتياجات نماذج اللغة الكبيرة. - هانيس
اقرأ مدوناتنا السابقة ضمن سلسلة True ML Talks:
استمر في مشاهدة TrueML سلسلة يوتيوب وقراءة TrueML سلسلة المدونات.
TrueFoundry هي منصة PaaS لنشر التعلم الآلي (ML) تعمل فوق Kubernetes لتسريع سير عمل المطورين مع منحهم مرونة كاملة في اختبار ونشر النماذج، مع ضمان الأمان والتحكم الكامل لفريق البنية التحتية. من خلال منصتنا، نمكّن فرق التعلم الآلي من نشر ومراقبة النماذج في 15 دقيقة بموثوقية 100% وقابلية للتوسع والقدرة على التراجع في ثوانٍ - مما يسمح لهم بتوفير التكلفة وإطلاق النماذج إلى الإنتاج بشكل أسرع، مما يحقق قيمة تجارية حقيقية.
TrueFoundry AI Gateway delivers ~3–4 ms latency, handles 350+ RPS on 1 vCPU, scales horizontally with ease, and is production-ready, while LiteLLM suffers from high latency, struggles beyond moderate RPS, lacks built-in scaling, and is best for light or prototype workloads.
The fastest way to build, govern and scale your AI


















.png)
.webp)










.webp)






