Practice · AI/ML

AI and machine learning engineering

Applied machine learning from data audit to deployment on cloud GPUs, edge SoCs, microcontrollers and FPGAs, with evaluation that holds up after release.

What we can help with

  • Feasibility and data audits

    An assessment of whether the available data can support the intended model, covering label quality, duplicates, split design and leakage risks, before training starts.

  • Model development for signals and sensors

    Classification, detection and anomaly models for audio, vibration, RF and other sensor streams, designed with the target hardware's memory and latency limits from the start.

  • Model compression and quantization

    Post-training quantization, quantization-aware training, pruning and distillation, measured against an agreed accuracy, size and latency budget.

  • Edge and embedded deployment

    Porting and profiling models on edge SoCs, microcontrollers and FPGAs, including runtime selection, memory planning and on-target measurement.

  • Evaluation and benchmarking

    Independent test-set design, group-aware and time-aware validation, uncertainty reporting, and benchmarking on the deployment device.

  • LLM integration for engineering workflows

    Retrieval-augmented assistants over internal technical documents, parameter-efficient fine-tuning, and quantized local deployment where data must stay on site.

Applied machine learning is mostly engineering around a model. The model has to learn from data that may be messy, run within a power and memory budget, and keep working after the data change. This page outlines how we approach each stage. The linked articles go deeper.

Data comes before architecture

We start with the data, not the network. Kapoor and Narayanan surveyed 22 reviews of machine learning in scientific fields and found data leakage affecting 294 papers across 17 fields [1]. Leakage means the test score includes information the model would not have in use. Typical causes are pre-processing before the train-test split, features that act as proxies for the label, and test samples drawn from the same units as training samples [1]. Test labels can also be wrong. Northcutt et al. estimate at least 3.3% label errors on average across the test sets of 10 widely used benchmarks [2].

A data audit asks simple questions first. What is the unit of independence? Which features exist at prediction time? How were labels produced? The answers decide how to split the data and how much a reported accuracy can be trusted. Our evaluation pitfalls checklist covers this in detail.

Training and inference are different workloads

Hinton et al. describe the split well. Training must extract structure from large, redundant datasets but need not run in real time. Deployment has much tighter limits on latency and compute [3]. Training usually runs in 32-bit floating point. Inference often does not need to: post-training quantization to 8 bits is in most cases enough to stay close to floating-point accuracy [4]. Multiply-accumulate operations and data movement dominate inference energy, so lower-precision integer arithmetic saves both [4].

Making models smaller

Three techniques do most of the work, and they combine.

  • Quantization stores weights and activations as 8-bit or smaller integers. Moving from 32 to 8 bits cuts memory by 4x [4]. Our article on quantization for deployment works through the arithmetic.
  • Pruning removes low-importance connections. In Deep Compression, pruning cut the number of connections by 9x to 13x. Combined with trained quantization and Huffman coding, it reduced AlexNet’s storage from 240 MB to 6.9 MB without accuracy loss [5]. Unstructured pruning leaves sparse matrices that are hard to accelerate. Structured pruning removes whole filters and keeps dense operations, but aggressive structured pruning tends to cost accuracy [6].
  • Knowledge distillation trains a small model to match the softened output probabilities of a larger one [3]. On its own, distillation tends to lose accuracy at aggressive compression ratios. Combined with quantization and pruning it has worked well [6].

Deployment targets

The same model can be deployed in very different ways depending on where it runs.

  • Cloud GPU. Large models are limited by memory capacity and bandwidth. The parameters of GPT-3 175B occupy 326 GB in FP16. GPTQ’s 3-bit version of OPT-175B fits on a single 80 GB A100, where FP16 needed five [7].
  • Edge SoC. Phone-class processors gain from integer kernels. On Snapdragon 835 LITTLE cores, integer-only MobileNets were about 10% more accurate than floating-point MobileNets at the 33 ms per frame needed for 30 fps [8].
  • Microcontroller. A Cortex-M7 part such as the STM32F746 has 320 kB of SRAM and 1 MB of flash [9]. Runtimes such as TensorFlow Lite Micro work from a single pre-allocated memory arena [10]. See TinyML on microcontrollers.
  • FPGA. The integer multiply-accumulate array, 32-bit accumulators and requantization step described in the quantization literature [4] become logic sized to the model’s actual bit widths. See neural network inference on FPGAs.

Choosing among them is a system decision. It depends on latency, power, unit cost, privacy and how often the model will change.

Evaluation that survives deployment

We set up the test before the model. That means a held-out set split by subject, machine or time where the data require it. It also means metrics that match the class balance, confidence intervals on headline numbers, and a simple baseline. In the civil war prediction studies Kapoor and Narayanan reproduced, complex models lost their reported advantage over logistic regression once leakage was fixed [1]. On-device benchmarking then checks that accuracy, latency and energy hold on the real hardware, not only in simulation.

