Bitsletter #4: Debug Models With Overfitting, Await Concurrent Promises, Large Language Models Are Zero Shot Learners, Remotion ...
Subscribe to the Bitsletter
If you like my content, support me by subscribing to my newsletter: Bitsletter.
Every Wednesday receive actionable content to stay on top of AI & Web Technologies:
- 1 AI/Machine learning tip
- 1 Web Tech tip
- 1 Research paper
- Curated news and tools in AI and Web
Happy reading.
π§ ML Tip: Debug Models With Overfitting
Debugging machine learning models can be hard and time-consuming. Many things can go wrong:
- Data loading
- Modeling
- Training
- β¦
Fortunately there is a simple trick to detect bugs early: overfitting.
Overfitting happens when a model is over-specialized on the training set and unable to generalize on new data.
As bad as it sounds, overfitting can be your ally to find bug easily in your code: if your model overfits, at least the training process worked on the training dataset. It is a clue that you donβt have a bug in you code.
The idea is to create artificially the condition for overfitting:
- Take a few batches of your training data
- Train your model on it for many steps
- If the model overfits (loss going to almost 0 quickly), you likely have a bug-free code
- If the model canβt overfit, you must have a bug somewhere in the code
π Web Tip: Await Promises Concurrently With Promise.all
We use promises extensively in JavaScript: they represent the eventual completion or failure of an asynchronous task and its resulting value.
The most convenient way to wait in the code for the promise termination and get
its value is through the async/await
keywords.
However if you have many promises to run concurrently, donβt fall into the trap of awaiting them in a for loop. The code will become synchronous, starting each promise and awaiting for its result in a sequence.
Instead create an array of promises and call Promise.all(arrayOfPromises)
to
await for all the promises at the same time, resulting in the concurrent
execution of all the promises.
Using this technique you can make several call to API concurrently, saving your script lots of execution time.
π©βπ¬ Research Paper: Large Language Models are Zero-Shot Reasoners
There is a reasoning potential in large language models that you can unlock with prompt engineering (zero-shot learning).
Large language models are great few-shot learners:
Use a pre-trained large model and fine-tune on a few examples describing the new tasks.
Using few-shot learning, these models achieved great performances in reasoning tasks like arithmetic or symbolic reasoning.
What if we don't even need fine-tuning?
Large Language Models are Zero-Shot Reasoners is a recent paper exploring zero-shot learning for reasoning tasks.
Here the model is not fine-tuned on tasks examples.
Only the prompts are engineered so that the model can handle the task, without explicit training.
π‘ Simply adding βLetβs think step by stepβ before each model answers increased the accuracy significantly on reasoning tasks:
ππ½ From 17.7% to 78.7% on MultiArith
ππ½ From 10.4% to 40.7% GSM8K
These results show the huge zero-shot learning potential of large language models.
β High-level reasoning tasks can be extracted via clever prompting.
π Β Tool: Remotion
Whether you're an individual doing it for fun, or a company with a content strategy, video is one of the most consumed content on the internet.
1 Billion hours of video watched each day on YouTube.
Remotion, is an amazing tool using React to build videos.
Uuse HTML, CSS, and JavaScript to create videos programmatically.
Remotion unlocks the power of data driven videos:
ππ½ Build a template with React components
ππ½ Use input data to drive the
content
ππ½ Build infinitely many videos by just changing the data
With Remotion you can also render videos in the cloud:
ππ½ Build your script describing the video
ππ½ Run it in the cloud and get
back an mp4 video file
π‘ Finally Remotion also have a great video player with live reloading to inspect your video as a web application.
You can smoothly play animations to get your video "frame perfect".
Definitely give it a try if you are into video production/editing and web development.
π°Β News
Hugging Face Releases Evaluate, A Library To Evaluate Models
Hugging Face released a library for model evaluation. It contains many metrics, compatible with Numpy/Pandas/PyTorch/TensorFlow/JAX. Bonus: the input are type checked to avoid bugs and each metrics comes with a card describing the values, limitations and ranges.
GitHub Has Now Markdown Math Support
Math equations contains many information if a compressed format β a great way to communicate. GitHub now supports Markdown equation using MathJax. Just use $ for inline equations and $$ for block equations (similar to LaTeX).