語言模型的物理學 Physics of Language Models - ICML 2024 Tutorial

圖片
這是一個ICML 2024的tutorial talk,同時也是 一系列的研究 ,talk的youtube link在 這裡 本篇主要把看這個talk的一些讀書筆記記錄下來,雖然實際上talks是從 3 -> 2 -> 1 這個順序去講的,但這裡仍然以投影片的順序來描述,並把講者最後的感概放在Part 1的最後。 Intro 把智慧分為1.結構、2.知識以及3.推論 在可控制、理想的環境下做研究 (控制資料、調整參數) 可重複性高的實驗 (使用100M大小的模型,推出通用法則) 使用 probing 技巧去看模型裡面如何運作 1. Language Structures 這個部分有兩個目標:  1. 大型語言模型的解讀 (interpretation of LLMs)  並不是基於token level,而是使用更困難的階層式演算法來更精確地解釋LLM如何學習解決這樣的演算法 2.大型語言模型的結構 LLM如何學習格式(format)? → hallucination(幻覺) hallucination只是LLM學習到格式的速度比底層任務快而造成的現象 希望能觀察LLM如何解決更階層式、複雜的語言架構 他們使用的方法是CFG(context-free grammar)作為課題來達成以上兩個目標 他們設計了自己的CFG,大約有20+的長度,這是一個非常長的CFG CFG會從root開始 →  leaf 完成整個推論的樹,這樣長度的CFG會非常難從最終結果回推到他們的源頭,要完全記住這些samples也不可能,因為會有10的80次方個sample  他們從三個面向來測試模型是否能學習這樣的CFGs: accuracy, diversity, distribution 如果使用相對或旋轉嵌入的位置編碼,準確度會很高,但如果是用絕對的位置編碼就會得到很差的結果 為什麼會這樣呢? 因為使用相對/旋轉的位置編碼對於語言架構的注意力來說非常有幫助 相對注意力表現比旋轉好,但相對注意力太慢了 但如果用一個GPT_stupid也可以發現不錯的表現 (這個GPT的head h會往回看2^h-1個token) 例如第一個head會往前看第1個token,第二個head往前看前3個token,第三個head往前看前7個token,這些tok...

機器學習工具大整理 Collections of Machine Learning Tools

Best of ml: https://github.com/ml-tooling/best-of-ml-python

EDA make easy : Pandas-Profiling, Sweetviz,  Autoviz, D-Tale

Classification metrics
  • Confusion Matrix
  • ROC AUC
  • Gini Coefficient
  • Gain and Lift Charts
  • KS Chart (Kolmogorov-Smirnov)
Regression metrics
  • MSE, RMSE
  • MAE
  • MAD
  • RAE (Relative Absolute Error)
  • RSE (Relative Squared Error)
  • R-squared and Adj R-squared
  • Analysis of Residuals
Competition
  • Feature Selection: eli5, lofo,
  • Data loading: Faker, Tensorflow Datasets, datasets, Pdfminer.six
  • Imbalanced data: imblearn
  • Parameter Optimization: Optuna, Keras Tuner, skopt(scikit-optimize), Hyperopt
  • AutoML: H2O, NNI (Neural Network Intelligence), auto sklearn, auto keras, TPOP
  • Algo: Lightgbm, Xgboost, Catboost, Lazypredict
  • More effetive pandas: Vaex
  • Model Interpretability: LIME, SHAP, interpret, alibi
  • Missing value imputer: sklearn.impute.IterativeImputer
  • Training ( Workflow & Experiment Tracking): Tensorboard, MLFlow, TensorWatch, Data Version Control(DVC), Metaflow
NLP
  • NLP: Kashgari, FastNLP, TextBlob
  • QA: NeuralQ
  • NER: NeuroNER
  • Neural Relation Extraction(NRE): OpenNRE
  • Label: Docanno
  • Seq2Seq: fairseq
CV
  • Image: Pillow, torchvision, scikit-image
  • Image model: PyTorch Image Models, GluonCV
  • Image label: labelImg
  • Object detection: deectron2, mmdectection
  • Face Recognition: face_recognition, facenet_pytorch
  • Segmentation: segmentation_models
  • Image data augmentation: imgaug, Albumentations, Augmentor
  • Finding duplicate image: imagededup
  • Explainable : cv2.saliency
  • Faster image loading : libjpeg-turbo, PyVips
Time Series
  • Time Series Feature extraction: tsfresh
  • TS smoothing and outliner dectection: tsmoothie
  • Time Series forecasting: Prophet and NeuralProphet,  sktime, pytorch-forecasting, pmdarima
  • Better datetime: python-dateutil
  • generalized framework : Kats
  • markov model: Deeptime
OCR
  • OCR: Tesseract, EasyOCR, PaddleOCR
Medical
  • Medical: MNE-Python, Nilearn, Lifelines
Recommendation System
  • Building and analysis : recommenders, torchrec, TensorFlow Recommenders, Pyspark.mlib.recommendation, surprise
  • Collaborative Filtering : Implicit
  • Factorization Machine : lightFM
Face detection
  • Facenet, OpenFace, VGG-Face, DeepFace, Dlib
Visualization
  • Data visualization: Plotly, Bokeh, Holoviews, Datashader pydantic, schema
  • Ploting Architecture: PlotNeuralNet
  • High Dimensional Data :  UMAP
Production
  • Training pipeline: Kubeflow, Airflow,  Prefect, Metaflow, Tensorflow Extended
  • Data Versioning: DVC
  • Data Validation: TensorFlow Data Validation (TFDV), datatest
  • Distributed: Ray, PySpark, DeepSpeed
  • Model Monitoring:  Seldon, MLWatcher
  • Model registry : MLFlow
  • Explainable : SHAP
  • Experiment Monitoring : TensorBoard, Weights & Biases
  • Measurement of  Model time : PyTorch Profiler, Tensorflow Profiler
  • Code Review: ReviewNB
  • API: Flask, FastAPI
  • Large scale: Pyspark, TensorFlowOnSpark, Horovod, BigDL
  • Python SQL: BlazingSQL, dask-sql
  • CI/CD: GoCD, AutoRABIT
  • C++: Dlib, mlpack
  • Label : labelstudio
  • Model testing: checklist (NLP bias)
low-code
  • pycaret
Probabilistic Programming
  • PyMC
  • pyro


留言

這個網誌中的熱門文章

機器學習競賽王者演算法:XGBoost、LightGBM、CatBoost

十種常見的軟體架構模式 10 Common Software Architectural Patterns

為什麼只能在訓練資料上平衡不平衡的資料集? Why should you deal with an imbalanced dataset only on training data?