MLOps basics

Sculley et al. observe that only a small fraction of a real-world ML system is model code, and the surrounding infrastructure is large and complex [11]. They estimate that a mature system using generic packages may be at most 5% machine learning code and at least 95% glue code [11]. Their practical points still apply:

  • Changing one input’s distribution can change how the model uses every other input. The same holds for hyperparameters and data selection [11].
  • Unstable input signals can be frozen as versioned copies until a new version is vetted [11].
  • Configuration deserves code review and version control [11].
  • Production monitoring should compare the distribution of predictions with the distribution of observed labels [11].

For embedded products, the same discipline covers model files, quantization parameters and runtime versions that ship in firmware.

LLMs in engineering workflows

We integrate transformer language models [12] with a team’s own documents. Retrieval-augmented generation pairs a generator with a retriever over a dense vector index. Lewis et al. found that this produced more specific and factual output than a model relying on its parameters alone [13]. Retrieval of this kind depends on embeddings, learned vectors that place related text close together. Mikolov et al. showed that word vectors of this kind could be learned from a 1.6-billion-word corpus in less than a day [14]. Low-rank adaptation (LoRA) fine-tunes a large model by training small added matrices. For GPT-3 175B, it cut trainable parameters by 10,000x and GPU memory by 3x compared with full fine-tuning [15]. Weight quantization then makes local deployment practical when documents cannot leave the site [7].

References

  1. S. Kapoor, A. Narayanan, “Leakage and the reproducibility crisis in machine-learning-based science”, Patterns, vol. 4, no. 9, 100804, 2023. DOI: 10.1016/j.patter.2023.100804
  2. C. G. Northcutt, A. Athalye, J. Mueller, “Pervasive Label Errors in Test Sets Destabilize Machine Learning Benchmarks”, NeurIPS 2021 Track on Datasets and Benchmarks, 2021. arxiv.org/abs/2103.14749
  3. G. Hinton, O. Vinyals, J. Dean, “Distilling the Knowledge in a Neural Network”, arXiv:1503.02531, 2015. arxiv.org/abs/1503.02531
  4. M. Nagel, M. Fournarakis, R. A. Amjad, et al., “A White Paper on Neural Network Quantization”, arXiv:2106.08295, 2021. arxiv.org/abs/2106.08295
  5. S. Han, H. Mao, W. J. Dally, “Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding”, Proc. ICLR 2016, 2016. arxiv.org/abs/1510.00149
  6. A. Gholami, S. Kim, Z. Dong, et al., “A Survey of Quantization Methods for Efficient Neural Network Inference”, arXiv:2103.13630, 2021. arxiv.org/abs/2103.13630
  7. E. Frantar, S. Ashkboos, T. Hoefler, D. Alistarh, “GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers”, Proc. ICLR 2023, 2023. arxiv.org/abs/2210.17323
  8. B. Jacob, S. Kligys, B. Chen, et al., “Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference”, Proc. IEEE/CVF CVPR, pp. 2704-2713, 2018. DOI: 10.1109/CVPR.2018.00286
  9. J. Lin, W.-M. Chen, Y. Lin, J. Cohn, C. Gan, S. Han, “MCUNet: Tiny Deep Learning on IoT Devices”, Advances in Neural Information Processing Systems 33 (NeurIPS 2020), 2020. arxiv.org/abs/2007.10319
  10. R. David, J. Duke, A. Jain, et al., “TensorFlow Lite Micro: Embedded Machine Learning on TinyML Systems”, Proc. 4th MLSys Conference, 2021. arxiv.org/abs/2010.08678
  11. D. Sculley, G. Holt, D. Golovin, et al., “Hidden Technical Debt in Machine Learning Systems”, Advances in Neural Information Processing Systems 28 (NIPS 2015), 2015. papers.nips.cc/paper_files/paper/2015/hash/86df7dcfd896fcaf2674f757a2463eba-Abstract.html
  12. A. Vaswani, N. Shazeer, N. Parmar, et al., “Attention Is All You Need”, Advances in Neural Information Processing Systems 30 (NIPS 2017), 2017. arxiv.org/abs/1706.03762
  13. P. Lewis, E. Perez, A. Piktus, et al., “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks”, arXiv:2005.11401, 2020. arxiv.org/abs/2005.11401
  14. T. Mikolov, K. Chen, G. Corrado, J. Dean, “Efficient Estimation of Word Representations in Vector Space”, arXiv:1301.3781, 2013. arxiv.org/abs/1301.3781
  15. E. Hu, Y. Shen, P. Wallis, et al., “LoRA: Low-Rank Adaptation of Large Language Models”, arXiv:2106.09685, 2021. arxiv.org/abs/2106.09685

Copies of the cited sources are held on file. DOIs were checked against CrossRef.

Related articles

Working with us

Engagements start with a short written brief and a call to agree scope. The contact form is not open yet.

Contact